[R] logit link + alternatives

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Mon Feb 7 14:01:15 CET 2005


On 07-Feb-05 jeff.pr2 at added-insight.net wrote:
> 
> Help needed with lm function:
> 
> Dear R's,
> Could anyone tell me how to replace the link function (probit logit,
> loglog etc.) in lm
> with an abitrary user-defined function? The task is to perform ML
> Estimation of betas
> for a dichotome target variable.
> 
> Maybe there is already a package for this (I did not find one).
> Any hints or a code excerpt would be welcome!
> Thank you -Jeff

I asked a similar question last year (2 April 2004) since I wanted
a "cauchy" link in a binary response model (the data suggested
heavy tails). I thought in the first place that I saw a fairly
straightforward way to do it, but Brian Ripley's informed response
put me off, once I had looked into the details of what would be
involved (his reply which includes my original mail follows):

# On Fri, 2 Apr 2004 Ted.Harding at nessie.mcc.ac.uk wrote:
# 
# > I am interested in extending the repertoire of link functions
# > in glm(Y~X, family=binomial(link=...)) to include a "tan" link:
# > 
# >    eta = (4/pi)*tan(mu)
# > 
# > i.e. this link bears the same relation to the Cauchy distribution
# > as the probit link bears to the Gaussian. I'm interested in sage
# > advice about this from people who know their way aroung glm.
# > 
# > From the surface, it looks as though it might just be a matter
# > of re-writing 'make.link' in the obvious sort of way so as to
# > incorporate "tan", but I fear traps ...
# 
# How are you going to do that?  If you edit make.link and have your
# own local copy, the namespace scoping will ensure that the system
# copy gets used, and the code in binomial() will ensure that even
# that does not get  called except for the pre-coded list of links.
# 
# > What am I missing?
# 
# You need a local, modified, copy of binomial, too, AFAICS.

As I say, the implied details put me off for a while, but in
this particular case Thomas W Yee came up with a ready-made
solution (23 April 2004):

# my VGAM package at www.stat.auckland.ac.nz/~yee
# now has the tan link for binomialff().
# It is tan(pi*(mu-0.5)).

(See his full mail in the R-help archives for April 2004
for several important details regarding this implementation).

So: it would seem to be quite possible to write yor own link
function, but it would take quite a bit of work and would
involves re-writing at least the codes for 'make.link'
and for 'binomial', and being careful about how you use them.

Hoping this helps,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 07-Feb-05                                       Time: 12:57:07
------------------------------ XFMail ------------------------------




More information about the R-help mailing list