plot.dabest: Estimation Plot

Description Usage Arguments Value References See Also Examples

Description

An estimation plot has two key features.

  1. It presents all datapoints as a swarmplot or sinaplot, which orders each point to display the underlying distribution.

  2. It presents the effect size as a bootstrap 95 percent confidence interval on a separate but aligned axes.

Estimation plots emerge from estimation statistics, an intuitive framework that avoids the pitfalls of significance testing. It uses familiar statistical concepts: means, mean differences, and error bars. More importantly, it focuses on the effect size of one's experiment/intervention, as opposed to a false dichotomy engendered by P values. This function takes the output of the dabest function and produces an estimation plot.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## S3 method for class 'dabest'
plot(x, ..., color.column = NULL, palette = "Set1",
  float.contrast = TRUE, slopegraph = TRUE,
  group.summaries = "mean_sd", rawplot.type = c("swarmplot",
  "sinaplot"), rawplot.ylim = NULL, rawplot.ylabel = NULL,
  rawplot.markersize = 2, rawplot.groupwidth = 0.3,
  effsize.ylim = NULL, effsize.ylabel = NULL, effsize.markersize = 4,
  theme = ggplot2::theme_classic(), tick.fontsize = 11,
  axes.title.fontsize = 14, swarmplot.params = NULL,
  sinaplot.params = NULL, slopegraph.params = NULL)

Arguments

x

A dabest object, generated by the function of the same name.

...

Signature for S3 generic function.

color.column

default NULL. This is a column in the data.frame passed to the dabest function. This column will be treated as a factor and used to color the datapoints in the rawdata swarmplot.

palette

default "Set1". Accepts any one of the ggplot2 palettes. See the "Palettes" section in scale_color_brewer.

float.contrast

default TRUE. If idx in the dabest object contains only 2 groups, float.contrast = TRUE will plot the effect size and the bootstrap confidence interval in a horizontally-aligned axes (also known as a Gardner-Altman plot.)

slopegraph

boolean, default TRUE. If the dabest object contains paired comparisons, slopegraph = TRUE will plot the rawdata as a Tufte slopegraph.

group.summaries

"mean_sd", "median_quartiles", or NULL. Plots the summary statistics for each group. If 'mean_sd', then the mean and standard deviation of each group is plotted as a gapped line beside each group. If 'median_quartiles', then the median and 25th & 75th percentiles of each group is plotted instead. If group.summaries = NULL, the summaries are not shown.

rawplot.type

default "beeswarm". Accepts either "beeswarm" or "sinaplot". See geom_quasirandom and geom_sina for more information.

rawplot.ylim

default NULL. Enter a custom y-limit for the rawdata plot. Accepts a vector of length 2 (e.g. c(-50, 50)) that will be passed along to coord_cartesian.

rawplot.ylabel

default NULL. Accepts a string that is used to label the rawdata y-axis. If NULL, the column name passed to y is used.

rawplot.markersize

default 2. This is the size (in points) of the dots used to plot the individual datapoints. There are 72 points in one inch. See this article for more info.

rawplot.groupwidth

default 0.3. This is the maximum amount of spread (in the x-direction) allowed, for each group.

effsize.ylim

default NULL. Enter a custom y-limit for the effect size plot. This parameter is ignored if float.contrast = TRUE. Accepts a vector of length 2 (e.g. c(-50, 50)) that will be passed along to coord_cartesian.

effsize.ylabel

default NULL. Accepts a string that is used to label the effect size y-axis. If NULL, this axes will be labeled "(un)paired func difference" , where func is the function passed to dabest.

effsize.markersize

default 4. This is the size (in points) of the dots used to indicate the effect size.

theme

default theme_classic.

tick.fontsize

default 11. This controls the font size (in points) of all tick labels.

axes.title.fontsize

default 14. This determines the font size (in points) of the axes titles.

swarmplot.params

default NULL. Supply list of keyword = value pairs to geom_quasirandom.

sinaplot.params

default NULL. Supply list of keyword = value pairs to ggforce::geom_sina().

slopegraph.params

default NULL. Supply list of keyword = value pairs to ggplot2::geom_line(). This controls the appearance of the lines plotted for a paired slopegraph.

Value

A ggplot object.

References

Moving beyond P values: Data analysis with estimation graphics. Nature Methods 2019, 1548-7105. Joses Ho, Tayfun Tumkaya, Sameer Aryal, Hyungwon Choi, Adam Claridge-Chang

See Also

The dabest function.

Run vignette("Using dabestr", package = "dabestr") in the console to read more about using parameters to control the plot features.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Performing unpaired (two independent groups) analysis.
unpaired_mean_diff <- dabest(iris, Species, Petal.Width,
                             idx = c("setosa", "versicolor"),
                             paired = FALSE)

# Create a Gardner-Altman estimation plot.
plot(unpaired_mean_diff)



# Comparing versicolor and virginica petal width to setosa petal width.
shared_control_data <- dabest(iris, Species, Petal.Width,
                              idx = c("setosa", "versicolor", "virginica")
                              )

# Create a Cumming estimation plot.
plot(shared_control_data)

dabestr documentation built on July 4, 2019, 5:07 p.m.