An estimation plot has two key features.
It presents all datapoints as a swarmplot or sinaplot, which orders each point to display the underlying distribution.
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.
# S3 method for 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
)
A dabest
object, generated by the function of the same name.
Signature for S3 generic function.
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.
default "Set1". Accepts any one of the RColorBrewer palettes,
or a vector of colors. Colors can be specified as RGB hexcode or as a
named color. See the "Palettes" section in scale_color_brewer
for more on palettes. To obtain all 657 named colors in R, enter colors()
at the console.
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.)
boolean, default TRUE
. If the dabest
object
contains paired comparisons, slopegraph = TRUE
will plot the rawdata
as a Tufte slopegraph.
"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.
default "beeswarm". Accepts either "beeswarm" or "sinaplot". See geom_quasirandom and geom_sina for more information.
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.
default NULL
. Accepts a string that is used to
label the rawdata y-axis. If NULL
, the column name passed to
y
is used.
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.
default 0.3. This is the maximum amount of spread (in the x-direction) allowed, for each group.
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.
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
.
default 4. This is the size (in points) of the dots used to indicate the effect size.
default theme_classic.
default 11. This controls the font size (in points) of all tick labels.
default 14. This determines the font size (in points) of the axes titles.
default NULL
. Supply list of
keyword = value
pairs to geom_quasirandom.
default NULL
. Supply list of
keyword = value
pairs to ggforce::geom_sina()
.
default NULL
. Supply list of
keyword = value
pairs to ggplot2::geom_line()
. This
controls the appearance of the lines plotted for a paired slopegraph.
A ggplot
object.
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
The dabest
function.
Run vignette("Using dabestr", package = "dabestr")
in the console to
read more about using parameters to control the plot features.
# NOT RUN {
# 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)
# }
Run the code above in your browser using DataLab