I have a simple model without interaction and it stated significant effect for all the explanatory variables (continuous variable rok and categorical variables obdobi (levels hn and nehn) and kraj:
Call:
glm(formula = cbind(ml, ad) ~ rok + obdobi + kraj, family = "quasibinomial")
Deviance Residuals:
Min 1Q Median 3Q Max
-3.8007 -1.1716 -0.5117 1.0864 4.2184
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -107.60761 53.96993 -1.994 0.04674 *
rok 0.05381 0.02686 2.003 0.04576 *
obdobinehn -0.26962 0.11646 -2.315 0.02104 *
krajJHC 0.68869 0.31009 2.221 0.02683 *
krajJHM -0.26607 0.32166 -0.827 0.40855
krajLBK -1.11305 0.61942 -1.797 0.07298 .
krajMSK -0.61390 0.41828 -1.468 0.14285
krajOLK -0.49704 0.36981 -1.344 0.17958
krajPAK -1.18444 0.39401 -3.006 0.00279 **
krajPLK -1.28668 0.49672 -2.590 0.00988 **
krajSTC 0.01872 0.31222 0.060 0.95220
krajULKV -0.41950 0.69220 -0.606 0.54478
krajVYS -1.17290 0.44614 -2.629 0.00884 **
krajZLK -0.38170 0.40969 -0.932 0.35198
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for quasibinomial family taken to be 1.645035)
Null deviance: 1136.22 on 489 degrees of freedom
Residual deviance: 938.02 on 476 degrees of freedom
AIC: NA
Number of Fisher Scoring iterations: 4
Then I added interaction obdobi:kraj:
Call:
glm(formula = cbind(ml, ad) ~ rok + obdobi + kraj + obdobi:kraj,
family = "quasibinomial")
Deviance Residuals:
Min 1Q Median 3Q Max
-3.4635 -1.1706 -0.4597 1.0275 4.6829
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -101.49501 54.53576 -1.861 0.06336 .
rok 0.05102 0.02715 1.879 0.06086 .
obdobinehn -1.11653 0.62058 -1.799 0.07264 .
krajJHC -0.16805 0.51957 -0.323 0.74651
krajJHM -0.77451 0.53738 -1.441 0.15018
krajLBK -3.29567 1.42164 -2.318 0.02087 *
krajMSK -0.73640 0.67267 -1.095 0.27420
krajOLK -0.41582 0.68758 -0.605 0.54564
krajPAK -1.50156 0.63871 -2.351 0.01914 *
krajPLK -1.48611 0.75745 -1.962 0.05036 .
krajSTC -0.34170 0.52059 -0.656 0.51191
krajULKV -1.72550 1.02726 -1.680 0.09369 .
krajVYS -1.93603 0.65862 -2.940 0.00345 **
krajZLK -0.71065 0.65791 -1.080 0.28063
obdobinehn:krajJHC 1.44638 0.65507 2.208 0.02773 *
obdobinehn:krajJHM 0.82070 0.67910 1.209 0.22746
obdobinehn:krajLBK 3.31340 1.61026 2.058 0.04018 *
obdobinehn:krajMSK 0.12470 0.87281 0.143 0.88645
obdobinehn:krajOLK 0.04528 0.82529 0.055 0.95627
obdobinehn:krajPAK 0.48978 0.81921 0.598 0.55022
obdobinehn:krajPLK 0.23075 1.02316 0.226 0.82167
obdobinehn:krajSTC 0.50339 0.65976 0.763 0.44585
obdobinehn:krajULKV 2.49157 1.43679 1.734 0.08356 .
obdobinehn:krajVYS 1.48201 0.92082 1.609 0.10820
obdobinehn:krajZLK 0.49357 0.85087 0.580 0.56214
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for quasibinomial family taken to be 1.613648)
Null deviance: 1136.22 on 489 degrees of freedom
Residual deviance: 899.28 on 465 degrees of freedom
AIC: NA
Number of Fisher Scoring iterations: 4
Strange thing happened – the main effects rok and obdobi are no longer significant! How can this happen? How to interpret this fact? If the interaction obdobi:kraj
has significant effect, then the obdobi
also has significant effect, right?
Note that the second model differs significantly (tested by anova(..., test = "Chi")
).
Thanks in advance!
EDIT: added anova tables of the models (but since this is glm
and not simple lm
, mean sum of squares and p-values are missing and I don't know how to interpret it…)
> anova(model1)
Analysis of Deviance Table
Model: quasibinomial, link: logit
Response: cbind(ml, ad)
Terms added sequentially (first to last)
Df Deviance Resid. Df Resid. Dev
NULL 489 1136.22
rok 1 3.06 488 1133.16
obdobi 1 11.20 487 1121.96
kraj 11 183.94 476 938.02
> anova(model2)
Analysis of Deviance Table
Model: quasibinomial, link: logit
Response: cbind(ml, ad)
Terms added sequentially (first to last)
Df Deviance Resid. Df Resid. Dev
NULL 489 1136.22
rok 1 3.06 488 1133.16
obdobi 1 11.20 487 1121.96
kraj 11 183.94 476 938.02
obdobi:kraj 11 38.74 465 899.28
Best Answer
The main effects went from "significant" to "not", but the evidence really didn't change all that much. For example, p=0.047 to p=0.063 for
rok
isn't, to me, a remarkable change. And a lack of evidence for a coefficient being non-zero isn't the same as saying it is 0.In considering the coefficient for
obdobinehn
when the interaction is included, you need to pay careful attention to the factor contrasts that are being used, as the meaning of the coefficient changes and depends on those contrasts.Note also that if a covariate is involved in an important interaction, then it does have an effect on the outcome, even if it shows no main effect.
I agree with John's comment that it's useful, with factor covariates, to look at an ANOVA table.