d_from_means: Obtain Cohen's _d_ from means, standard deviations, and ns

Description Usage Arguments Details Value References Examples

View source: R/d_from_means.R

Description

This function converts means, standard deviations, and sample sizes to Cohen's d.

Usage

1
d_from_means(m1, m2, sd1, sd2, n1, n2, bias_correct = FALSE)

Arguments

m1, m2

A numerical vector with the means of the two groups formed by the dichotomous variable.

sd1, sd2

A numerical vector with the standard deviations of the two groups formed by the dichotomous variable. Note that the nth element of these vectors must correspond to the nth elements of the m1, m2 vectors.

n1, n2

A numerical vector with the sample sizes of the two groups formed by the dichotomous variable. Note that the nth element of these vectors must correspond to the nth elements of the m1, m2 vectors.

bias_correct

Logical to indicate if the d-values should be bias-corrected. Can also be a vector.

Details

The formula that is used is the following (see e.g. Lakens, 2013):

d= \frac{\bar{X}_1 - \bar{X}_1} {√{\frac{(n_1 - 1)SD_1^2 + (n_2 - 1)SD_2^2}{n_1 + n_2 - 2}}}

Value

A data frame with in the first column, Cohen's d values, and in the second column, the corresponding variances.

References

Lakens, D. (2013) Calculating and reporting effect sizes to facilitate cumulative science: a practical primer for t-tests and ANOVAs. Frontiers in Psychology, 4, p. 863. doi: 10.3389/fpsyg.2013.00863

Examples

1
2
3
4
5
6
escalc::d_from_means(m1 = 2.828427,
                     m2 = 2.123041,
                     sd1 = 0.230101,
                     sd2 = 0.259281,
                     n1 = 126,
                     n2 = 89);

wviechtb/escalc documentation built on Jan. 9, 2020, 4:14 p.m.