I would like to do an R glm() with family = binomial(link="loglog") Right now, the cloglog link exists, which is nice when the data have a heavy tail to the left. I have the opposite case and the loglog link is what I need. Can someone suggest how to add the loglog link onto glm()? It would be lovely to have it there by default, and it certainly makes sense to have the two opposite cases cloglog and loglog. Thanks for any help. Bill
glm binomial loglog (NOT cloglog) link
4 messages · William Simpson, Ken Knoblauch, Jorge Ivan Velez
William Simpson <william.a.simpson <at> gmail.com> writes:
I would like to do an R glm() with family = binomial(link="loglog") Right now, the cloglog link exists, which is nice when the data have a heavy tail to the left. I have the opposite case and the loglog link is what I need. Can someone suggest how to add the loglog link onto glm()? It would be lovely to have it there by default, and it certainly makes sense to have the two opposite cases cloglog and loglog. Thanks for any help. Bill
Look at the example under ?family for how to write a user-specified link and the source of the make.link function can be useful to. Ken
Ken Knoblauch Inserm U846 Institut Cellule Souche et Cerveau D?partement Neurosciences Int?gratives 18 avenue du Doyen L?pine 69500 Bron France tel: +33 (0)4 72 91 34 77 fax: +33 (0)4 72 91 34 61 portable: +33 (0)6 84 10 64 10 http://www.sbri.fr
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.
4 days later
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090128/7fc6be6f/attachment-0001.pl>