The goal of the assignment is to test the "quality" of the pseudo-random number generator in R for the purposes of rolli
Posted: Fri Apr 29, 2022 7:12 am
The goal of the assignment is to test the "quality" of the pseudo-random number generator in R for the purposes of rolling a virtual fair six-sided die. 1. (5 points) Let X1, X2,..., X., n = 106, be a sequence of independent uniformly distributed random variables on (0,1). Use function runif to generate Xi's. Use the generated X;'s to generate independent Yı, Y2, ..., Y, with the following PMF: Į1/6, y=1,2,...,6, PY (4) (1) 10, otherwise. Suppose the null hypothesis is "{Y1,..., Yn} are i.i.d. observations from distribution ()", while the alternative hypothesis is "{Y1,..., Yn} are not i.i.d. observations from distribution ()". Compute the x-statistic for the generated data: (nk - n/6) n/6 where nk is the number of k's in the sequence Y1,..., Yn. Compute the corresponding p-value, the probability that a x?-distributed random variable (with 5 degrees of freedom) is larger than the obtained x-statistic. Run the x goodness-of-fit test using chisq.test. 2. (5 points) Define the empirical CDF 7 for Yı, Y2,..., Yn: F(x) ΣΥ<s); and compute Vr max|F(x) – F(), where F is the CDF that corresponds to PMF (). 3. (5 points) Repeat the first part k = 250 times, denote the values of x-statistic by V1, V2, ..., VX- Generate k i.i.d. x2-distributed random variables (with 5 degrees of freedom); denote them by W1, W2, ..., W. Create a Q-Q plot that compares the quantiles of the empirical distributions of V's and W;'s.