Hi, I am running a logistic regression on a simple dataset (attached) using glm:
> dat<-read.table("dat.txt",sep='\t',header=T)
If I use summary() on a logistic model:
> summary(glm(y~x1*x2,dat,family='binomial'))
Coefficients:            Estimate Std. Error z value Pr(>|z|)(Intercept)    
19.57    5377.01   0.004    0.997x1            -18.59    5377.01  -0.003    
0.997x2B           -19.57    5377.01  -0.004    0.997x1:x2B         38.15    
7604.24   0.005    0.996
As you can see, the interaction term is very insignificant (p = 0.996)!
But if I use a anova() to compare a full vs reduced model to evaluate the 
interaction term:
> anova(glm(y~x1+x2,dat,family='binomial'), 
> glm(y~x1*x2,dat,family='binomial'))Analysis of Deviance Table
Model 1: y ~ x1 + x2Model 2: y ~ x1 * x2  Resid. Df Resid. Dev Df Deviance1     
   22     27.067            2        21     21.209  1   5.8579
This follows a chi-square distribution with 1 df, so the corresponding p value 
is:
> 1-pchisq(5.8679,1)[1] 0.01541944
So I get very different p value on the interaction term, can someone share 
what's going wrong here?
Thanks!
Yi

"y"     "x1"    "x2"
"R"     1       "B"
"NR"    1       "A"
"R"     0       "B"
"R"     1       "B"
"R"     1       "A"
"R"     1       "A"
"R"     0       "A"
"R"     1       "A"
"R"     0       "B"
"R"     0       "B"
"NR"    0       "B"
"NR"    0       "B"
"R"     1       "A"
"R"     1       "A"
"NR"    1       "A"
"R"     0       "A"
"R"     0       "A"
"NR"    0       "B"
"R"     0       "A"
"R"     1       "A"
"NR"    1       "A"
"R"     1       "B"
"R"     1       "A"
"R"     1       "B"
"R"     1       "A"
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to