[R] GLM contrasting question

Ben Bolker bolker at ufl.edu
Tue Sep 1 21:17:17 CEST 2009

sodiumfish wrote:
> I have run a glm with a final formula of : (dependent variable = parasite
> load, main effects are sex, month, length and weight, with sex:month and
> length:weight first order interactions).
> I am using the summary(mod) command to give me the contrasts, which I
> believe use the contr.treatment command. I do not have a treatment group
> as such as I am comparing data from a wild system so I use the relevel
> command to reorder my factors in order to check the difference between
> each level and every other. I then use the coefficients and their related
> p-values to assess whether each level of my factors is significantly
> different from the next. This is fine for most things but  what I really
> want to do is to assess whether there is a significant difference of
> between males and females in any particular month. However, because of my
> interaction term the male and female for any particular month are always
> the missing coefficients and so I can't contrast them with one another.
> Is there a way (preferably a relatively simple way) for me to do this. You
> will probably realise from my description above that I am a biologist not
> a statistician, so if anyone can help me in plain English that would be an
> enormous help.

 It would be a little easier if you gave us a reproducible example.
It sounds like the easiest thing to do would be to partition your data set
by month and run separate models in each month.  If you were running
lm() rather than glm() you could use lmList from the nlme package, but
instead you should look at:


  for a solution.
View this message in context: http://www.nabble.com/GLM-contrasting-question-tp25226439p25244287.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list