In: Statistics and Probability
3. Consider the following pdf:
Q(x) = {3x^2 / 2 -1? x ?1
{0 otherwise
a. Set up an acceptance-rejection algorithm for this distribution. Use the majorizing function g(x) = 3/2.
b. Assuming a linear congruential generator with parameters a: 21, m: 100, c: 13, and x0: 7, generate two random variates from the distribution q(x).
c. Can you make any comments about the potential period of the LCG in part b?
Let random variable X has a pdf 
Let 
  has common support with X
a generic accept/reject algorithm to generate draws from a random variable X is given by
 and from U from uniform distribution 
 , else return to step 1We have been given the majorizing function g(x) = 3/2.. We want to find a pdf h(x) such that

Let c=3
let us get the pdf using

h(x) is a uniform distribution in the interval [-1,1]
That means we have 
Finally
The steps then to generate 1 random variable from Q(x) is
 and  
 , else return to step 1b) Generating random numbers using LCG

with a=21, m = 100 c=13 and 
we can get the following


and so on.
We convert this into a draw from uniform [0,1] by deviding
 by m=100, that 
 is a draw from uniform (0,1)
To generate a draw from uniform [a,b], we use 
 or
to generate from [-1,1] use 
The following table shows the output for 10 random numbers
| x | 
| 60 | 
| 73 | 
| 46 | 
| 79 | 
| 72 | 
| 25 | 
| 38 | 
| 11 | 
| 44 | 
| 37 | 
| 90 | 
Following are the simulatins
We do the following in excel

The output for 2 numbers is

0,80 and 0,52 are the first 2 numbers genaretd from f(x)
c) this period of LCG in part a is m=100 due to the following conditions