[R] problem with deriv3?

Prof Brian D Ripley ripley at stats.ox.ac.uk
Mon Mar 11 08:49:36 CET 2002

On Sun, 10 Mar 2002, B. D. Mccullough wrote:

> Using S+ 6 for Linux and
> R 1.4.1
> Taking verbatim some lines from S-Plus that work
> perfectly, and running them on R, I get an
> unexpected error message:

This is uncredited (by you) work of Bill Venables in extending S's deriv
which we contributed to S-PLUS.  For several years this extension was only
in the MASS library, and may well still be for your S-PLUS (you didn't
mention the version).

> R : Copyright 2002, The R Development Core Team
> Version 1.4.1  (2002-01-30)
> > library(MASS)
> > data <- read.table("/usr/local/data/mcmanus.dat",header=T)
> > mcmanus.frm <-
> deriv3(~-log(pnorm((2*D1-1)*(b0+b1*TT+b2*Y+b3*LF+b4*NW+b5*D2))),c("b0","b1","b
> 2","b3","b4","b5"),function(b0,b1,b2,b3,b4,b5,D1,TT,Y,LF,NW,D2) NULL)
> Error in deriv3.formula(~-log(pnorm((2 * D1 - 1) * (b0 + b1 * TT + b2 *  :
> 	Function   ^A is not in the derivatives table
> >
> I did a search on the R website and at the e-mail archive,
> and found nothing of help.

>From the NEWS file of R-devel

    o   deriv/deriv3() can now handle expressions involving pnorm and
        dnorm (with a single argument), as in S-PLUS.

> How can I decipher "^A" and make the appropriate corrections
> to the derivative table in R?

Just download and build R-devel.  Your example works there.

> PS: I believe that in R I should delete the "log" and instead use
> the "log.p=T" option; presumably it is numerically more efficient.
> If this is incorrect, please let me know.

Not if you want to use deriv3: see the NEWS item.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list