[R] Logistic Regression using glm
Thomas Lumley
tlumley at u.washington.edu
Tue Oct 11 19:13:13 CEST 2005
One of these is modelling the mean of the logit of p, the other is
modelling the logit of the mean of p. They aren't the same.
-thomas
On Tue, 11 Oct 2005, Daniel Pick wrote:
> 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 at yahoo.com
>
> ______________________________________________
> R-help at 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
>
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
More information about the R-help
mailing list