Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
> cau=rcauchy(10^2) > mcau=median(cau) > rcau=diff(quantile(cau,c(.25,.75)))/sqrt(10^2) > f=function(x){ + z=dcauchy(outer(x,cau,FUN="-")) + apply(z,1,prod)} > fcst=integrate(f,lower=-20,upper=20)$val > ft=function(x){f(x)/fcst} > g=function(x){dt((x-mcau)/rcau,df=49)/rcau} > curve(ft,from=-1,to=1,xlab="",ylab="",lwd=2) > curve(g,add=T,lty=2,col="steelblue",lwd=2)
and the corrected Figure 5.5 is therefore as follows. Note that the fit by the t distribution is not as perfect as before. A normal approximation would do better.
This mistake is most embarrassing and I cannot fathom how I came with this unoperating program! (The more embarrassing as Cauchy‘s house is about 1k away from mine…) I am thus quite grateful to Ashley for her detailed study of this example.
Filed under: Books, R, Statistics Tagged: Cauchy distribution, integrate, Introducing Monte Carlo Methods with R, Monte Carlo Statistical Methods, simulation, typos
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.