lylek@utk.edu
2002-Aug-22 12:45 UTC
Symbolic differentiation ("D","deriv", etc.) (PR#1928)
Full_Name: Lyle W. Konigsberg Version: 1.5.1 OS: Windows Submission from: (NULL) (160.36.64.99) I apparently found an error in how "deriv" puts a derivative to the screen (though the internal representation is correct). Here's what I was doing for a class example:> lnlk<-expression(15*log(p)+11*log(1-p)) > p<-15/26 > D(D(lnlk,"p"),"p")-15 * (1/p^2) + 11 * (1/(1 - p)^2)> eval(D(D(lnlk,"p"),"p"))[1] -106.5212> -15 * (1/p^2) + 11 * (1/(1 - p)^2)[1] 16.38788>From S+ I have the following:> lnlk<-expression(15*log(p)+11*log(1-p)) > p<-15/26 > D(D(lnlk,"p"),"p")- (15 * 1/p^2 + 11 * 1/(1 - p)^2)> - (15 * 1/p^2 + 11 * 1/(1 - p)^2)[1] -106.5212 R seems to be dropping the outer parentheses. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Thomas Lumley
2002-Aug-22 15:39 UTC
Symbolic differentiation ("D","deriv", etc.) (PR#1928)
On Thu, 22 Aug 2002 lylek@utk.edu wrote:> Full_Name: Lyle W. Konigsberg > Version: 1.5.1 > OS: Windows > Submission from: (NULL) (160.36.64.99) > > > I apparently found an error in how "deriv" puts a derivative to the screen > (though the internal representation is correct). Here's what I was doing for a > class example:Yes, it's the same as bugs 1119, 1797 and 1637 and probably some others. The deparse doesn't always put parentheses in correctly. -thomas -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Peter Dalgaard BSA
2002-Aug-22 15:45 UTC
Symbolic differentiation ("D","deriv", etc.) (PR#1928)
lylek@utk.edu writes:> > lnlk<-expression(15*log(p)+11*log(1-p)) > > p<-15/26 > > D(D(lnlk,"p"),"p") > - (15 * 1/p^2 + 11 * 1/(1 - p)^2) > > - (15 * 1/p^2 + 11 * 1/(1 - p)^2) > [1] -106.5212 > > R seems to be dropping the outer parentheses.Yes. Duncan Murdoch has been working on that recently. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
dmurdoch@pair.com
2002-Aug-27 12:20 UTC
Symbolic differentiation ("D","deriv", etc.) (PR#1928)
On Thu, 22 Aug 2002 14:45:47 +0200 (MET DST), you wrote:>I apparently found an error in how "deriv" puts a derivative to the screen >(though the internal representation is correct). Here's what I was doing for a >class example: > >> lnlk<-expression(15*log(p)+11*log(1-p)) >> p<-15/26 >> D(D(lnlk,"p"),"p") >-15 * (1/p^2) + 11 * (1/(1 - p)^2)This is now fixed in r-devel (to become 1.6.0):> D(D(lnlk,"p"),"p")-(15 * (1/p^2) + 11 * (1/(1 - p)^2)) Duncan Murdoch -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._