Skip to content

Interaction contrasts or posthoc test for glm (MASS) with ANOVA design

2 messages · Maya Pfaff, David Winsemius

#
On Nov 2, 2009, at 8:40 AM, Maya Pfaff wrote:

            
I'm a bit puzzled by this request, since it appears that you already  
have the test result you seek in the form of the line beginning  
Site1:Taxon1. (It might be a different story if you had more species.)  
In the default glm setup, the contrasts are of type "treatment". Your  
Site1:Taxon1 coefficients would then be the mean difference (and se)  
from the estimates based on Intercept+Taxon+Site( on the scale being  
regressed on). You will notice that the z value does not change when  
you use treatment contrasts instead of those you specified.

The only thing further to do would be to construct a reduced model  
without the interaction, take the difference in deviances of the  
model, and compare to chi-sq(significance level, df=1) and that would  
give you the ML test rather than the score test which results from the  
by coefficient tests.

When I do that I get
s1: 2 x log-likelihood:  -1155.4010
s2: 2 x log-likelihood:  -1181.8600

so
 > 1-pchisq(26.459,df=1)
[1] 2.691913e-07


(Which is immaterially different than the Pr(>|z|) that you get from  
the default output.

Of course that was the way we did it in school 20 years ago and it  
would be much faster to do:

 > anova(s1,s2)
Likelihood ratio tests of Negative Binomial Models

Response: counts
          Model     theta Resid. df    2 x log-lik.   Test    df LR  
stat.      Pr(Chi)
1 Site + Taxon 0.5263897       151       -1181.860
2 Site * Taxon 0.6126726       150       -1155.401 1 vs 2     1  
26.45960 2.691083e-07