[R] glht multiple comparisons for glm with 2 factors

Melanie Jane melaniejanewhite at hotmail.com
Thu Jun 14 13:20:26 CEST 2012


Hi All, 

I have used glm to model my data, I have two factors and a covariate as
described in the example code below (mod.1). 

I have been able to "force" glht to perform multiple comparisons by creating
a combined variable for the factors, accepting that there will be a loss of
statistical power as it seems to do what I want.  I then use the cld
function to generate the letters of significance from the glht which I can
then apply to my figures with ggplot2. 

However when it comes to describing my data I am becoming increasingly
suspicious that this hasn't worked as I want it too as the letters don't
always make sense in relation my original model. Is there any other way of
doing this on my original model (mod.1) rather than having to "cheat"
(mod.2)? 

mod.1 <- glm(response ~ 1 + treat + seas + covariate, data = dat) 

# combined variable for pairwise comparisons
treat.seas <- (as.numeric(dat$treat) * 10) + as.numeric(dat$seas)
dat$treat.seas <- factor(treat.seas)

mod.2 <- glm(response ~ 1 + treat.seas + covariate, data = dat)
mod.2_glht <- glht(mod.2, linfct = mcp(treat.seas = "Tukey"))
letters_mod.2 <- cld(mod.2_glht)

Thank you in advance 

Melanie 



--
View this message in context: http://r.789695.n4.nabble.com/glht-multiple-comparisons-for-glm-with-2-factors-tp4633365.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list