Typos in Chapters 6-7

January 14, 2010
By

(This article was first published on Xi'an's Og » R, and kindly contributed to R-bloggers)

Over the weekend and during the R exams, I managed to complete the solution set for Chapters 6 and 7 of “Introducing Monte Carlo Methods with R”. Chapter 6 only exhibited a few typos, despite me covering most exercises in Chapter 6, hence the merging of both chapters.

– in Exercise 6.13, both alpha and beta must use a double exponential proposal in the Metropolis-Hastings algorithm of question b,

in Exercise 6.15, the mathcal{L}(0,omega) distribution should be a mathcal{N}(0,omega) normal distribution,

– in Example 7.3, part of the code is wrong: it should be

> sigma2=theta=rep(0,Nsim)                  #init arrays
> sigma2[1]=1/rgamma(1,shape=a,rate=b)      #init chains
> B=sigma2[1]/(sigma2[1]+n*tau2)
> theta[1]=rnorm(1,m=B*theta0+(1-B)*xbar,sd=sqrt(tau2*B))

instead of

> sigma=theta=rep(0,Nsim)                  #init arrays
> sigma{1}=1/rgamma(1,shape=a,rate=b)      #init chains
> B=sigma2{1}/(sigma2{1}+n*tau2)
> theta{1}=rnorm(1,m=B*theta0+(1-B)*xbar,sd=sqrt(tau2*B))

(I frankly don’t understand where those curly brackets came from!)

– in Example 7.6, I forgot to include the truncation probability Phi(a-theta)^{n-m} in the likelihood (!) and the notations are not completely coherent with Example 5.13 and 5.14 in that the x’s became y’s…

– in Exercise 7.21, rtnorm is missing sigma as one of its arguments.

– Exercise 7.23 has nothing wrong per se but it is rather a formal (mathematical) exercise

– in Exercise 7.25 the x+a in question a should be (x+a) to avoid any confusion.


Posted in Books, R, Statistics, University life Tagged: Introducing Monte Carlo Methods with R, MCMC, Monte Carlo methods, simulation, typos

To leave a comment for the author, please follow the link and comment on his blog: Xi'an's Og » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: , , , , , , , ,

Comments are closed.