[R-SIG-Mac] nls bug on Intel Mac (or is it me?)

Karl W Broman kbroman at jhsph.edu
Fri Jun 23 03:02:12 CEST 2006


I'm finding some odd behavior in nls.summary() on my MacBookPro.
Consider the following code:

thedata <- data.frame(x=c( 4,  6,  8, 10, 12,
                           14, 16, 18, 20, 22),
                       y=c(21.0, 21.7, 21.7, 22.0, 23.1,
                           22.8, 23.2, 23.1, 23.7, 24.3))

summary(nls(y ~ a + b * (1 - exp(d*x)),
             start = list(a=20, b=60, d=-0.003),
             data = thedata))

In the R GUI on the Mac, I get the following results:

   Estimate Std. Error t value Pr(>|t|)
a 20.31317    0.56571  35.907 3.37e-09
b 11.20556   18.93357   0.592    0.573
d -0.01851    0.04064  -0.455    0.663

If I run R from the command line, the SEs for a and b give relatively
random results; if I run the code twice in a row fast, I get the same
results (though they differ from the above).  If I wait a bit and run
it again, I get different results.  Here are two examples:

   Estimate Std. Error t value Pr(>|t|)
a 20.31317   10.37548   1.958   0.0911
b 11.20556    7.82498   1.432   0.1952
d -0.01851    0.04064  -0.455   0.6625

   Estimate Std. Error t value  Pr(>|t|)
a 20.31317    4.99515   4.067   0.00477
b 11.20556    1.33990   8.363 0.0000686
d -0.01851    0.04064  -0.455   0.66254

Note that with the same version of R in Linux, I get the (apparently
correct) result that the R GUI gives.

Does anyone have any idea what might be happening?

My version of R is the following (and I'm running MacOS ver 10.4.6):
                _
platform       i386-apple-darwin8.6.1
arch           i386
os             darwin8.6.1
system         i386, darwin8.6.1
status
major          2
minor          3.1
year           2006
month          06
day            01
svn rev        38247
language       R
version.string Version 2.3.1 (2006-06-01)

karl
----------
Karl W. Broman                  phone   410-614-9408
Department of Biostatistics     fax     410-955-0958
Johns Hopkins University        email   kbroman at jhsph.edu
http://www.biostat.jhsph.edu/~kbroman
http://www.gnu.org/philosophy/no-word-attachments.html



More information about the R-SIG-Mac mailing list