cohen.d: Cohen's d and Hedges g effect size

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/CohenD.R

Description

Computes the Cohen's d and Hedges'g effect size statistics.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
cohen.d(d, ...)

## S3 method for class 'formula'
cohen.d(formula,data=list(),...)

## Default S3 method:
cohen.d(d,f,pooled=TRUE,paired=FALSE,
                   na.rm=FALSE, mu=0, hedges.correction=FALSE,
                   conf.level=0.95,noncentral=FALSE, 
                   within=TRUE, subject=NA, ...)

Arguments

d

a numeric vector giving either the data values (if f is a factor) or the treatment group values (if f is a numeric vector)

f

either a factor with two levels or a numeric vector of values, if NA a single sample effect size is computed

formula

a formula of the form y ~ f, where y is a numeric variable giving the values and f a factor with two levels giving the corresponding groups.

If using a paired computation (paired=TRUE) it is possible to specify the ids of the subjects using the form y ~ f | Subject(id) which allow the correct pairing of the pre and post values.

A single sample effect size can be specified with the form y ~ ..

data

an optional matrix or data frame containing the variables in the formula formula. By default the variables are taken from environment(formula).

pooled

a logical indicating whether compute pooled standard deviation or the whole sample standard deviation. If pooled=TRUE (default) pooled sd is used, if pooled=FALSE the standard deviation of the the control group (the second argument or the one corresponding the the second level of the factor) is used instead.

hedges.correction

logical indicating whether apply the Hedges correction

conf.level

confidence level of the confidence interval

noncentral

logical indicating whether to use non-central t distributions for computing the confidence interval.

paired

a logical indicating whether to consider the values as paired, a warning is issued if paired==TRUE with the formula interface and not | Subject(id) or with data and factor and no subject is provided

within

indicates whether to compute the effect size using the within subject variation, taking into consideration the correlation between pre and post samples.

subject

an array indicating the id of the subject for a paired computation, when the formula interface is used it can be indicated in the formula by adding | Subject(id), where id is the column in the data that contains and id of the subjects to be paired.

mu

numeric indicating the reference mean for single sample effect size.

na.rm

logical indicating whether NAs should be removed before computation; if paired==TRUE then all incomplete pairs are removed.

...

further arguments to be passed to or from methods.

Details

When f in the default version is a factor or a character, it must have two values and it identifies the two groups to be compared. Otherwise (e.g. f is numeric), it is considered as a sample to be compare to d.

In the formula version, f is expected to be a factor, if that is not the case it is coherced to a factor and a warning is issued.

The function computes the value of Cohen's d statistics (Cohen 1988). If required (hedges.correction==TRUE) the Hedges g statistics is computed instead (Hedges and Holkin, 1985).

When paired is set, the effect size is computed using the approach suggested in (Gibbons et al. 1993). In particular a correction to take into consideration the correlation of the two samples is applied (see Borenstein et al., 2009)

It is possible to perform a single sample effect size estimation either using a formula ~x or passing f=NA.

The computation of the CI requires the use of non-central Student-t distributions that are used when noncentral==TRUE; otherwise a central distribution is used.

Also a quantification of the effect size magnitude is performed using the thresholds define in Cohen (1992). The magnitude is assessed using the thresholds provided in (Cohen 1992), i.e. |d|<0.2 "negligible", |d|<0.5 "small", |d|<0.8 "medium", otherwise "large"

The variance of the d is computed using the conversion formula reported at page 238 of Cooper et al. (2009):

((n1+n2)/(n1*n2) + .5*d^2/df) * ((n1+n2)/df)

Value

A list of class effsize containing the following components:

estimate

the statistic estimate

conf.int

the confidence interval of the statistic

sd

the within-groups standard deviation

conf.level

the confidence level used to compute the confidence interval

magnitude

a qualitative assessment of the magnitude of effect size

method

the method used for computing the effect size, either "Cohen's d" or "Hedges' g"

Author(s)

Marco Torchiano http://softeng.polito.it/torchiano/

References

Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). New York:Academic Press.

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

Cohen, J. (1992). A power primer. Psychological Bulletin, 112, 155-159.

Cooper, Hedges, and Valentin (2009). The Handbook of Research Synthesis and Meta-Analysis

David C. Howell (2011). Confidence Intervals on Effect Size. Available at: https://www.uvm.edu/~statdhtx/methods8/Supplements/MISC/Confidence%20Intervals%20on%20Effect%20Size.pdf

Cumming, G.; Finch, S. (2001). A primer on the understanding, use, and calculation of confidence intervals that are based on central and noncentral distributions. Educational and Psychological Measurement, 61, 633-649.

Gibbons, R. D., Hedeker, D. R., & Davis, J. M. (1993). Estimation of effect size from a series of experiments involving paired comparisons. Journal of Educational Statistics, 18, 271-279.

M. Borenstein, L. V. Hedges, J. P. T. Higgins and H. R. Rothstein (2009) Introduction to Meta-Analysis. John Wiley & Son.

See Also

cliff.delta, VD.A, print.effsize

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
treatment = rnorm(100,mean=10)
control = rnorm(100,mean=12)
d = (c(treatment,control))
f = rep(c("Treatment","Control"),each=100)
## compute Cohen's d
## treatment and control
cohen.d(treatment,control)
## data and factor
cohen.d(d,f)
## formula interface
cohen.d(d ~ f)
## compute Hedges' g
cohen.d(d,f,hedges.correction=TRUE)

Example output

Cohen's d

d estimate: -2.017103 (large)
95 percent confidence interval:
      inf       sup 
-2.359643 -1.674563 

Cohen's d

d estimate: -2.017103 (large)
95 percent confidence interval:
      inf       sup 
-2.359643 -1.674563 

Cohen's d

d estimate: -2.017103 (large)
95 percent confidence interval:
      inf       sup 
-2.359643 -1.674563 

Hedges's g

g estimate: -2.009453 (large)
95 percent confidence interval:
      inf       sup 
-2.351556 -1.667351 

effsize documentation built on Oct. 23, 2020, 5:15 p.m.