[R] second try; writing user-defined GLM link function
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Apr 17 10:25:08 CEST 2006
I've not seen a response to either of these.
It is fairly simple. You need to copy 'binomial' to your own function,
and edit it to allow the name you choose for your link function. Then you
need to copy 'make.link', and edit it to add an entry under your chosen
name. I'd copy the probit one (the logit one is internal for speed). Note
that to avoid namespace issues, you do need to copy (and probably rename)
the functions you change.
On Sat, 15 Apr 2006, Jessi Brown wrote:
> I apologize for my earlier posting that, unbeknownst to me before,
> apparently was not in the correct format for this list. Hopefully this
> attempt will go through, and no-one will hold the newbie mistake
> against me.
> I could really use some help in writing a new glm link function in
> order to run an analysis of daily nest survival rates. I've struggled
> with this for weeks now, and can at least display the contents of the
> glm function, but I'm afraid I can't figure out even how to get
> started at modifiying the appropriate section (fairly new at R,
> complete beginner in writing functions in R!).
> Essentially, all I will be doing is running a logistic regression, but
> with a different link function. The link function is a modification of
> the logit link:
> g(theta) = natural log( (theta ^(1/t)) / (1- (theta ^(1/t)) ) ;
> where t is the length of the interval between nest checks.
> Could anyone help? I hope the answer is rather simple, since this just
> adds the exponent (1/t) to the logit link function; but I have yet to
> figure out how to do this.
> Thanks in advance for any help.
> cheers, Jessi Brown
> Program in Ecology, Evolution, and Conservation Biology
> University of Nevada-Reno
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help