I have a nested model with the following effects
- fixed: treatments
- random: experiment_date
I used lme() to model the data
mod1 <- lme(N_cells ~treatments-1, random=~1|experiment_date, method='ML')
Then I want to compare all the other treatments to the control (included in
the "treatments" in mod1). After a fair amount of searching around, I
decided to use glht() from the multcomp package (any other suggestions?).
lvl.treatments=table(treatments)
K = contrMat(lvl.treatments,type='Dunnett',base=1)
mc<-glht(mod1, linfct=mcp(treatments=K),alternative='greater')
But I got the following error:
Error in contr.treatment(n = 0L) : not enough degrees of freedom to define contrasts
I tried to extract the df parameter using modelparm(), but the function
couldn't be applied to lme
Error in UseMethod("modelparm") : no applicable method for 'modelparm' applied to an object of class "lme"
The degree of freedom of the fixed effect was 194. I tried to specify the
number in glht(), but got the same error as "not enough degrees of freedom to
define contrasts".
Does anyone know what's happening and how I could possibly solve the problem? Thank you so much.