artlm.con {ARTool}R Documentation

Per-Term Linear Model on Data Aligned-and-Ranked with ART-C

Description

Given an art model, build a linear model from data aligned or aligned-and-ranked with ART-C alignment procedure by the specified term in the model.

Usage

artlm.con(m, term, response = "art", factor.contrasts = "contr.sum", ...)

Arguments

m

An object of class art.

term

A character vector indicating the effect term in the transformed data in m to use as the aligned or art response.

response

Which response to use: the aligned (with ART-C) response ("aligned") or the aligned and ranked (with ART-C) response ("art").

factor.contrasts

The name of the contrast-generating function to be applied by default to fixed effect factors. Sets the the first element of options("contrasts") for the duration of this function. The default is to use "contr.sum", i.e. sum-to-zero contrasts, which is appropriate for Type III ANOVAs (the default ANOVA type for anova.art).

...

Additional arguments passed to lm or lmer.

Details

This function is used internally by art.con to construct linear models for contrasts using the ART-C procedure (Elkin et al. 2021). It is typically not necessary to use this function directly to conduct contrasts using the ART-C procedure, you can use art.con instead, which will ensure that the correct model and contrast test is run. However, should you wish to use the ART-C procedure with a different contrast test than provided by art.con, you may with to use this function.

Internally, the ART-C procedure concatenates the variables specified in term, and then removes the originals. When specifying the effect terms on which to conduct contrasts, use the concatenation of the effects specified in term instead of the original variables. This is demonstrated in the example below.

Value

An object of class lm if formula(m) does not contain grouping or error terms, an object of class merMod (i.e. a model fit by lmer) if it does contain grouping terms, or an object of class aovlist (i.e. a model fit by aov) if it contains error terms.

Author(s)

Lisa A. Elkin

References

Elkin, L. A., Kay, M, Higgins, J. J., and Wobbrock, J. O. (2021). An Aligned Rank Transform Procedure for Multifactor Contrast Tests. arXiv eprint: 2102.11824.

See Also

See also art.con, which makes use of this function.

Examples


data(Higgins1990Table5, package = "ARTool")

## create an art model
m <- art(DryMatter ~ Moisture*Fertilizer + (1|Tray), data=Higgins1990Table5)

## use emmeans to conduct pairwise contrasts on "Moisture"
library(emmeans)
contrast(emmeans(artlm.con(m, "Moisture"), pairwise ~ Moisture))

## use emmeans to conduct pairwise contrasts on "Moisture:Fertilizer"
## N.B. internally, artlm.con concatenates the factors Moisture and Fertilizer
## to create MoistureFertilizer. If you try to use any of Moisture, Fertilizer,
## Moisture:Fertilizer, or Moisture*Fertilizer in the RHS of the formula
## passed to emmeans, you will get an error because the factors Moisture and Fertilizer
## do not exist in the model returned by artlm.con.
contrast(emmeans(artlm.con(m, "Moisture:Fertilizer"), pairwise ~ MoistureFertilizer))

## Note: art.con uses emmeans internally, and the above examples are equivalent to
## the following calls to art.con, which is the recommended approach as it will
## ensure the model selected and the contrasts extracted from emmeans match.
art.con(m, "Moisture")
art.con(m, "Moisture:Fertilizer")




[Package ARTool version 0.11.0 Index]