FAQ/cd - CBU statistics Wiki
location: FAQ / cd

# How do I compute Cohen's d in SPSS and its and eta-squared confidence interval in SPSS, R or EXCEL?

Cohen's d represents the difference between a pair of group means expressed in terms of the average group standard deviation. A web-based calculator computing Cohen's d and other effect sizes is available here.

Cohen's d = (difference in group means)/(average group sd)

This may be worked out using the routine of Smithson which is located in the demo file in the power talk given as part of the Graduate Statistics Courses 2009. It can also be computed using the formula given here. Alternatively the average group sd is equal to the square root of the Mean Square Error outputted using the ONEWAY procedure in SPSS and dividing this into the difference in the two means which can be obtained using the means procedure. For example for comparing the two age 'pr' group means we can run the below

```ONEWAY
age BY pr
/MISSING ANALYSIS.
MEANS
TABLES=age  BY pr
/CELLS MEAN COUNT STDDEV  .```

You can alternatively use SPSS Output Management Syntax (OMS) as shown here to compute Cohen's d which converts the tabular output in SPSS procedures into data files which may then be manipulated to give statistics of interest.

Cumming and Finch (2001) have written an EXCEL spreadsheet to compute the 95% Confidence Interval for Cohen's d available from here. The spreadsheet is also here. Choose the table related to the CI for d, select d using the paddle then simulate the lower and upper limits clicking on find LL and find UL at bottom of page under the plot to produce the 95% confidence intervals.

Alternatively a formula for the variance of Cohen's d is given here. If this link is broken its contents are reproduced here. Bonett (2009) gives formulae for obtaining confidence intervals for combining Cohen's ds from unpaired and paired data (including a formula for evaluating the inter-group correlation from the t statistic reported in a paired t-test). This spreadsheet computes a pooled confidence interval for one or more Cohen's d from unpaired groups using Bonett's equations (5) and (10) and this spreadsheet produces pooled confidence intervals for Cohen's d from paired group comparisons using Bonett's equations (6) and (10).

Macros and functions to obtain confidence intervals for eta-squared and Cohen's d in SPSS and R including some of the above are outlined here.

This website mentions that a confidence interval for Cohen's d using R can be done using the below

```library(MBESS)
ci.smd(ncp=2.39, n.1=100, n.2=100, conf.level=0.95)```

This also includes using R to obtain a CI for eta-squared from between subjects ANOVA

```library(MBESS)
ci.pvaf(F.value=5.72, df.1=1, df.2=198, N=200, conf.level=.90)```

which yields

```[1] "The 0.9 confidence limits (and the actual confidence interval coverage) for the proportion of variance of the dependent variable accounted for by knowing group status are given as:"
\$Lower.Limit.Proportion.of.Variance.Accounted.for
[1] 0.002600261

\$Probability.Less.Lower.Limit
[1] 0.05

\$Upper.Limit.Proportion.of.Variance.Accounted.for
[1] 0.07563493

\$Probability.Greater.Upper.Limit
[1] 0.05

\$Actual.Coverage
[1] 0.9```

and adding a few extra lines for eta-squareds from a repeated measures ANOVA as below (otherwise the R function gives an error message)

```library(MBESS)
Lims <- conf.limits.ncf(F.value = 7, conf.level = 0.90, df.1 <- 4, df.2 <- 50)
Lower.lim <- Lims\$Lower.Limit/(Lims\$Lower.Limit + df.1 + df.2 + 1)
Upper.lim <- Lims\$Upper.Limit/(Lims\$Upper.Limit + df.1 + df.2 + 1)
Lower.lim
Upper.lim ```

References

Bonett, D. G. (2009) meta-analytic Interval Estimation for Standardized and Unstandardized mean differences. Psychological Methods 14(3) 225-238. Available free of charge to CBSUers at Psychnet website.

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.

None: FAQ/cd (last edited 2018-02-13 11:57:32 by PeterWatson)