Skip to content

glm binomial loglog (NOT cloglog) link

4 messages · William Simpson, Ken Knoblauch, Jorge Ivan Velez

#
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
#
William Simpson <william.a.simpson <at> gmail.com> writes:
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
#
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