I am trying to use a function that models nesting success of birds using a logistic exposure link function.
When I run this function using the example code above in R 3.0.0 or 3.0.1, I get the error:
Error in .Call("logit_mu_eta", eta, PACKAGE = "stats") :
"logit_mu_eta" not available for .Call() for package "stats"
However, it works fine in R 2.15.3.
I'd like for this to work in more recent versions of R, since I use those for further analysis of the outputs. If anybody has any suggestions, workarounds or corrections, I'd happily try them.
This is not technically a bug, since the function used an internal function whose location has now changed. I have a working example of this posted at https://rpubs.com/bbolker/logregexp ... the key is changing logit_mu_eta
to stats:::C_logit_mu_eta
as below. Of course, this will still be fragile to future changes in the internals ...
logexp <- function(exposure = 1)
{
linkfun <- function(mu) qlogis(mu^(1/exposure))
## FIXME: is there some trick we can play here to allow
## evaluation in the context of the 'data' argument?
linkinv <- function(eta) plogis(eta)^exposure
mu.eta <- function(eta) exposure * plogis(eta)^(exposure-1) *
.Call(stats:::C_logit_mu_eta, eta, PACKAGE = "stats")
valideta <- function(eta) TRUE
link <- paste("logexp(", deparse(substitute(exposure)), ")",
sep="")
structure(list(linkfun = linkfun, linkinv = linkinv,
mu.eta = mu.eta, valideta = valideta,
name = link),
class = "link-glm")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With