Typo in Chapter 5

[This article was first published on Xi'an's Og » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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…

demo(Chapter.5)
————————

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)
$maximum
[1] -2.571893

$objective
[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 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.

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)