Learn R Programming

sjPlot (version 1.8.1)

sjp.emm.int: Plot estimated marginal means of Two-Way Repeated Measures AN(C)OVA

Description

Plot estimated marginal means (also called least square means or marginal means) of (significant) interaction terms in two-way repeated measure ANOVA or ANCOVA. The fitted models may be linear (mixed effects) models of class lm or merMod. This function may be used to plot differences in interventions between control and treatment groups over multiple time points.

Usage

sjp.emm.int(fit, swapPredictors = FALSE, plevel = 0.05, title = NULL,
  geom.colors = "Set1", axisTitle.x = NULL, axisTitle.y = NULL,
  axisLabels.x = NULL, legendTitle = NULL, legendLabels = NULL,
  showValueLabels = FALSE, valueLabel.digits = 2, showCI = FALSE,
  breakTitleAt = 50, breakLegendTitleAt = 20, breakLegendLabelsAt = 20,
  axisLimits.y = NULL, gridBreaksAt = NULL, printPlot = TRUE)

Arguments

fit
the fitted linear (mixed effect) model (lm or lmer), including interaction terms.
swapPredictors
if TRUE, the grouping variable and predictor on the x-axis are swapped.
plevel
Indicates at which p-value an interaction term is considered as significant, i.e. at which p-level an interaction term will be considered for plotting. Default is 0.05 (5 percent), hence, non-significant interactions are excluded by default.
title
a default title used for the plots. Default value is NULL, which means that each plot's title includes the dependent variable as well as the names of the interaction terms.
geom.colors
A vector of color values.
axisTitle.x
a default title used for the x-axis. Default value is NULL, which means that each plot's x-axis uses the predictor's name as title.
axisTitle.y
a default title used for the y-axis. Default value is NULL, which means that each plot's y-axis uses the dependent variable's name as title.
axisLabels.x
Character vector with value labels of the repeated measure variable that are used for labelling the x-axis.
legendTitle
Character vector with title of the diagram's legend. Default is NULL, so the name of the grouping variable is used as legend title.
legendLabels
Labels for the guide/legend. Default is NULL, so the levels of the grouping variable are used as legend labels.
showValueLabels
if TRUE, value labels are plotted along the lines. Default is FALSE.
valueLabel.digits
the amount of digits of the displayed value labels. Defaults to 2.
showCI
If TRUE, a confidence region for the estimated marginal means will be plotted.
breakTitleAt
Wordwrap for diagram's title. Determines how many chars of the title are displayed in one line and when a line break is inserted. Default is 50.
breakLegendTitleAt
Wordwrap for diagram legend title. Determines how many chars of the legend's title are displayed in one line and when a line break is inserted.
breakLegendLabelsAt
Wordwrap for diagram legend labels. Determines how many chars of the legend labels are displayed in one line and when a line break is inserted. Default is 20.
axisLimits.y
A vector with two values, defining the lower and upper limit from the y-axis. By default, this value is NULL, i.e. axis limits will be calculated upon the range of y-values.
gridBreaksAt
Sets the breaks on the y axis, i.e. at every n'th position a major grid is being printed. Default is NULL.
printPlot
If TRUE (default), plots the results as graph. Use FALSE if you don't want to plot any graphs. In either case, the ggplot-object will be returned as value.

Value

  • (Insisibily) returns the ggplot-objects with the complete plot-list (plot.list) as well as the data frame that were used for setting up the ggplot-objects (df.list).

References

http://www.theanalysisfactor.com/using-adjusted-means-to-interpret-moderators-in-analysis-of-covariance/{Grace-Martin K: Using Adjusted Means to Interpret Moderators in Analysis of Covariance.}

See Also

  • http://www.strengejacke.de/sjPlot/sjp.emm.int/{sjPlot manual: sjp.emm.int}
  • http://strengejacke.wordpress.com/2014/08/19/visualize-pre-post-comparison-of-intervention-rstats/{Weblog example}