glm binomial loglog (NOT cloglog) link

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

glm binomial loglog (NOT cloglog) link

William Simpson-2
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

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: glm binomial loglog (NOT cloglog) link

Kenneth Knoblauch
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

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: glm binomial loglog (NOT cloglog) link

William Simpson-2
In reply to this post by William Simpson-2
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.

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: glm binomial loglog (NOT cloglog) link

Jorge I Velez
In reply to this post by William Simpson-2
Dear Bill,
Perhaps the "cloglog" function in the "VGAM" package might be useful for
you.

HTH,

Jorge


On Fri, Jan 23, 2009 at 11:32 AM, William Simpson <
[hidden email]> wrote:

> 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
>
> ______________________________________________
> [hidden email] 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: glm binomial loglog (NOT cloglog) link

trekvana
In reply to this post by William Simpson-2
can you please say specifically how to modify the make.link function
Reply | Threaded
Open this post in threaded view
|

Re: glm binomial loglog (NOT cloglog) link

William Simpson-2
In reply to this post by William Simpson-2
I was looking at different link functions for binomial glms recently for
the same reason as you (more zeros than ones). I did a bit of reading up
on the various link functions and IIRC, you can use the cloglog link on
your data, just turn your 0's into 1's and vice versa. This was stated
in the one or two references I looked at as to why only one of cloglog
and loglog links is often provided in software

______________________________________________
[hidden email] 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.