# \donttest{
data(Higgins1990Table5, package = "ARTool")
library(dplyr)
## Perform aligned rank transform
m <- art(DryMatter ~ Moisture*Fertilizer + (1|Tray), data=Higgins1990Table5)
## In a some workflows, contrast tests using ART-C would follow a
## significant omnibus effect found by running an anova on the ART responses
## (equivalent to anova(m, response="art")).
## If conducting planned contrasts, this step can be skipped.
anova(m)
## We can conduct contrasts comparing levels of Moisture using the ART-C procedure.
## If conducting contrasts as a post hoc test, this would follow a significant effect
## of Moisture on DryMatter.
## Using a character vector
art.con(m, "Moisture")
## Or using a formula
art.con(m, ~ Moisture)
## Note: Since the ART-C procedure is mathematically equivalent to the ART procedure
## in the single-factor case, this is the same as
## emmeans(artlm(m, "Moisture"), pairwise ~ Moisture)
## art.con() returns an emmGrid object, which does not print asterisks
## beside "significant" tests (p < 0.05). If you wish to add stars beside
## tests of a particular significant level, you can always do that to the
## data frame returned by the summary() method of emmGrid. For example:
art.con(m, ~ Moisture) %>%
summary() %>%
mutate(sig = ifelse(p.value < 0.05, "*", ""))
## Or a more complex example:
art.con(m, ~ Moisture) %>%
summary() %>%
mutate(sig = symnum(p.value, corr = FALSE, na = FALSE,
cutpoints = c(0, 0.001, 0.01, 0.05, 0.1, 1),
symbols = c("***", "**", "*", ".", " ")
))
## We can conduct contrasts comparing combinations of levels
## of Moisture and Fertilizer using the ART-C procedure.
## If conducting contrasts as a post hoc test, this would follow
## a significant Moisture:Fertlizer interaction effect on Drymatter.
## Using a character vector for formula
art.con(m, "Moisture:Fertilizer")
## Using a formula
art.con(m, ~ Moisture*Fertilizer)
## We can also conduct interaction contrasts (comparing differences of differences)
art.con(m, "Moisture:Fertilizer", interaction = TRUE)
## For more examples, see vignette("art-contrasts")
# }
Run the code above in your browser using DataLab