0
$\begingroup$

A random number generator generated random values from the Standard Uniform distribution Uniform(0,1). Call this random variable, $U$. Starting with a random value $u$ from $U$, show all the steps necessary to generate a continuous random variable with the density function $f(x) = 0.5(1+x)$, where $-1 \le x \le 1$.

I am doing this for a practice exam so an exact answer is not as important to me as the proper solution. I honestly have no clue how to go about this problem and have tried using similar pseudo code problems for Uniform(0,1) but still haven't been able to figure this one out in particular.

$\endgroup$
3
$\begingroup$

Suppose $X$ is a random variable with that distribution on $[-1,1]$ and $Y$ is uniformly distributed on $[0,1]$. Note that for $x \in [-1,1]$ $$\mathbb{P}(X < x) = \int_{-1}^x\frac{1+s}{2}ds = \frac{(x+1)^2}{4} = \mathbb{P}(Y < \frac{(x+1)^2}{4}) = \mathbb{P}(2 \sqrt{Y} - 1 < x).$$

So $2\sqrt{Y} - 1$ has exactly the given distribution. This procedure works in principle for other distributions. However, it works so well here because

  1. the probability on the left has an explicit formula and
  2. that formula has a nice inverse.

You will not always be so lucky. For example, to generate a normally distributed random variable from a uniform one requires another smart trick.

$\endgroup$
0
$\begingroup$

Hints: (1) Find an increasing function $g:[0,1]\to[0,1]$ such that the density of $g(U)$ is $x\mapsto2x$ on $[0,1]$. (2) Find an affine transformation $a$ such that $a(0)=-1$ and $a(1)=1$. (3) Check that $a(g(U))$ solves your problem.

$\endgroup$
  • $\begingroup$ Hint: You need to find a transformation function $F$ where $F^{-1}(x)$ $x \in [-1,1]$, or more simply with $u=(x+1)/2$ substitution $F^{-1}(u)$ for $u \in [0,1]$. Here F is the cdf for the desired pdf. $\endgroup$ – karakfa Dec 13 '12 at 21:26
  • $\begingroup$ @karakfa Whom is your comment aimed at? $\endgroup$ – Did Dec 14 '12 at 6:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.