Skip to contents

[Maturing]

cohens_d() computes Cohen's d statistic for two independent samples.

This function is based on Cohen (1988) and Frey (2022) calculations for samples with equal and unequal sizes.

Usage

cohens_d(x, y, t = NULL, abs = TRUE)

Arguments

x

A numeric vector.

y

A numeric vector.

t

(Optional) A numeric value for the t statistic (Default: NULL).

abs

(Optional) A logical flag indicating whether to return the absolute value of the Cohen's d statistic (Default: TRUE).

Value

A numeric value representing the Cohen's d statistic.

References

Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Lawrence Erlbaum Associates.

Frey, B. B. (Ed.). (2022). _The SAGE encyclopedia of research design (2. ed.). SAGE Publications. doi:10.4135/9781071812082

Examples

cohens_d(c(1, 2, 3, 4, 5), c(6, 7, 8, 9, 10))
#> [1] 3.162278
#> [1] 3.162278 # Expected