anova_vis: Analysis of Variance (ANOVA) Graphic

View source: R/anova_vis.R

anova_visR Documentation

Analysis of Variance (ANOVA) Graphic

Description

This is a ggplot2 adaptation of Pruzek and Helmreich's granova::granova.1w function. This also provides parameters to customize which features are included on the plot.

Usage

anova_vis(
  Y,
  group,
  plot_datapoints = TRUE,
  plot_group_means = TRUE,
  plot_boxplot = FALSE,
  plot_group_variances = TRUE,
  plot_group_sd = TRUE,
  plot_ms_within = TRUE,
  plot_ms_between = TRUE,
  plot_between_group_variances = FALSE,
  plot_unit_line = TRUE,
  plot_grand_mean = TRUE,
  plot_sd_line = FALSE,
  plot_pooled_sd = FALSE,
  xlab = "Deviation Contrast",
  ylab = "Dependent Variable",
  grand_mean_col = "blue",
  sd_line_col = "maroon",
  pooled_sd_col = "steelblue3",
  ms_within_col = "#fdc086",
  ms_between_col = "#7fc97f",
  box_width = 0.04,
  box_color = "grey50",
  plot_group_labels = FALSE,
  ...
)

Arguments

Y

the dependent variable.

group

the independent, or grouping, variable.

plot_datapoints

whether to plot the individual observations.

plot_group_means

whether to plot the group means.

plot_boxplot

whether to plot the box plots.

plot_group_variances

whether to plot the group variances.

plot_group_sd

whether to plot the group standard deviations.

plot_ms_within

whether to plot the mean square within.

plot_ms_between

whether to plot the mean square between.

plot_between_group_variances

whether to plot the between group variances.

plot_unit_line

whether to plot the unit line (i.e. y = x).

plot_grand_mean

whether to plot the grand mean.

plot_sd_line

whether to plot the standard deviation.

plot_pooled_sd

whether to plot the pooled standard deviation.

xlab

label for the x-axis.

ylab

label for the y-axis.

grand_mean_col

color for the grand mean.

sd_line_col

color for the standard deviation line.

pooled_sd_col

color for the pooled standard deviation.

ms_within_col

color for the mean square within.

ms_between_col

color for the mean square between.

box_width

width of the box express as a percentage of the width of the x-axis.

box_color

color of the box plots.

plot_group_labels

whether to plot the group labels on the figure.

...

currently unused.

Value

a ggplot2 expression.

References

Pruzek & Helmreich (2010). Elemental Graphics for Analysis of Variance using the R Package granova

Examples

data(hand_washing)
anova_vis(hand_washing$Bacterial_Counts, hand_washing$Method)

jbryer/VisualStats documentation built on Feb. 27, 2025, 6:19 p.m.