* Encoding: UTF-8.

************************************************************************

*** T Test: Measures of Effect Size and Nonoverlap, and Observed Power

*** Valentim R. Alferes (University of Coimbra, Portugal)

*** valferes@fpce.uc.pt

**

** This syntax does a T Test for two independent groups and calculates

** measures of effect size, measures of nonoverlap, and observed power.

**

** The output is divided into four parts:

**

** PART I - SPSS T Test standard output:

** - Descriptive statistics;

** - Levene's Test for Equality of Variances

** - T-Test for Equality of Means (Equal variances assumed

**   and not assumed);

** - Confidence Interval of the Difference.

**

** PART II - Measures of effect size:

** - Cohen's d (D);

** - Hedges Correction (D_H);

** - r point biserial (R);

** - Squared r point biserial (R2);

** - Binomial Effect Size Display (BESD_LO and BESD_UP).

**

** PART III - Measures of nonoverlap (Cohen, 1988, pp. 21-23):

** - U1 (percent of nonoverlap between the two distributions);

** - U2 (the highest percent in Group 1 that exceds the same lowest

**   percent in Group 2);

** - U3 (percentile standing = percentile of the Group 2 distribution

**   corresponding to the 50th percentile of Group 1 distribution).

**

** PART IV - Observed power (for algorithm, see Borenstein et al., 2001):

** - N1, N2, Harmonic N (N_HARM);

** - Alfa (ALFA) and observed power (OPOWER).

**

** The user has two methods: Analysing raw data or reproducing the SPSS

** T Test standard output from summary statistics in published articles.

 

************************************************************************.

************************************************************************

 

** METHOD 2: Reproducing the SPSS T Test standard output from

** summary statistics in published articles.

 

* Enter, row by row, N, Mean, and SD for Groups 1 and 2.

DATA LIST LIST /N(F8.0) M(F8.2) SD(F8.2).

BEGIN DATA

17  7.46  1.98

15  5.34  2.14

END DATA.

COMPUTE IV=$CASENUM.

LOOP ID=1 TO N.

XSAVE OUTFILE='%temp%\XOUT1'.

END LOOP.

EXECUTE.

GET FILE='%temp%\XOUT1'.

COMPUTE DV=M.

COMPUTE K=SQR((SD**2*(N-1))/2).

IF (ID=1) DV=M+K.

IF (ID=2) DV=M-K.

EXECUTE.

 

* Enter confidence level for confidence interval of difference

* (by default, confidence level = .95).

T-TEST GROUPS=IV(1 2)/VARIABLES=DV/CRITERIA=CIN(.95).

 

 

 

T-Test

 

 

 

Group Statistics

 

IV

N

Mean

Std. Deviation

Std. Error Mean

DV

1

17

7.46

1.980

.480

2

15

5.34

2.140

.553

 

 

Independent Samples Test

 

Levene's Test for Equality of Variances

t-test for Equality of Means

F

Sig.

t

df

Sig. (2-tailed)

Mean Difference

Std. Error Difference

95% Confidence Interval of the Difference

Lower

Upper

DV

Equal variances assumed

.020

.889

2.910

30

.007

2.120

.728

.632

3.608

Equal variances not assumed

 

 

2.896

28.773

.007

2.120

.732

.622

3.618

 

 

 

 

 

 

AGGREGATE/OUTFILE=*/BREAK=IV/N2=MEAN(N)/M2=MEAN(M)/DP2=MEAN(SD).

COMPUTE N1=LAG(N2,1).

COMPUTE M1=LAG(M2,1).

COMPUTE DP1=LAG(DP2,1).

EXECUTE.

SELECT IF(IV=2).

EXECUTE.

 

* Enter alfa for calculating observed power (by default, ALFA = 0.05).

COMPUTE ALFA = 0.05.

COMPUTE SP2=(((N1-1)*(DP1**2))+((N2-1)*(DP2**2)))/(N1+N2-2).

COMPUTE T=(M1-M2)/SQR(SP2*((1/N1)+(1/N2))).

COMPUTE GL=N1+N2-2.

COMPUTE R=T/SQR((T**2)+GL).

COMPUTE R2=R**2.

COMPUTE D=T*SQR((1/N1)+(1/N2)).

COMPUTE D_H=D*(1-(3/(4*(N1+N2)-9))).

COMPUTE BESD_LO=.50-(R/2).

COMPUTE BESD_UP=.50+(R/2).

COMPUTE U3=CDF.NORMAL(D,0,1)*100.

COMPUTE U2=CDF.NORMAL((D/2),0,1)*100.

COMPUTE U2X=CDF.NORMAL((ABS(D)/2),0,1).

COMPUTE U1=(2*U2X-1)/U2X*100.

COMPUTE N_HARM=(2*N1*N2)/(N1+N2).

COMPUTE NCP=ABS((D*SQR(N_HARM))/SQR(2)).

COMPUTE T_ALPHA=IDF.T(1-ALFA/2,GL).

COMPUTE POWER1=1-NCDF.T(T_ALPHA,GL,NCP).

COMPUTE POWER2=1-NCDF.T(T_ALPHA,GL,-NCP).

COMPUTE OPOWER=POWER1+POWER2.

FORMATS ALL(F8.4) N1 N2(F8.0) U1 U2 U3(F8.1).

SUMMARIZE/TABLES=D D_H R R2 BESD_LO BESD_UP/FORMAT=NOLIST TOTAL

 /TITLE='PART II - Measures of Effect Size'/CELLS=FIRST.

 

 

 

PART II - Measures of Effect Size

First 

D

D_H

R

R2

BESD_LO

BESD_UP

1.0310

1.0050

.4692

.2202

.2654

.7346

 

 

PART III - Measures of Nonoverlap

First 

U1

U2

U3

56.5

69.7

84.9

 

 

PART IV - Observed Power

First 

N1

N2

N_HARM

ALFA

OPOWER

17

15

15.9375

.0500

.8041

 

 

 

************************************************************************

** Borenstein, M., Rothstein, H., & Cohen, J. (2001). SamplePower 2.0

**    [Computer Manual]. Chicago: SPSS Inc.

** Cohen, J. (1988). Statistical power analysis for the behavioral

**    sciences (2nd ed.). Hillsdale, NJ: Lawrence Erbaum.

************************************************************************.