[R] Post-hoc tests in MASS using glm.nb

bryony bryony at hawkconservancy.org
Mon May 16 19:46:07 CEST 2011


I am struggling to generate p values for comparisons of levels (post-hoc
tests) in a glm with a negative binomial distribution

I am trying to compare cell counts on different days as grown on different
media (e.g. types of cryogel) so I have 2 explanatory variables (Day and
Cryogel), which are both factors, and an over-dispersed count variable
(number of cells) as the response. I know that both variables are
significant, and that there is a significant interaction between them.
However, I seem unable to generate multiple comparisons between the days and
cryogels. 

So my model is 

Model1<-glm.nb(Cells~Cryogel+Day+Day:Cryogel)

The output gives me comparisons between levels of the factors relative to a
reference level (Day 0 and Cryogel 1) as follows:

Coefficients:
               Estimate Std. Error z value Pr(>|z|)    
(Intercept)      1.2040     0.2743   4.389 1.14e-05 ***
Day14            3.3226     0.3440   9.658  < 2e-16 ***
Day28            3.3546     0.3440   9.752  < 2e-16 ***
Day7             3.3638     0.3440   9.779  < 2e-16 ***
Cryogel2         0.7097     0.3655   1.942  0.05215 .  
Cryogel3         0.7259     0.3651   1.988  0.04677 *  
Cryogel4         1.4191     0.3539   4.010 6.07e-05 ***
Day14:Cryogel2  -0.7910     0.4689  -1.687  0.09162 .  
Day28:Cryogel2  -0.5272     0.4685  -1.125  0.26053    
Day7:Cryogel2   -1.1794     0.4694  -2.512  0.01199 *  
Day14:Cryogel3  -1.0833     0.4691  -2.309  0.02092 *  
Day28:Cryogel3   0.1735     0.4733   0.367  0.71395    
Day7:Cryogel3   -1.0907     0.4690  -2.326  0.02003 *  
Day14:Cryogel4  -1.2834     0.4655  -2.757  0.00583 ** 
Day28:Cryogel4  -0.6300     0.4591  -1.372  0.16997    
Day7:Cryogel4   -1.3436     0.4596  -2.923  0.00347 ** 


HOWEVER I want ALL the comparisons e.g. Cryogel 2 versus 4, 3 versus 2 etc
on each of the days. I realise that such multiple comparsions need to be
approached with care to avoid Type 1 error, however it is easy to do this in
other programmes (e.g. SPSS, Genstat) and I'm frustrated that it appears to
be difficult in R. I have tried the glht (multcomp) function but it gives me
the same results. I assume that there is some way of entering the data
differently so as to tell R to use a different reference level each time and
re-run the analysis for each level, but don't know what this is.
Please help!

Many thanks for your input

Bryony

--
View this message in context: http://r.789695.n4.nabble.com/Post-hoc-tests-in-MASS-using-glm-nb-tp3526934p3526934.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list