kaskr/RTMB

implement an RTMB version of "dlnorm"?

wStockhausen opened this issue · 2 comments

First, let me just say RTMB is very cool!

It would be helpful (from a completeness standpoint) to implement an RTMB version of the "dlnorm" function. I realize you can get the equivalent functionality using "dnorm", but it would be nice to have a "dlnorm" implementation so you could write something like
y %~% dlnorm(mnLogY,sdLogY) using the distributional syntax (or logL = -dlnorm(y,mnLogY,sdLogY,log=TRUE); using regular syntax).

Currently (ver. 1.4), I get the error message:
"Error in dlnorm(y, mnLogY, sdLogY, log = TRUE) :
Non-numeric argument to mathematical function"

when I try to run something like:
require(RTMB);
f<-function(p){
getAll(p);
logL = -dlnorm(y,mnLogY,sdLogY,log=TRUE);
return(logL);
}
y = 1:10;
p = list(mnLogY=0,sdLogY=1);
obj = MakeADFun(f,p);

Now added