Hello All,
I am looking for an R library/function that allows the specification of a custom link function in a linear mixed model. I've been using glm() in library MASS to fit fixed-effect models with a custom link but my study design demands mixed models. Any suggestions on the best R library/function to achieve this would be greatly appreciated. I have tried, to no avail, to locate a library that fits my needs by searching CRAN and the web on the basis of which ones allow custom link functions. Some of the mixed-effect models I'm hoping to fit involve more than a single random factor. An example of how I've been doing this with glm() is shown below to illustrate what I'm hoping to scale up to a mixed model. Thanks very much for your time and thoughts.

-----------------

library(MASS)
logexp <- function(days = 1) ##Custom link function from Shaffer (2004) Auk 121:526-540.
{
   linkfun <- function(mu) qlogis(mu^(1/days))
   linkinv <- function(eta) plogis(eta)^days
   mu.eta <- function(eta) days * plogis(eta)^(days-1) *
     .Call("logit_mu_eta", eta, PACKAGE = "stats")
   valideta <- function(eta) TRUE
   link <- paste("logexp(", days, ")", sep="")
   structure(list(linkfun = linkfun, linkinv = linkinv,
                  mu.eta = mu.eta, valideta = valideta, name = link),
             class = "link-glm")
}

model0 <- glm(survive~1, family=binomial(logexp(days=expos))) ##Call to glm with custom link

---------------------

Best,
Dan Barton

--
Daniel C. Barton
PhD Candidate
USGS Montana Cooperative Wildlife Research Unit &
Program in Organismal Biology and Ecology
University of Montana
205 Natural Science
Missoula, MT 59812
daniel.bar...@umontana.edu
Missoula, MT 59812

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to