-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
I am not sure if this is bug or a feature, in any case, it is a GOTCHA and I think it should be documented, and this way one can easily refer to it.
Since I never remember how to calculate inverse logit function, I have created this alias in my R profile:
inv.logit <- plogis
Then, when I call this function from a function passed to MakeTape, it throws an error:
inv.logit <- plogis
library(RTMB)
ll_pa <- function (par)
{
p <- inv.logit(par)
log(p)
}
F <- MakeTape(ll_pa, numeric(1))
Error in inv.logit(par) : Non-numeric argument to mathematical function
I figured that it is because the alias inv.logit <- plogis was created before library(RTMB). If I move the command after library(RTMB), the error disappears.
Before loading library(RTMB), printing plogis looks like this:
> plogis
function (q, location = 0, scale = 1, lower.tail = TRUE, log.p = FALSE)
.Call(C_plogis, q, location, scale, lower.tail, log.p)
<bytecode: 0x00000187ec56c4f8>
<environment: namespace:stats>
After library(RTMB), the plogis looks like this:
> plogis
standardGeneric for "plogis" defined from package "stats"
function (q, location = 0, scale = 1, lower.tail = TRUE, log.p = FALSE)
standardGeneric("plogis")
<environment: 0x00000187f4f3dba0>
Methods may be defined for arguments: q, location, scale, lower.tail, log.p
Use showMethods(plogis) for currently available ones.
Using RTMB version 1.5 on R 4.4.1.
Metadata
Metadata
Assignees
Labels
No labels