[R] glht: Problem with symbolic contrast for factors with number-levels

From: Ulrich Halekoh <Ulrich.Halekoh_at_agrsci.dk>
Date: Fri, 04 Mar 2011 20:03:42 +0100

Using a factor with 'number' levels the straightforward symbolic formulation of a contrast in 'glht' of the 'multcomp' package fails.

How can this problem be resolved without having to redefine the factor levels?

#A is a factor with 'number' levels
#B similar factor with 'letter' levels


                      B=factor(c('e','e','f','f')) )
#does not work

glht(motA,linfct=mcp(A=c("2 - 1 = 0 ")))

#the error message is
# Error in coefs(ex[[3]]) :
# cannot interpret expression '1' as linear function


glht(motB,linfct=mcp(B=c("f - e = 0")))


Ulrich Halekoh
Aarhus University
e-mail: Ulrich.Halekoh_at_agrsci.dk

I use R.2.12.2, package version of multcomp : 1.2-5

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. Received on Fri 04 Mar 2011 - 19:05:35 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 04 Mar 2011 - 19:50:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive