[R-sig-ME] LME and TukeyHSD

"Sibylle Stöckli" sibylle.stoeckli at gmx.ch
Fri Nov 19 09:52:15 CET 2010


Dear Christoph

Thanks a lot! I still have some trouble with the is.na function

#
mydata<-subset(Kaltenborn,ADDspecies!=1)
mydata$sinmortality<-asin(sqrt(Kaltenborn$PropMortality))
mydata<-mydata[!is.na(mydata$sinmortality),]
error: is.na() applied to non-(list or vector)of type "NULL".

I tried to use as.list
#
mydata<-mydata[!is.na(as.list(mydata$sinmortality)),]

but this function produced some error within the lme model (varialbe lenght of sinmortality).

Do you have some idea, how to change the !is.na function for non-list data?

Thanks Sibylle



Dear Sibylle,

The reason for the error message may be that you transform your response
variable inside the model formula. This frequently causes errors when
working with components of lme models. In addition, you should try "ML"
instead of "REML" (when working with the fixed effects).

You may want to try:

##

mydata<-subset(Kaltenborn,ADDspecies!=1)
mydata$sinmortality<-asin(sqrt(Kaltenborn$PropMortality))
mydata<-mydata[!is.na(mydata$sinmortality),]

modelF<-lme(sinmortality~Diversity+Management+Species
+Height+Year+Diversity*Year, data=mydata, random=~1|Plot/SubPlot,
weights=varPower(form=~Diversity), method="ML")

summary(glht(modelF,linfct=mcp(Species="Tukey")))

##

Be reminded that it may not be sensible to test for Species main effects
when interactions are present; have you tested for interactions between
Species and other terms in the model?

Best wishes,
Christoph





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))’

_______________________________________________
R-sig-mixed-models at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models




-- 
GMX DSL Doppel-Flat ab 19,99 €/mtl.! Jetzt auch mit 
gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl




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