Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
I was grading my Master projects this morning and came upon this graph:
Maybe this is to be expected. Here is a similar comparison for finite and infinite variance cases:
compar=function(df,N){ y=matrix(rt(df=df,n=N*100),nrow=100) t=sqrt(abs(y))*dcauchy(y)/dt(y,df=df) w=dcauchy(y)/dt(y,df=df) tone=t(apply(t,1,cumsum)/(1:N)) wone=t(apply(t,1,cumsum)/apply(w,1,cumsum)) dim(tone) ttwo=apply(tone,2,max) wtwo=apply(wone,2,max) three=apply(tone,2,min) whree=apply(wone,2,min) plot(apply(tone,2,mean),col="white",ylim=c(min(three),max(ttwo))) if (diff(range(tone[,100]))<diff(range(wone[,100]))){ polygon(c(1:N,N:1),c(whree,rev(wtwo)),col="chocolate") polygon(c(1:N,N:1),c(three,rev(ttwo)),col="wheat")} else{ polygon(c(1:N,N:1),c(three,rev(ttwo)),col="chocolate") polygon(c(1:N,N:1),c(whree,rev(wtwo)),col="wheat")} }
Filed under: Books, R, Statistics, University life Tagged: importance sampling, infinite variance estimators, Monte Carlo Statistical Methods, R, self-normalised importance sampling
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.