From: Johan Stenberg <jstenberg_at_ice.mpg.de>

Date: Tue 29 Mar 2005 - 18:56:06 EST

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Mar 29 19:04:22 2005

Date: Tue 29 Mar 2005 - 18:56:06 EST

How do I make R show the R-squared (deviance explained by the model) in a logistic regression?

Below is how I write my syntax. Basically I want to investigate density-dependence in parasitism of larvae. Note that in the end I perform a F-test because the dispersion factor (residual deviance / residual df) is significantly higher than 1. But how do I make R show the "R-squared"?

Best wishes

Johan

> y<-cbind(para,unpara)

*> model<-glm(y~log(larvae),binomial)
**> summary(model)
*

Call:

glm(formula = y ~ log(larvae), family = binomial)

Deviance Residuals:

Min 1Q Median 3Q Max -2.0633 -1.6218 -0.1871 0.7907 2.7670

Coefficients:

Estimate Std. Error z value Pr(>|z|) (Intercept) 1.0025 0.7049 1.422 0.15499 log(larvae) -1.0640 0.3870 -2.749 0.00597 **

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 35.981 on 12 degrees of freedom
Residual deviance: 27.298 on 11 degrees of freedom
**AIC: 40.949
**
Number of Fisher Scoring iterations: 4

> anova(model,test="F")

Analysis of Deviance Table

Terms added sequentially (first to last)

Df Deviance Resid. Df Resid. Dev F Pr(>F) NULL 12 35.981 log(larvae) 1 8.683 11 27.298 8.6828 0.003212 ** ______________________________________________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 Tue Mar 29 19:04:22 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:30:56 EST
*