This is the code for the LLN question iid random variable from
exponential distribution with mean beta. Beta is fixed 1 for
illustration.
# Testing LLN
plot.ybar <- function(n, m = 1e5, beta = 1) {
Ybars <- rep(0,m)
for(i in 1:m) {
Y.sample <- rexp(n,1/beta)
Ybars[i] <- mean(Y.sample)
}
p <- hist(Ybars, xlim=c(0,4), freq=F,main = paste("Distribution
of Ybar when n=",n, sep=""))
}
par(mfrow = c(2,2))
for (n in c(2, 10, 50, 200)) {
plot.ybar(n)
}
Using similar code...