Re: [R] Logistic Regression using glm

From: Sung, Iyue <Iyue.Sung_at_lm.mmc.com>
Date: Wed 12 Oct 2005 - 03:06:21 EST


You're fitting two different models.

The latter is saying: logit(p)=x+e, where e is a normal error, so that logit(p) is normal.
"lm" fits a Linear Model, which uses normal error.

The former says that p is Bernoulli; and p~Bernoulli does not imply logit(p) is normal.
A Generalized Linear Model has different options for specifying the random component.

Agresti's "Categorical Data Analysis" lays out the details very well.

> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Daniel Pick
> Sent: Tuesday, October 11, 2005 12:22 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] Logistic Regression using glm
>
> Hello everyone,
> I am currently teaching an intermediate stats.
> course at UCSD Extension using R. We are using Venables and
> Ripley as the primary text for the course, with Freund &
> Wilson's Statistical Methods as a secondary reference.
> I recently gave a homework assignment on logistic
> regression, and I had a question about glm. Let n be the
> number of trials, p be the estimated sample proportion, and w
> be the standard binomial weights n*p*(1-p). If you perform
> output <- glm(p ~ x, family = binomial, weights = n) you get
> a different result than if you perform the logit
> transformation manually on p and perform output <-
> lm(logit(p) ~ x, weights = w), where logit(p) is either
> obtained from R with
> qlogis(p) or from a manual computation of ln(p/1-p).
>
> The difference seems to me to be too large to be roundoff
> error. The only thing I can guess is that the application of
> the weights in glm is different than in a manual computation.
> Can anyone explain the difference in results?
>
>
> Daniel Pick
> Principal
> Daniel Pick Scientific Software Consulting San Diego, CA
> E-Mail: mth_man@yahoo.com
>
> ______________________________________________
> 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
> --------------------------------------------------------------
> --------------
> This e-mail and any attachments may be confidential or\ > ...{{dropped}}



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 Received on Wed Oct 12 03:10:47 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 18:40:52 EST