[R-sig-ME] LME and TukeyHSD

Sibylle Stöckli sibylle.stoeckli at gmx.ch
Thu Nov 18 20:44:18 CET 2010


Dear R users

I used lme to fit a linear mixed model inlcuding weights=varPower()  
and subset. Additionally I wanted to use glht to calculate Tukey- 
Kramer multiple comparisions.

I think that the error in glht() is probably caused by the subset and  
varPower function within the lme model? I would very much appreciate    
an input.

Thanks
Sibylle

LME MODEL
 > modelF<-lme(asin(sqrt(PropMortality))~Diversity+Management+Species 
+Height+Year+Diversity*Year, data=Kaltenborn, random=~1|Plot/SubPlot,  
na.action=na.omit, weights=varPower(form=~Diversity), subset=Kaltenborn 
$ADDspecies!=1, method="REML")

 > anova(modelF, type="marginal")
                numDF denDF  F-value p-value
(Intercept)        1   162  7.12789  0.0084
Diversity          1    14 12.89284  0.0030
Management         2    30  5.52544  0.0091
Species            3   162 41.81003  <.0001
Height             1   162  2.59134  0.1094
Year               1   162  7.07660  0.0086
Diversity:Year     1   162 12.88095  0.0004

TukeyHSD
 > library(multcomp)
Loading required package: mvtnorm
Warning messages:
1: package 'multcomp' was built under R version 2.7.2
2: package 'mvtnorm' was built under R version 2.7.2
 > summary(glht(modelF,linfct=mcp(Species="Tukey")))

error
Error in glht.matrix(model = list(modelStruct = list(reStruct =  
list(SubPlot = -0.305856275920955,  :
   ‘ncol(linfct)’ is not equal to ‘length(coef(model))’
 > 



More information about the R-sig-mixed-models mailing list