# NOT RUN {
# }
# NOT RUN {
####################### Exercise 3 ##############################
# Let X1, X2, ..., Xn be independent random variables such that #
# P[Xn=sqrt(n)]=1/n and P[Xn=0]=1-1/n #
# Does Xn converges to 0 in 2-th mean? in probability? #
#################################################################
options(example.ask=FALSE)
pnotrgen<-function(n){rbinom(n,1,1/(1:n))*sqrt(1:n)}
check.convergence(nmax=1000,M=500,genXn=pnotrgen,mode="r",r=2)
legend(100,6,legend=expression(hat(e)["n,2"]),lty=1)
tt3.1 <<- check.convergence(nmax=1000,M=500,genXn=pnotrgen,mode="p")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab