[R] lme weights glht

Sibylle Stöckli sibylle.stoeckli at gmx.ch
Wed Nov 17 19:34:11 CET 2010


Dear R-user

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

error:

 > glht(modelF, linfct=mcp(Species="Tukey"))
Error in glht.matrix(model = list(modelStruct = list(reStruct =  
list(SubPlot = -0.305856275920955,  :
   ‘ncol(linfct)’ is not equal to ‘length(coef(model))’
 > glht(modelF, linfct=mcp(Diversity="Tukey"))
Error in mcp2matrix(model, linfct = linfct) :
   Variable(s) ‘Diversity’ of class ‘integer’ is/are not contained as  
a factor in ‘model’.


Does anyone know, if glht does not function using weights/interactions  
in lme?

Thanks
Sibylle


  LME MODEL

 > Kaltenborn<-read.table("Kaltenborn_YEARS.txt", na.strings="*",  
header=TRUE)
 > library(nlme)
 > 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
 >



More information about the R-help mailing list