Learn R Programming

dabestr (version 0.3.0)

mean_diff: Compute Effect Size(s)

Description

For each pair of observations in a dabest object, a desired effect size can be computed. Currently there are five effect sizes available:

  • The mean difference, given by mean_diff().

  • The median difference, given by median_diff().

  • Cohen's d, given by cohens_d().

  • Hedges' g, given by hedges_g().

  • Cliff's delta, given by cliffs_delta().

Usage

mean_diff(x, ci = 95, reps = 5000, seed = 12345)

median_diff(x, ci = 95, reps = 5000, seed = 12345)

cohens_d(x, ci = 95, reps = 5000, seed = 12345)

hedges_g(x, ci = 95, reps = 5000, seed = 12345)

cliffs_delta(x, ci = 95, reps = 5000, seed = 12345)

Value

A dabest_effsize object with 10 elements.

data

The dataset passed to dabest(), as a tibble.

x and y

The columns in data used to plot the x and y axes, respectively, as supplied to dabest(). These are quoted variables for tidy evaluation during the computation of effect sizes.

idx

The vector of control-test groupings as initially passed to dabest().

is.paired

Whether or not the experiment consists of paired (aka repeated) observations. Originally supplied to dabest().

id.column

If is.paired is TRUE, the column in data that indicates the pairing of observations. As passed to dabest().

effect.size

The effect size being computed. One of the following: c("mean_diff", "median_diff", "cohens_d", "hedges_g", "cliffs_delta").

.data.name

The variable name of the dataset passed to dabest().

summary

A tibble with a row for the mean or median of each group in the x column of data, as indicated in idx.

result

A tibble with the following 15 columns:

control_group, test_group

The name of the control group and test group respectively.

control_size, test_size

The number of observations in the control group and test group respectively.

effect_size

The effect size used.

paired

Is the difference paired (TRUE) or not (FALSE)?

difference

The effect size of the difference between the two groups.

variable

The variable whose difference is being computed, ie. the column supplied to y.

ci

The ci passed to this function.

bca_ci_low, bca_ci_high

The lower and upper limits of the Bias Corrected and Accelerated bootstrap confidence interval.

pct_ci_low, pct_ci_high

The lower and upper limits of the percentile bootstrap confidence interval.

bootstraps

The vector of bootstrap resamples generated.

Arguments

x

A dabest object, generated by the dabest() function.

ci

float, default 95. The level of the confidence intervals produced. The default ci = 95 produces 95% CIs.

reps

integer, default 5000. The number of bootstrap resamples that will be generated.

seed

integer, default 12345. This specifies the seed used to set the random number generator. Setting a seed ensures that the bootstrap confidence intervals for the same data will remain stable over separate runs/calls of this function. See set.seed for more details.

See Also

  • Loading data for effect size computation.

  • Generating estimation plots after effect size computation.

  • The mathematical definitions and equations used to compute each effect size.

  • The effsize package, which is used under the hood to compute Cohen's d, Hedges' g, and Cliff's delta.

  • The boot() and boot.ci() functions from the boot package, which generate the (nonparametric) bootstrapped resamples used to compute the confidence intervals.

Examples

Run this code
# Loading data for unpaired (two independent groups) analysis.
petal_widths <- dabest(iris, Species, Petal.Width,
                       idx = c("setosa", "versicolor"),
                       paired = FALSE)


# Compute the mean difference.
mean_diff(petal_widths)

# Plotting the mean differences.
mean_diff(petal_widths) %>% plot()

Run the code above in your browser using DataLab