1

Let X be a random variable with this density function

$f_X(x)$ = 6x(1 - x) * $1_{[0,1]}(x)$

Problem: Run the random experiment to get a value of X.

I feel this is a very easy problem, but I do not entirely understand the $1_{[0,1]}(x)$ of the equation. Am I merely picking a value for x between [0,1] and plugging it into the equation above to get a value for X or am I missing the mark?

Dilip Sarwate
  • 41,202
  • 4
  • 94
  • 200
CD'A
  • 43
  • 3
  • 1
    Hint: take the middle value of three independent random values uniformly distributed between $0$ and $1$. For instance, an `R` command to do this would be `X – whuber Nov 05 '15 at 14:47
  • The question is "how can you build a procedure that generates samples from that target distribution". The basic sampling procedure is sampling from the uniform distribution. Can you transform it into your target ? – Guillaume Dehaene Nov 05 '15 at 14:48
  • And for your notation question : that the function with value 1 for x between 0 and 1 and 0 elsewhere. Your target is a random variable that is bounded – Guillaume Dehaene Nov 05 '15 at 14:50
  • The *question* at http://stats.stackexchange.com/questions/173637 contains an answer, because the distribution it discusses is that of $f_{2X-1}$, which is easily related to $f_X$. – whuber Nov 06 '15 at 03:32

1 Answers1

1

This is a pretty simple thing to fix, so no worries! The $1_{[0,1]}(x)$ is merely an indicator function. Remember that the area under the density function must integrate to 1. If you graphed $f_X(x)$ without the indicator on a graph, the area wouldn't integrate to 1. The area would, however, integrate to one if you restricted the function on the interval $[0,1].$

The indicator function $1_{[a,b]}(x)$ equals 1 on $[a,b]$ and equals 0 everywhere else (that is, outside $[a,b]$). The function $f_X(x)$ includes the indicator function $1_{[0,1]}(x)$ so that $6x(1-x)$ is nonzero only on the interval $[0,1]$ and is zero everywhere else.

In order to sample from that density, you need to only generate a random number from that density and discard any number outside of $[0,1].$ There's likely an easy way to accomplish this in your software of choice, but I hope this helps to get you started!

Matt Brems
  • 2,588
  • 1
  • 11
  • 14
  • 3
    To nitpick a little, $6x(1-x)$ is nonzero on $(0,1)$ but has value $0$ if $x=0$ or $1$. More to the point, $6x(1-x)$ is nonzero _everywhere_ except at $0$ and $1$; it is $f_X(x) = 6x(1-x)\mathbf 1_{[0,1]}(x)$ that is guaranteed to be $0$ for $x \notin [0,1]$. – Dilip Sarwate Nov 05 '15 at 16:09