X = [0.01, 0.36, 0.97, 0.44, 0.86, 0.49, 0.02, 0.19, 0.54, 0.63, 0.69, 0.27, 0.21, 0.55, 0.54, 0.1 , 0.02, 0.49 , 0.42, 0.79], is a list of 20 random numbers generated from a pseudo-random number generator G.
a. What is a uniformity test?
b. Using Chi-square Goodness-of-fit test with 4 bins, test whether X belongs to U(0, 1) based on 5% significant level.
c. Can we conclude G generates truly random numbers following the distribution U(0, 1)?
a.
"\\chi^2" squared test for uniformity can be formulated by binning the ranks 0: M into J bins and testing that the bins all have roughly the expected number of draws in them.
If bj is the number of ranks that fall into bin j and ej is the number of ranks expected to fall into
bin j, the test statistic is
"\\chi^2=\\sum \\frac{(b_j-e_j)^2}{e_j}"
b.
"H_0:" X belongs to U(0, 1)
"H_a:" X does not belong to U(0, 1)
"X=[0.01, 0.02, 0.02, 0.1, 0.19, 0.21, 0.27, 0.36, 0.42, 0.44, 0.49, 0.49,"
"0.54, 0.54, 0.55, 0.63, 0.69, 0.79, 0.86, 0.97]"
4 bins:
"[0,0.25],[0.25,0.5],[0.5,0.75],[0.75,1]"
"\\chi^2=\\sum \\frac{(b_j-e_j)^2}{e_j}"
expected number of values in each interval is
"e_j=20\/4=5"
then:
"\\chi^2=\\frac{(6-5)^2+(6-5)^2+(5-5)^2+(3-5)^2}{5}=6\/5=1.2"
"df=4-1=3"
critical value:
"\\chi^2_{crit}=0.216"
c.
Since "\\chi^2>\\chi^2_{crit}" we accept the null hypothesis. X belongs to U(0, 1)
Comments
Leave a comment