Re: [R] D(dnorm...)?

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Thu 26 Jan 2006 - 15:14:07 EST

Hello, Bill:

          I'm not qualified to make this suggestion since I'm incapable of turning it into reality, but what about creating a link between R and one of the Mathematica clones like Yacas? I can immagine that it could be substantially more difficult than linking R to other software like Excel, but ... .

          Spencer Graves

Bill.Venables@csiro.au wrote:
> Yes Bert, this time you are missing something (unusually) ...
>
> As Brian Ripley pointed out 'dnorm' is in the derivative table, *but*
> only as a function of one variable. So if you want to find the
> derivative of
>
> dnorm(x, mean, sigma)
>
> you have to write it as 1/sigma * dnorm((x - mu)/sigma). Here is a
> little example:
>
>

>>D(Quote(pnorm((x-mu)/sigma)), "x")

>
> dnorm((x - mu)/sigma) * (1/sigma)
>
>
>>D(D(Quote(pnorm((x-mu)/sigma)), "x"), "mu")

>
> (x - mu)/sigma * (dnorm((x - mu)/sigma) * (1/sigma)) * (1/sigma)
>
> ---
>
> Like Brian, I recall the suggestion that we make D(...) extensible. I
> still think it is a good idea and worth considering. Under one scheme
> you would specify an object such as
>
> Fnorm <- structure(quote(pnorm(x, mu, sigma)),
> deriv =
> list(x = Quote(dnorm(x, mu, sigma)/sigms),
> mu = Quote(-dnorm(x, mu, sigma)/sigma),
> sigma = Quote(-(x - mu)*dnorm(x, mu, sigma)/sigma^2),
> class = "dfunction")
>
> ane write a generic "differentiate" function with a "dfunction" method
> and "D" as the default.
>
> I don't think it's quite that easy, but the plan is clear enough.
>
> Bill.
>
>
>
>
>
> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Berton Gunter
> Sent: Thursday, 26 January 2006 8:58 AM
> To: 'Spencer Graves'; r-help@stat.math.ethz.ch
> Subject: Re: [R] D(dnorm...)?
>
>
> dnorm() is an internal function, so I don't see how D (or deriv) can do
> anything with it symbolically. Am I missing something?
>
> -- Bert
>
>
>
>
>>-----Original Message-----
>>From: r-help-bounces@stat.math.ethz.ch 
>>[mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Spencer Graves
>>Sent: Wednesday, January 25, 2006 2:43 PM
>>To: r-help@stat.math.ethz.ch
>>Subject: [R] D(dnorm...)?
>>
>>	  Can someone help me understand the following:
>>
>> > D(expression(dnorm(x, mean)), "mean")
>>[1] 0
>> > sessionInfo()
>>
>>R version 2.2.1, 2005-12-20, i386-pc-mingw32
>>
>>attached base packages:
>>[1] "methods"   "stats"     "graphics"  "grDevices" "utils"   
>>  "datasets"
>>[7] "base"
>>
>>	  By my computations, this should be something like 
>>((mean-x)/sd^2)*dnorm(...).
>>
>>	  Thanks for your help.
>>	  Spencer Graves
>>
>>______________________________________________
>>R-help@stat.math.ethz.ch mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide! 
>>http://www.R-project.org/posting-guide.html
>>

>
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html


R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jan 26 15:20:36 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:11 EST