In: Statistics and Probability
Suppose that you have programmed your computer to do the following:
(i) Draw 50 X values from a uniform distribution between 10 and 20. (i.e. uniform on [10,20])
(ii) Count the number of X values greater than 18 and call this number G
(iii) Divide G by 50 and call this number H
(iv) Repeat steps i to iii to obtain 10,000 H values
(v) Calculate the average H value and the variance of H Values
Answer the following questions:
1. What number should the average H value be, approximately?
2. What does the variance of H values estimate, intuitively?
3. How would average and variance of H values change if the procedure were repeated 100,000 times, instead of 10,000?
4. How would average and variance of H values change if 100 X values were drawn in step i, instead of 50?
Required R software code is given as follows, But please notice that your result may change as the random sample generated using R changes each time.
R-code
#(i).To generate 50 X values fron U[10,20]
X=runif(50,10,20)
X
#(ii). To Count the number of X values greater than 18
G=X[which(X>18)]
G
length(G) # Values are greater than 18
#(iii) We Divide G by 50
H=G/50
H
#(iv) WERepeat steps i to iii to obtain 10,000 H values
H=c()
for(i in 1:10000)
{
X[i]=runif(50,10,20)
G[i]=X[which(X>18)]
H[i]=G/50
}
H
length(H)
#(v) To Calculate the average H value and the variance of H
Values
Average_H=mean(H)
Average_H
Variance_H=var(H)
Variance_H
Answers from my random sample
1. The average H value be 0.3 approximately
2. The variance of H values estimate the variation in H values
which is zero intuitively
3. There will be no change in average and variance of H values
change if the procedure were repeated 100,000 times, instead of
10,000
4. The average of H values and variance will still remain
inchanged