Empirical Verification of the Weak Law of Large Numbers. Use simulation to verif
ID: 3204390 • Letter: E
Question
Empirical Verification of the Weak Law of Large Numbers. Use simulation to verify the WLLN, which states that if X_1, X_2, ..., X_n are iid with mean mu, then for any fixed positive number epsilon > 0 lim_n rightarrow infinity P (|X_(n) - mu| > epsilon) = 0 Let X_i ~ N(3, 1) be iid random Normal variables, and estimate theta_n = P(|X_(n)- mu|>.01) for n = 10, 100.1000.10000. Use m = 1000 realizations of X_(n) at each value of n to obtain a Monte Carlo estimate of the probability theta_n.Explanation / Answer
We have to generate 1000 values of X(n) for n=10, 100, 1000, 10000, where X~N(mean=3,sd=1).
n=P[absolute value of (X(n) - 3) > 0.01)
= No. of absolute values of (X(n) - 3) > 0.01 in 1000 values / 1000
Use rnorm(n,3,1) to generate n random values of normal distribution with mean 3 & sd 1.
Use mean function to find out mean X(n) of n generated values.
Use abs function to find out absolute difference between X(n) and population mean =3.
Count the values for which absolute difference between X(n) and 3 is greater than 0.01 by using combination of for and if function.
Divide this count by 1000, we will get required probability n. We can make function for n.
The R code to obtain a Monte Carlo estimate of the probability n is
Output:
Note that, as n increases, n tends to zero.
theta=function(n){
c=0
for(i in 1:1000)
{
if(abs(mean(rnorm(n,3,1))-3)>0.01)
c=c+1
}
c/1000
}
theta(10)
theta(100)
theta(1000)
theta(10000)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.