**T**he two translators of our book in Japanese, Kazue & Motohiro Ishida, contacted me about some R code mistakes in the book. The translation is nearly done and they checked every piece of code in the book, an endeavour for which I am very grateful! Here are the two issues they have noticed (after incorporating the typos signaled in the overall up-to-date summary):

**F**irst, in Example 4.4, I omitted some checkings and forgot about a minus sign, meaning Figure 4.4 (right) is wrong. *(The more frustrating since this example covers perplexity!)* The zeros must be controlled via code lines like

> wachd[wachd<10^(-10)]=10^(-10)

instead of the meaningless

wachd[apply(wachd,2,cumsum)<10^(-10)]=10^(-10)

and the addition of

> plex[plex>0]=0
> plech[plech>0]=0

after the definition of those two variables. (Because entropies are necessarily positive.) The most glaring omission is however the minus in

> plob=apply(exp(-plex),1,quantile,c(.025,.975))
> ploch=apply(exp(-plech),1,quantile,c(.025,.975))

which modifies Figure 4.4 in the following

**T**he second case is Example 7.3 where I forgot to account for the log-transform of the data, which should read (p.204):

> x=c(91,504,557,609,693,727,764,803,857,929,970,1043,
+ 1089,1195,1384,1713)
> x=log(x)

and compounded my mistake by including log-transforms of the parameters that should not be there (pp.204-205)! So (for my simulations) the posterior means of θ and σ² are 6.62 and 0.661, respectively, leading to an estimate of σ of 0.802. There should be no log transform in Exercise 7.3 either.

**T**he same corrections apply to the French translation, most obviously…

Filed under: Books, R, Statistics, University life Tagged: Introducing Monte Carlo Methods with R, Japan, Monte Carlo Statistical Methods, perplexity, R

*Related*

To

**leave a comment** for the author, please follow the link and comment on their 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:** Books, Introducing Monte Carlo Methods with R, japan, Monte Carlo Statistical Methods, perplexity, R, statistics, University life