Learn R Programming

effectsize (version 0.4.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 second group's standard deviation.

Usage

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

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

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

# S3 method for effectsize_difference print(x, digits = 2, append_CL = FALSE, ...)

Arguments

x

A formula, a numeric vector, or a character name of one in data. (For print() the result of one of the standardized difference functions.)

y

A numeric vector, a grouping (character / factor) vector, a or a character name of one in data. Ignored if x is a formula.

data

An optional data frame containing the variables.

correction

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

pooled_sd

If TRUE (default), a sd_pooled() is used (assuming equal variance). Else the mean SD from both groups is used instead.

paired

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

ci

Confidence Interval (CI) level

digits

Number of significant digits.

append_CL

Should the Common Language Effect Sizes be printed as well? Not applicable to Glass' Delta (See d_to_common_language())

...

Not used.

Value

A data frame with the effect size(s) and confidence interval(s).

Confidence Intervals

Confidence intervals are estimated using the Noncentrality parameter method; These methods searches for a the best ncp (non-central parameters) for of the noncentral t distribution for the desired tail-probabilities, and then convert these ncps to the corresponding effect sizes.

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.

See Also

d_to_common_language()

Examples

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

cohens_d(mpg ~ am, data = mtcars)
cohens_d(mpg ~ am, data = mtcars, pooled_sd = FALSE)
hedges_g(mpg ~ am, data = mtcars)
glass_delta(mpg ~ am, data = mtcars)

print(cohens_d(mpg ~ am, data = mtcars), append_CL = TRUE)

# }

Run the code above in your browser using DataLab