Skip to content

Adding the complementary log-link to binomial() and make.link()

3 messages · Roland Deutsch, Ken Knoblauch, Ben Bolker

#
Roland Deutsch <roland.deutsch <at> tuwien.ac.at> writes:
response models, which
models. While I do use
and cloglog, I often
Complementary Log link
Regression for
Statistician , Vol. 46, No. 2,
distribution.
do so by adding the
in make.link(...):
binomial(). However, I 

I wouldn't mess with make.link.  Why don't you just
define your own custom link, for example following the
example under help(family)?  This is what I did in
the psyphy package and I just checked and
they all still work under the current version of R.

  
    
#
Ken Knoblauch <ken.knoblauch <at> inserm.fr> writes:
This seems to work:

linkinfo <- list(link="clog",
                 linkfun=function(mu) qexp(mu),
                 linkinv=function(eta) pmax(.Machine$double.eps,pexp(eta)),
                 mu.eta=function(eta) pmax(dexp(eta), .Machine$double.eps),
                 valideta=function(eta) all(eta > 0))
binomClog <- binomial()
for (i in names(linkinfo))
    binomClog[[i]] <- linkinfo[[i]]

set.seed(101)
d <- data.frame(x=runif(1000))
d$y <- rbinom(1000,prob=binomClog$linkinv(1+2*d$x),size=1)
library(lattice)
xyplot(y~x,data=d,type=c("p","smooth"))
g1 <- glm(y~x,data=d,family=binomClog)
library(MASS)
confint(g1)