3

Mean difference: 3.7 CI(1.4-6.0) Cohen's d=0.4 how do i calculate the 95% CI of this effect size?

user48054
  • 101
  • 1
  • 1
  • 5

2 Answers2

5

If you know the sizes of the two groups, you can use the 'tes' function in the 'compute.es' package in R, using the following: library(compute.es) tes(t=??, n.1=??, n.2=??)

If you have n1 and n2, you can find t as follows:

t = d*sqrt((n1*n2)/(n1+n2))

Then you can plug into tes() and it will give you a 95% CI for d=0.4.

For example, if you have n1=99 and n2 = 99, then t = 2.81

The top part of the tes() function will give you the 95% CI for d as:

Mean Differences ES:

d [ 95 %CI] = 0.4 [ 0.12 , 0.68 ] 

You can find a full explanation of Confidence Intervals for effect sizes here:

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.

Or, alternatively, there is a nice walk-through here: http://www.uvm.edu/~dhowell/methods7/Supplements/Confidence%20Intervals%20on%20Effect%20Size.pdf

I hope that helps!

Jeromy Anglim
  • 42,044
  • 23
  • 146
  • 250
Jordan Collins
  • 520
  • 2
  • 7
  • Thank you very much! I was able to calculate the CI now (-0.0609-0.8609) – user48054 Mar 05 '15 at 15:29
  • Great! There's a related post here, in case you're interested why you CI now includes 0 whereas the original one did not: http://stats.stackexchange.com/questions/140344/why-is-the-p-value-for-cohens-d-not-equal-to-the-p-value-of-a-t-test/140361#140361 – Jordan Collins Mar 05 '15 at 15:31
  • Is this the same for paired-samples t-tests? –  Dec 13 '15 at 22:27
  • does this work for Cohen's q too? – grey Mar 12 '16 at 16:11
  • @grey: you've answered your question here: http://stats.stackexchange.com/questions/197391/how-to-calculate-95-ci-for-cohens-q Was there something else you were looking for? – Jordan Collins Mar 14 '16 at 13:20
  • @Jordan Collins: No, that's resolved now, thanks. I don't know why it says I posted this yesterday as it actually was at some point last week. – grey Mar 14 '16 at 13:22
  • Sounds good! Your answer was the answer I was going to give here - just had a look on stats.exchange first. – Jordan Collins Mar 14 '16 at 13:23
  • @trish: yes this will work for paired-samples t-tests. You might want to read here (which is very clear): http://www.unt.edu/rss/class/Jon/ISSS_SC/Module008/isss_m8_introttests/node3.html – Jordan Collins Mar 14 '16 at 13:25
2

Updated Answer (Sept 2018): There is now a function in R called cohen.d.ci in the psych package.

So for example, you can do obtain confidence intervals on d using the following function:

psych::cohen.d.ci(d = .1, n1 = 100, n2 = 100)

This would return the following:

           lower effect     upper
 [1,] -0.1777814    0.1 0.3772792

You can also use it where you have a vector of d effect sizes and sample sizes. For example, you might be doing a meta-analysis. Or you might have a large table where you are reporting many sample sizes:

data <- data.frame(d = rep(0.5, 5), n1 = seq(100, 500, 100), n2 = seq(100, 500, 100))
ds <- psych::cohen.d.ci(data$d, data$n1, data$n2)
cbind(data, ds)

This yields the following matrix:

    d  n1  n2     lower effect     upper
1 0.5 100 100 0.1005884    0.5 0.8969416
2 0.5 200 200 0.2178744    0.5 0.7809048
3 0.5 300 300 0.2697461    0.5 0.7294395
4 0.5 400 400 0.3006463    0.5 0.6987449
5 0.5 500 500 0.3217247    0.5 0.6777884

Original Answer (Dec 2016): I found Jordan's answer useful, so I wrapped it up into an R function:

cohensd.ci <- function(d, n1, n2, ci = 0.95) {
    library(compute.es)
    t <- d * sqrt((n1 * n2)/(n1 + n2))
    capture.output(
        fit <- compute.es::tes(t = t, n.1 = n1, n.2 = n2, level = 100 * ci),
        file = "NUL"
    )
    c(lower.ci = fit$l.d, upper.ci = fit$u.d)
}

So for example, a cohen's d of 0.5 with sample sizes of 100 in each group would be:

cohensd.ci(d = 0.5, n1 = 100, n2 = 100)    

resulting in:

lower.ci upper.ci 
    0.22     0.78 
Jeromy Anglim
  • 42,044
  • 23
  • 146
  • 250
  • I am trying different packages (compute.es, psych, and MBESS) for CI around cohen's d and they yield different results for the same values. Any idea why? – beberuhi Oct 09 '19 at 19:51