Solved
Contributor
Posts: 40

# Calculating Cohen's d using PROC MIXED

Hi All,

I came across a problem in which I need to calculate Cohen's d (standardized effect size) for any of the two groups. I used PROC MIXED to fit the model and the outputs provided LSMEANS for the differences between a treatment and a reference (control). The outputs also included the standard error and degree of freedom (I used dfm=kr in the MODEL statement). My question is, can I use the LSMEANS of difference, standard error and DF to calculate Cohen's d?

Here is the sample code:

PROC MIXED data=test;

class PTNO TREAT HOUR;

model Score = PTNO TREAT TREAT*HOUR /dfm=kr residual;

repeated HOUR / subject=PTNO type=CS; *** Each PTNO was measured 2 times;

RUN;

Accepted Solutions
Solution
‎07-07-2017 08:35 AM
SAS Employee
Posts: 17

## Re: Calculating Cohen's d using PROC MIXED

Cohen's d is defined as the difference between two means divided by a standard deviation or pool standard deviation for the data. However, the LSMEANS statement in PROC MIXED only computes standard error not standard deviation from the data, the value of standard error may or may not be consistent with the value of standard deviation. Simply because the LS-means is a linear combination of parameter estimates in the model and also known as adjusted means, not the "arithmetic mean" calculation.

Use the PROC MEANS to extract the mean for effect Treat groups, and then use the PROC TTEST to obtain the mean difference and the pooled standard deviation. This might be more straighforward for calculating Cohen'd.

XC

All Replies
Solution
‎07-07-2017 08:35 AM
SAS Employee
Posts: 17

## Re: Calculating Cohen's d using PROC MIXED

Cohen's d is defined as the difference between two means divided by a standard deviation or pool standard deviation for the data. However, the LSMEANS statement in PROC MIXED only computes standard error not standard deviation from the data, the value of standard error may or may not be consistent with the value of standard deviation. Simply because the LS-means is a linear combination of parameter estimates in the model and also known as adjusted means, not the "arithmetic mean" calculation.

Use the PROC MEANS to extract the mean for effect Treat groups, and then use the PROC TTEST to obtain the mean difference and the pooled standard deviation. This might be more straighforward for calculating Cohen'd.

XC

Contributor
Posts: 40

## Re: Calculating Cohen's d using PROC MIXED

Thanks so much cici0017. I understand that the best way to calculate Cohen's d is the way you suggested. But can I use the standard error (SE) and DF provided by the PROC MIXED to roughly "approximate" standard deviation (SD)?

There is a  post that has suggested that we might be able to calculate SD as SE*SQRT(DF+1).

The  reasons that I would like to calculate Cohen's d using PROC MIXED are two folds:

1. We have repeated measurements. Each subject was measured twice (or more). This actually "inflate" the sample size if we calculate SD using PROC MEANS and PROC TTEST.

2. We have many treatment arms (groups). It is a lot of work if I do the pairwise calculations.

Thanks in advance for any thoughts or suggestions.

SAS Employee
Posts: 17

## Re: Calculating Cohen's d using PROC MIXED

The approximate standard errors for the LS-mean is computed as the square root of L*(X'*(V_hat)^-1*X)^-1*L'. See the documentation here -

http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_mixed_syntax...

I am not sure how close this formular (SE*SQRT(DF+1)) to the provided formula of STDERR  of LSMEANS in MIXED procedure. You might have to run some testing for comparisons.

XC

Contributor
Posts: 40

## Re: Calculating Cohen's d using PROC MIXED

Thanks cici0017!
☑ This topic is solved.