[R] Problems with glht function for lme object

David Winsemius dwinsemius at comcast.net
Fri Jan 7 17:38:13 CET 2011


On Jan 7, 2011, at 8:28 AM, anord wrote:

>
> Dear all,
>
> I'm trying to make multiple comparisons for an lme-object. The data  
> is for
> an experiment on parental work load in birds, in which adults at  
> different
> sites were induced to work at one of three levels ('treat'; H, M,  
> L). The
> response is 'feedings', which is a quantitative measure of nest  
> provisioning
> per parent per chick per hour. Site is included as a random effect  
> (one
> male/female pair per site).
>
> My final model takes the following form:
> feedings ~ treat + year + data^2, random = ~1|site,data=feed.df

I am guessing that problems could easily arise as a result of your  
variable name containing "^". That is an invalid name in an un-back- 
quoted state. You have clearly not given us a copy of a console  
session since your variable is date^2  below and data^2 above.

-- 
David.
>
> For this model, I would like to do multiple comparisons on 'treat',  
> using
> the multcomp package:
> summary(glht(m4.feed,linfct=mcp(treat="Tukey")))
>
> However, this does not work, and I get the below error message.
>
> Error in if (is.null(pkg) | pkg == "nlme") terms(formula(x)) else  
> slot(x,  :
>  argument is of length zero
> Error in factor_contrasts(model) :
>  no ‘model.matrix’ method for ‘model’ found!
>
> I suspect this might have quite a straightforward solution, but I'm  
> stuck at
> this point.
> Any help would be most appreciated. Sample data below.
>
> Kind regards,
> Andreas Nord
> Sweden
>
> ==============
> feedings     sex site  treat year  date^2
> 1.8877888   M  838     H 2009      81
> 1.9102787   M  247     H 2009      81
> 1.4647229   M  674     H 2010      121
> 1.4160590   M 7009     M 2009      144
> 1.3106749   M  863     M 2010      196
> 1.2718121   M   61     M 2009      225
> 1.2799263   M  729     L 2009      256
> 1.5829564   M  629     L 2009      256
> 1.4847251   M  299     L 2010      324
> 1.2463151   M  569     L 2010      324
> 2.1694169   F  838     H 2009      81
> 1.5966899   F  247     H 2009      81
> 2.4136983   F  674     H 2010      121
> 1.7784873   F 7009     M 2009      144
> 1.6681317   F  863     M 2010      196
> 2.3691275   F   61     M 2009      225
> 2.0672192   F  729     L 2009      256
> 1.6389902   F  629     L 2009      256
> 0.9307536   F  299     L 2010      324
> 1.6786767   F  569     L 2010      324
> ==============
>
>
> -- 
> View this message in context: http://r.789695.n4.nabble.com/Problems-with-glht-function-for-lme-object-tp3179128p3179128.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list