require(lsmeans)
warp.lm <- lm(breaks ~ wool*tension, data = warpbreaks)
warp.lsm <- lsmeans(warp.lm, ~ tension | wool)
# Polynomial contrasts of tension, by wool
(warp.pl <- contrast(warp.lsm, "poly"))
# Same results with a different adjustment
summary(warp.pl, adjust = "fdr")
# Compare the two contrasts for each degree
contrast(warp.pl, "revpairwise", by = "contrast")
# User-provided contrasts, ignoring the previous by grouping
contrast(warp.lsm,
list(c1=c(1,0,0,-1,0,0), c2=c(1,1,1,-1,-1,-1)/3),
by = NULL)
Run the code above in your browser using DataLab