Learn R Programming

effectsize (version 0.4.1)

cohens_d: Effect size for differences

Description

Compute effect size indices for standardized differences: Cohen's d, Hedges' g and Glass<U+2019>s delta. (This function returns the population estimate.)

Both Cohen's d and Hedges' g are the estimated the standardized difference between the means of two populations. Hedges' g provides a bias correction to Cohen's d for small sample sizes. For sample sizes > 20, the results for both statistics are roughly equivalent. Glass<U+2019>s delta is appropriate when the standard deviations are significantly different between the populations, as it uses only the second group's standard deviation.

Usage

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

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

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

# 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.

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. This produces an effect size that is equivalent to the one-sample effect size on x - y.

ci

Confidence Interval (CI) level

correction

Type of small sample bias correction to apply to produce Hedges' g. Can be 1 for Hedges and Olkin's original correction (default) or 2 for Hunter and Schmidt's correction (see McGrath & Meyer, 2006).

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 non-central parameters (ncps) of the noncentral t-, F- or Chi-squared 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.

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

  • Hunter, J. E., & Schmidt, F. L. (2004). Methods of meta-analysis: Correcting error and bias in research findings. Sage.

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

See Also

d_to_common_language() sd_pooled()

Other effect size indices: effectsize(), eta_squared(), phi(), standardize_parameters()

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