# NOT RUN {
#--- Three-factor example
noise.lm = lm(noise ~ size * type * side, data = auto.noise)
# Separate interaction plots of size by type, for each side
emmip(noise.lm, type ~ size | side)
# One interaction plot, using combinations of size and side as the x factor
# ... with added confidence intervals and some formatting changes
emmip(noise.lm, type ~ side * size, CIs = TRUE,
linearg = list(linetype = "dashed"), CIarg = list(lwd = 1, alpha = 1))
# One interaction plot using combinations of type and side as the trace factor
emmip(noise.lm, type * side ~ size)
# Individual traces in panels
emmip(noise.lm, ~ size | type * side)
# Example for the 'style' argument
fib.lm = lm(strength ~ machine * sqrt(diameter), data = fiber)
fib.rg = ref_grid(fib.lm, at = list(diameter = c(3.5, 4, 4.5, 5, 5.5, 6)^2))
emmip(fib.rg, machine ~ diameter) # curves (because diameter is numeric)
emmip(fib.rg, machine ~ diameter, style = "factor") # points and lines
# For an example using extra ggplot2 code, see 'vignette("messy-data")',
# in the section on nested models.
# }
Run the code above in your browser using DataLab