Learn R Programming

effectsize (version 0.2.0)

cohens_d: Effect size for differences

Description

Compute different indices of effect size. For very small sample sizes (n < 20) Hedges' g is considered as less biased than Cohen's d. For sample sizes > 20, the results for both statistics are roughly equivalent. The Glass<U+2019>s delta is appropriate if standard deviations are significantly different between groups, as it uses only the control group's (x) standard deviation.

Usage

cohens_d(
  x,
  y = NULL,
  data = NULL,
  correction = FALSE,
  pooled_sd = TRUE,
  paired = FALSE
)

hedges_g( x, y = NULL, data = NULL, correction = FALSE, pooled_sd = TRUE, paired = FALSE )

glass_delta(x, y = NULL, data = NULL, correction = FALSE)

Arguments

x

A continuous variable or a formula.

y

A continuous variable, a factor with two groups or a formula.

data

An optional data frame containing the variables.

correction

If TRUE, applies a correction to the formula to make it less biased for small samples (McGrath & Meyer, 2006).

pooled_sd

If FALSE, the regular SD from both combined groups is used instead of the sd_pooled.

paired

If TRUE, the values of x and y are considered as paired.

References

  • Cohen, J. (2013). Statistical power analysis for the behavioral sciences. Routledge.

  • McGrath, R. E., & Meyer, G. J. (2006). When effect sizes disagree: the case of r and d. Psychological methods, 11(4), 386.

  • Hedges, L. V. & Olkin, I. (1985). Statistical methods for meta-analysis. Orlando, FL: Academic Press.

Examples

Run this code
# NOT RUN {
cohens_d(iris$Sepal.Length, iris$Sepal.Width)
hedges_g("Sepal.Length", "Sepal.Width", data = iris)
glass_delta(Sepal.Length ~ Sepal.Width, data = iris)

cohens_d(iris$Sepal.Length, iris$Sepal.Width, correct = TRUE, pooled_sd = FALSE)
cohens_d(Sepal.Length ~ Species, data = iris[iris$Species %in% c("versicolor", "setosa"), ])
# }

Run the code above in your browser using DataLab