T Test: Measures of Effect Size and Nonoverlap, and Observed Power
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | ************************************************************************ *** 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 1: Analysing raw data. ** The data have to be in a SPSS active file with the following ** two numeric variables: ** IV – Independent variable (1 = Group 1; 2 = Group 2): ** DV – Dependent variable. * Enter confidence level for confidence interval of difference * (by default, confidence level = .95). T-TEST GROUPS=IV(1 2)/VARIABLES=DV/CRITERIA=CIN(.95). GRAPH/BAR(SIMPLE)=MEAN(DV) BY IV. GRAPH/ERRORBAR(CI 95)=DV BY IV /TITLE='Confidence Intervals for Means'. AGGREGATE/OUTFILE=*/BREAK=iv/m2=MEAN(dv)/dp2=SD(dv)/n2=N. 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. SUMMARIZE/TABLES=U1 U2 U3/FORMAT=NOLIST TOTAL /TITLE='PART III - Measures of Nonoverlap'/CELLS=FIRST. SUMMARIZE/TABLES=N1 N2 N_HARM ALFA OPOWER/FORMAT=NOLIST TOTAL /TITLE='PART IV - Observed Power'/CELLS=FIRST. ************************************************************************ ** 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=XOUT1. END LOOP. EXECUTE. GET FILE=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). GRAPH/BAR(SIMPLE)=MEAN(DV) BY IV. GRAPH/ERRORBAR(CI 95)=DV BY IV /TITLE='Confidence Intervals for Means'. 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. SUMMARIZE/TABLES=U1 U2 U3/FORMAT=NOLIST TOTAL /TITLE='PART III - Measures of Nonoverlap'/CELLS=FIRST. SUMMARIZE/TABLES=N1 N2 N_HARM ALFA OPOWER/FORMAT=NOLIST TOTAL /TITLE='PART IV - Observed Power'/CELLS=FIRST. ************************************************************************ ** 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. ************************************************************************. |
Related pages
...