pimax(mcsm)
The function pimax from our package mcsm is used in to reproduce Figure 5.11 of our book Introducing Monte Carlo Methods with R. (The name comes from using the Pima Indian R benchmark as the reference dataset.) I got this email from Josué
I ran the ‘pimax’ example from the mcsm manual, and it gave me the following message:
> pimax(Nsim = 10^3)
Error in raaj[t, ] = apply(as.matrix(aas), 1, margap) :
number of items to replace is not a multiple of replacement length
> pimax()
Error in raaj[t, ] = apply(as.matrix(aas), 1, margap) :
number of items to replace is not a multiple of replacement length
but when running pimax(10^2) on my machine I did get the following picture and no error message. So I wonder if this is a matter of version of R or something else…
January 15, 2018 at 8:59 am
Thank you for this! I changed iter to iterlimit in the nlm() call in Chapter.5. Another change involves replacing max with maximum in optimize/optimize calls
May 13, 2010 at 11:51 am
The function margap() embedded in the pimax function ends with a for loop. But since R 2.10.0 for loops always return NULL, so you need to put an explicit call to return() at the end of this function.
See the NEWS file:
o for(), while(), and repeat() loops now always return NULL as
their (invisible) value. This change was needed to address a
reference counting bug without creating performance penalties
for some common use cases.
May 13, 2010 at 12:06 pm
Thank you, Martyn! This is the drawback of having built that package with an older version of R (2.6.2!)… I will then try to correct this obsolescence asap!!!