On Fri, 18 Dec 2009, Achim Zeileis wrote:

On Fri, 18 Dec 2009, chrischizinski wrote:

Just in case anyone ever has similar issues, it appears that 'glht' does not work without an intercept.

That is not precise enough to be useful. I've had a look again and appears to be the case that mcp() (or rather the internal function mcp2matrix) does not work for models where there are multiple factors but no intercept.

As the posting guide asks us to do, I have (1) provided a _reproducible_ example below, and (2) included the maintainer of the package in the posting. Torsten, it would be great if you could have a look.

Achim and Chris,

thanks for spotting this problem. The bug is now fixed in multcomp 1.1-3 available from R-forge.

Torsten


Best,
Z

## package
library("multcomp")

## various models with and without intercept
m1a <- lm(breaks ~ tension, data = warpbreaks)
m1b <- lm(breaks ~ 0 + tension, data = warpbreaks)
m2a <- lm(breaks ~ wool + tension, data = warpbreaks)
m2b <- lm(breaks ~ 0 + wool + tension, data = warpbreaks)

## these two are equivalent: one factor with/without intercept
summary(glht(m1a, linfct = mcp(tension = "Tukey")))
summary(glht(m1b, linfct = mcp(tension = "Tukey")))

## these two should be equivalent: two factors with/without intercept
## but the latter fails
summary(glht(m2a, linfct = mcp(tension = "Tukey")))
summary(glht(m2b, linfct = mcp(tension = "Tukey")))



______________________________________________
R-help@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.

Reply via email to