Re: [R] logit link + alternatives
see at ?glm and ?family and use, e.g., `family=binomial(link=probit)'. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Monday, February 07, 2005 10:44 AM Subject: [R] logit link + alternatives 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 jeff.pr2 (at) added-insight (dot) net __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] logit link + alternatives
I am not sure that fully answers Jeff's question. If the available link functions (even with the quasi family) are not sufficient for your needs, then you need to make your own constructor for a family object - which provides the necessary information to the glm engine - and use this as the family argument in your call to glm. Specifically, you need to make a copy of the binomial() function and replace the call to make.link(). Martyn On Mon, 2005-02-07 at 11:27 +0100, Dimitris Rizopoulos wrote: see at ?glm and ?family and use, e.g., `family=binomial(link=probit)'. Best, Dimitris - Original Message - From: [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Monday, February 07, 2005 10:44 AM Subject: [R] logit link + alternatives 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 jeff.pr2 (at) added-insight (dot) net __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] logit link + alternatives
On 07-Feb-05 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 07-Feb-05 Time: 12:57:07 -- XFMail -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] logit link + alternatives
Just for the record -- NEWS for 2.1.0 includes: o binomial() has a new cauchit link (suggested by Roger Koenker). the MASS polr for ordered response is also now adapted for the Cauchit case. url:www.econ.uiuc.edu/~rogerRoger Koenker email [EMAIL PROTECTED] Department of Economics vox:217-333-4558University of Illinois fax:217-244-6678Champaign, IL 61820 On Feb 7, 2005, at 7:01 AM, (Ted Harding) wrote: On 07-Feb-05 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 07-Feb-05 Time: 12:57:07 -- XFMail -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] logit link + alternatives
roger koenker rkoenker at uiuc.edu writes: : : Just for the record -- NEWS for 2.1.0 includes: : : o binomial() has a new cauchit link (suggested by Roger Koenker). : : the MASS polr for ordered response is also now adapted for the Cauchit : case. Do any of the data sets that come with R, MASS, etc. provide an example where this model is appropriate? If not, is there another publicly available data set for it? Thanks. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html