I wish to write a new link function for a GLM. R's glm routine does
not supply the "loglog" link. I modified the make.link function adding
the code:

     }, loglog = {
         linkfun <- function(mu) -log(-log(mu))
         linkinv <- function(eta) exp(-exp(-eta))
         mu.eta <- function(eta) exp(-exp(-eta)-eta)
         valideta <- function(eta) all(eta != 0)
     }, stop(sQuote(link), " link not recognised"))
     structure(list(linkfun = linkfun, linkinv = linkinv, mu.eta = mu.eta,
         valideta = valideta, name = link), class = "link-glm")
}


and then call glm with argument

glm(y~x1+x2+x3,family=binomial(link=make.link("loglog")),data=X)

and that seems to work.

______________________________________________
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