Environmental oddity --- reproducible example.
G'day Rolf, On Sun, 7 Nov 2021 19:33:40 +1300
Rolf Turner <r.turner at auckland.ac.nz> wrote:
library(Deriv)
d1 <- Deriv(dnorm,"sd")
source("d2.txt") # d2.txt is attached
d1(1,0,3,TRUE) # [1] -0.2962963
d2(1,0,3,TRUE) # [1] -0.8888889
Fascinating: R> pryr::call_tree(body(d1)) R> pryr::call_tree(body(d2)) clearly show that the two functions have a different idea to what expression the final "/sd" is applied too (as an earlier poster suggested), but I have no idea why. Deriv() seems to return the correct function, but when it is displayed, the deparser(?) somehow omits a crucial pair of braces. Cheers, Berwin