Weak Law of Large Numbers
1 Description
The weak law of large numbers is a result in probability theory also known as Bernoulli’s theorem. According to the law, the mean of the results obtained from a large number of trials is close to the population mean.
Let be a sequence of independent and identically distributed random variables, each having a mean
and variance
.
Define a new variable,
Then,
By the Chebyshev inequality,
In brief,
as , the sample mean
equals the population mean
.
2 Simulation in R
The following is the results of simulations(Bi(n,p)).
Moreover, parameter of the population mean is 0.4, sample number is 1,000.
3 Appendix
This is the sample script of R.
Let’s try the Simulation in R with different parameters.
#setting a parameters of Bi(n, p)
n <- 1000
p <- 0.4
#dataframe
df <- data.frame(bi = rbinom(n, 1, p) ,count = 0, mean = 0)
ifelse(df$bi[1] == 1, df[1, 2:3] <- 1, 0)
for (i in 2 : n){
df$count[i] <- ifelse(df$bi[i] == 1, df$count[i]<-df$count[i - 1]+1, df$count[i - 1])
df$mean[i] <- df$count[i] / i
}
#graph
plot(df$mean, type='l',
main = "Simulation of the Low of Large Numbers",
xlab="Numbers", ylab="Sample mean")
abline(h = p, col="red")







I think this is one of the first simulations that students should be exposed to. After they realize that different runs give different results, you can have a discussion of “How to lie with a Simulation” such as is presented at
http://blogs.sas.com/content/iml/2012/01/11/how-to-lie-with-a-simulation/
This subsequently motivate a discussion of convergence, such as “how many iterations are needed if I want to get to within 0.01 of the true value (with 95% probability).”
Dear Mr.Rick Wicklin
Thank you for your comment and deeper understanding.
I agree with you, I think basic theories and simulations include most important things.
H.Ishimaru.