[R] How to find the significant differences among interactions in logit model?

2005-06-24 Thread Wuming Gong
Hi, 

I have a question about interpret the results from logistic regression
model. I used a dataset from the book Categorical Data Analysis (2nd
Edition) by Alan Agresti.

 summary(crabs)
 color  spine   width  satell   weightpsat
 2:12   1: 37   Min.   :21.0   Min.   : 0.000   Min.   :1200   Mode :logical  
 3:95   2: 15   1st Qu.:24.9   1st Qu.: 0.000   1st Qu.:2000   FALSE:62   
 4:44   3:121   Median :26.1   Median : 2.000   Median :2350   TRUE :111  
 5:22   Mean   :26.3   Mean   : 2.919   Mean   :2437  
3rd Qu.:27.7   3rd Qu.: 5.000   3rd Qu.:2850  
Max.   :33.5   Max.   :15.000   Max.   :5200  

 crabs.glm - glm(psat ~ color*width, family=binomial(), data=crabs)
 summary(crabs.glm)

Call:
glm(formula = psat ~ color * width, family = binomial(), data = crabs)

Deviance Residuals: 
Min   1Q   Median   3Q  Max  
-2.0546  -0.9129   0.5285   0.8140   1.9657  

Coefficients:
  Estimate Std. Error z value Pr(|z|)
(Intercept)   -1.75261   11.46409  -0.1530.878
color3-8.28735   12.00363  -0.6900.490
color4   -19.76545   13.34251  -1.4810.139
color5-4.10122   13.27532  -0.3090.757
width  0.106000.42656   0.2480.804
color3:width   0.312870.44794   0.6980.485
color4:width   0.752370.50435   1.4920.136
color5:width   0.094430.50042   0.1890.850

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 225.76  on 172  degrees of freedom
Residual deviance: 183.08  on 165  degrees of freedom
AIC: 199.08

Number of Fisher Scoring iterations: 5

Note the predictors are mixture of continuous data and categorical
data. Here, I wonder whether there is *significant difference* among
the four interactions of color and width (say, to get a p-value). In a
two-way ANOVA, we may do a F-test. But is there an equivalent method
for logit model?

Thanks,

Wuming

__
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] How to find the significant differences among interactions in logit model?

2005-06-24 Thread Prof Brian Ripley
Use an analysis of deviance test for the term color:width.  Probably most
clearly by (untested)

crabs.glm2 - update(crabs.glm, . ~ . - color:width)
anova(crabs.glm2, crabs.glm, test=Chisq)

This is covered with several examples in MASS.

On Fri, 24 Jun 2005, Wuming Gong wrote:

 I have a question about interpret the results from logistic regression
 model.

Not really: this is about comparing two such models.

 I used a dataset from the book Categorical Data Analysis (2nd
 Edition) by Alan Agresti.

 summary(crabs)
 color  spine   width  satell   weightpsat
 2:12   1: 37   Min.   :21.0   Min.   : 0.000   Min.   :1200   Mode :logical
 3:95   2: 15   1st Qu.:24.9   1st Qu.: 0.000   1st Qu.:2000   FALSE:62
 4:44   3:121   Median :26.1   Median : 2.000   Median :2350   TRUE :111
 5:22   Mean   :26.3   Mean   : 2.919   Mean   :2437
3rd Qu.:27.7   3rd Qu.: 5.000   3rd Qu.:2850
Max.   :33.5   Max.   :15.000   Max.   :5200

 crabs.glm - glm(psat ~ color*width, family=binomial(), data=crabs)
 summary(crabs.glm)

 Call:
 glm(formula = psat ~ color * width, family = binomial(), data = crabs)

 Deviance Residuals:
Min   1Q   Median   3Q  Max
 -2.0546  -0.9129   0.5285   0.8140   1.9657

 Coefficients:
  Estimate Std. Error z value Pr(|z|)
 (Intercept)   -1.75261   11.46409  -0.1530.878
 color3-8.28735   12.00363  -0.6900.490
 color4   -19.76545   13.34251  -1.4810.139
 color5-4.10122   13.27532  -0.3090.757
 width  0.106000.42656   0.2480.804
 color3:width   0.312870.44794   0.6980.485
 color4:width   0.752370.50435   1.4920.136
 color5:width   0.094430.50042   0.1890.850

 (Dispersion parameter for binomial family taken to be 1)

Null deviance: 225.76  on 172  degrees of freedom
 Residual deviance: 183.08  on 165  degrees of freedom
 AIC: 199.08

 Number of Fisher Scoring iterations: 5

 Note the predictors are mixture of continuous data and categorical
 data. Here, I wonder whether there is *significant difference* among
 the four interactions of color and width (say, to get a p-value). In a
 two-way ANOVA, we may do a F-test. But is there an equivalent method
 for logit model?

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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