.lsmc
omitted) may be used in the
left-hand side of a spec
formula in lsmeans
.pairwise.lsmc(levs, ...)
revpairwise.lsmc(levs, ...)
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, ...)
eff.lsmc(levs, ...)
del.eff.lsmc(levs, ...)
poly.lsmc
trt.vs.ctrl.lsmc
data.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 multcomp
package.
pairwise.lsmc
and revpairwise.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, wereas revpairwise.lsmc
generates B-A, C-A, C-B, D-A, D-B, and D-C. 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 , ref=1)
, and trt.vs.ctrlk.lsmc
is the same as trt.vs.ctrl , ref=length(levs))
.
The default multiplicity adjustment method is "sidak"
, which is slightly conservative.
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.adjust
lsmeans
, 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
}
lsmeans(Oats.lme, helmert ~ Variety)
Run the code above in your browser using DataLab