.lsmc omitted) may be used as the method argument in contrast, or as the contr argument or left-hand side of a spec formula in lsmeans.pairwise.lsmc(levs, ...)
revpairwise.lsmc(levs, ...)
tukey.lsmc(levs, reverse = FALSE)
poly.lsmc(levs, max.degree = min(6, k - 1))
trt.vs.ctrl.lsmc(levs, ref = 1)
trt.vs.ctrl1.lsmc(levs, ...)
trt.vs.ctrlk.lsmc(levs, ...)
dunnett.lsmc(levs, ref = 1)
consec.lsmc(levs, reverse = FALSE, ...)
mean_chg.lsmc(levs, reverse = FALSE, ...)
eff.lsmc(levs, ...)
del.eff.lsmc(levs, ...)poly.lsmcTRUE) or reverse-pairwise (if FALSE) comparisons.trt.vs.ctrl.lsmcdata.frame, each column containing contrast coefficients for levs.
The "desc" attribute is used to label the results in lsmeans,
and the "adjust" attribute gives the default adjustment method for multiplicity.glht in the pairwise.lsmc, revpairwise.lsmc, and tukey.lsmc generate contrasts for all pairwise comparisons among least-squares means at the levels in levs. The distinction is in which direction they are subtracted. For factor levels A, B, C, D, pairwise.lsmc generates the comparisons A-B, A-C, A-D, B-C, B-D, and C-D, whereas revpairwise.lsmc generates B-A, C-A, C-B, D-A, D-B, and D-C. tukey.lsmc invokes pairwise.lsmc or revpairwise.lsmc depending on reverse. The default multiplicity adjustment method is "tukey", which is approximate when the standard errors differ.
poly.lsmc generates orthogonal polynomial contrasts, assuming equally-spaced factor levels. These are derived from the poly function, but an ad hoc algorithm is used to scale them to integer coefficients that are (usually) the same as in published tables of orthogonal polynomial contrasts. The default multiplicity adjustment method is "none".
trt.vs.ctrl.lsmc and its relatives generate contrasts for comparing one level (or the average over specified levels) with each of the other levels. The argument ref should be the index(es) (not the labels) of the reference level(s). trt.vs.ctrl1.lsmc is the same as trt.vs.ctrl with a reference value of 1, and trt.vs.ctrlk.lsmc is the same as trt.vs.ctrl with a reference value of length(levs). dunnett.lsmc is the same as trt.vs.ctrl.
The default multiplicity adjustment method is "dunnettx", a close approximation to the Dunnett adjustment.
consec.lsmc and mean_chg.lsmc are useful for contrasting treatments that occur in sequence. For a factor with levels A, B, C, D, E, consec.lsmc generates the comparisons B-A, C-B, and D-C, while mean_chg.lsmc generates the contrasts (B+C+D)/3 - A, (C+D)/2 - (A+B)/2, and D - (A+B+C)/3. With reverse = TRUE, these differences go in the opposite direction.
eff.lsmc and del.eff.lsmc generate contrasts that compare each level with the average over all levels (in eff.lsmc) or over all other levels (in del.eff.lsmc). These differ only in how they are scaled. For a set of $k$ lsmeans, del.eff.lsmc gives weight $1$ to one lsmean and weight $-1/(k-1)$ to the others, while eff.lsmc gives weights $(k-1)/k$ and $-1/k$ respectively, as in subtracting the overall lsmean from each lsmean.
The default multiplicity adjustment method is "fdr". This is a Bonferroni-based method and is slightly conservative; see p.adjustlsmeans, glht### View orthogonal polynomials for 4 levels
poly.lsmc(1:4)
### Setting up a custom contrast function
helmert.lsmc <- function(levs, ...) {
M <- as.data.frame(contr.helmert(levs))
names(M) <- paste(levs[-1],"vs earlier")
attr(M, "desc") <- "Helmert contrasts"
M
}
warp.lm <- lm(breaks ~ wool*tension, data = warpbreaks)
lsmeans(warp.lm, helmert ~ tension | wool)Run the code above in your browser using DataLab