Typo in Chapter 5

September 9, 2010

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

Gilles Guillot from Technical University of Denmark taught a course based on our R book and he pointed out to me several typos in Chapter 5 of “Introducing Monte Carlo Methods with R”:

  • p.137 second equation from bottom

    h(theta+beta zeta) - h(theta+beta zeta)

    should be

    h(theta+beta zeta) - h(theta-beta zeta)

    [right, another victim of cut-and-paste]

  • p. 138  Example 5.7 denominator in the gradient should be 2*beta [yes, the error actually occurs twice. And once again in the R code]
  • p. 138 : First paragraph Not a typo but a lack of details: are the conditions on alpha and beta necessary and sufficient? [indeed, they are sufficient]
  • demo(Chapter.5) triggers an error message [true, the shortcut max=TRUE instead of maximise=TRUE in optimise does not work with R version 2.11.1]

I checked the last item with the new version of R and got the following confirmation that optimise does not accept (any longer) the abbreviation of its arguments…


Type     to start :

> # Section 5.1, Numerical approximation
> ref=rcauchy(5001)

> f=function(y){-sum(log(1+(x-y)^2))}

> mi=NULL

> for (i in 1:400){
+   x=ref[1:i]
+   aut=optimise(f,interval=c(-10,10),max=T)
+   mi=c(mi,aut$max)
+   }
Error in f(arg, …) : unused argument(s) (max = TRUE)

> optimise(f,interval=c(-10,10),maximum=T)
[1] -2.571893

[1] -6.661338e-15

Filed under: Books, R, Statistics Tagged: birthday, Gilles Guillot, Introducing Monte Carlo Methods with R, optimise, R 2.11.1, R syntax, typo

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: Data science, Big Data, R jobs, 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.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)