# [Rd] extending the derivs table/fools rushing in

Ben Bolker bolker at zoology.ufl.edu
Thu Aug 14 20:59:11 CEST 2008

```Prof Brian Ripley wrote:
> The derivative of plogis is surely dlogis.  (And yes, there is a good
> reason why we have such a function: take a look at its C code.)

Doh.
>
> That means we would need an entry for dlogis too, I guess. I am not
> convinced that there is a real need for these (and where does this
> stop?) What would be much more useful is to make this user-extensible
> (as Bill Venables pointed out a decade ago).  [pd]norm were added in
> 2002 to support MASS, the ability to do all of MASS in R being a goal at
> the time.

I agree it would be great to make this user-extensible, but it's
probably a bit beyond me ... I found a web-reference of Venables saying

> There is a detailed example towards the end of Ch. 9 of V&R on how
> to extend D() and make.call(), which are the work horses for
> deriv(), to handle new functions. The new functions handled there
> are dnorm() and pnorm(), but I() would be even easier, of course.

http://www.math.yorku.ca/Who/Faculty/Monette/pub/s-old/0690.html

... but this is from 1997 therefore presumably MASS3? or MASS2? --
I can't find my copy of MASS3 at the moment, and don't own MASS2 ...

The reason behind this is that I was trying to write a simple
analytic derivative calculator for formulae of the form (e.g.)

y ~ dbinom(prob=plogis(a+b*x),size=N)

Obviously in this case I could just tell people to write the
formula out as

y ~ dbinom(prob=1/(1+exp(-(a+b*x))),size=N)

...

Ben Bolker

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20080814/93aefca2/attachment.bin>
```