kaskr / RTMB

R bindings to TMB
Other
49 stars 6 forks source link

implement an RTMB version of "dlnorm"? #21

Closed wStockhausen closed 7 months ago

wStockhausen commented 9 months ago

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);

kaskr commented 7 months ago

Now added

wStockhausen commented 7 months ago

Fabulous! Thanks so much.

William T. Stockhausen

Research Fishery Biologist, Alaska Fisheries Science Center

NOAA Fisheries | U.S. Department of Commerce

Office: (206) 526-4241

www.fisheries.noaa.gov

On Wed, Apr 17, 2024 at 9:24 AM kaskr @.***> wrote:

Now added

— Reply to this email directly, view it on GitHub https://github.com/kaskr/RTMB/issues/21#issuecomment-2061707348, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMAD5FKUYULGVUAC63UCKTY52O4DAVCNFSM6AAAAABDYOXQLKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRRG4YDOMZUHA . You are receiving this because you authored the thread.Message ID: @.***>