# \donttest{
data(Higgins1990Table5, package = "ARTool")
## perform aligned rank transform
m <- art(DryMatter ~ Moisture*Fertilizer + (1|Tray), data=Higgins1990Table5)
## see summary data to ensure aligned rank transform is appropriate for this data
summary(m)
## looks good (aligned effects sum to 0 and F values on aligned responses
## not of interest are all ~0)
## we can always look at the anova of aligned data if we want more detail
## to assess the appropriateness of ART. F values in this anova should all
## be approx 0.
anova(m, response="aligned")
## then we can run an anova on the ART responses (equivalent to anova(m, response="art"))
anova(m)
## if we want contrast tests, we can use art.con():
## Ex 1: pairwise contrasts on Moisture:
art.con(m, "Moisture")
## Ex 2: pairwise contrasts on Moisture:Fertilizer:
art.con(m, "Moisture:Fertilizer")
## Ex 3: difference-of-difference tests on the Moisture:Fertilizer interaction:
art.con(m, "Moisture:Fertilizer", interaction = TRUE)
## The above three examples with art.con() can be constructed manually as well.
## art.con() extracts the appropriate linear model and conducts contrasts
## using emmeans(). If we want to use a specific method for post-hoc tests
## other than emmeans(), artlm.con(m, term) returns the linear model for the
## specified term which we can then examine using our preferred method
## (emmeans, glht, etc). The equivalent calls for the above examples are:
library(emmeans)
## Ex 1: pairwise contrasts on Moisture:
contrast(emmeans(artlm.con(m, "Moisture"), ~ Moisture), method = "pairwise")
## Ex 2: pairwise contrasts on Moisture:Fertilizer:
## See artlm.con() documentation for more details on the syntax, specifically
## the formula passed to emmeans.
contrast(emmeans(artlm.con(m, "Moisture:Fertilizer"), ~ MoistureFertilizer), method = "pairwise")
## Ex 3: difference-of-difference tests on the Moisture:Fertilizer interaction:
## Note the use of artlm() instead of artlm.con()
contrast(
emmeans(artlm(m, "Moisture:Fertilizer"), ~ Moisture:Fertilizer),
method = "pairwise", interaction = TRUE
)
## For a more in-depth explanation and example of contrasts with art and
## differences between interaction types, see vignette("art-contrasts")
# }
Run the code above in your browser using DataLab