# \donttest{
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"), ~ Moisture), method = "pairwise")
## 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"), ~ MoistureFertilizer), method = "pairwise")
## 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")
# }
Run the code above in your browser using DataLab