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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
****************************************************************************
*** Meta-Analysis: Fixed and Random Effects Models
*** Valentim R. Alferes (University of Coimbra, Portugal)
*** valferes@fpce.uc.pt
**
** This syntax does a meta-analysis on a set of studies comparing two 
** independent means. It produces results for both fixed and random effects 
** models, using Cohen's d statistic, with or without Hedges' correction.
**
** The user has TEN MODES FOR ENTERING SUMMARY DATA (see PART 1):
**
** Mode 1 - Study No., N1, M1, SD1, N2, M2 SD2.
** Mode 2 - Study No., N1, M1, N2, M2 SD_POOL.
** Mode 3 - Study No., Direction of Effect, Difference, N1, SD1, N2, SD2.
** Mode 4 - Study No., Direction of Effect, Difference, N1, N2, SD_POOL.
** Mode 5 - Study No., DF, M1, SD1, M2 SD2.
** Mode 6 - Study No., DF, M1, M2, SD_POOL.
** Mode 7 - Study No., Direction of Effect, DF, Difference, SD1, SD2.
** Mode 8 - Study No., Direction of Effect, DF, Difference, SD_POOL.
** Mode 9 - Study No., Direction of Effect, N1, N2, T_OBS.
** Mode 10 - Study No., Direction of Effect, DF, T_OBS.
**
** There are no limits for the number of studies to be analyzed and the user 
** can input data simultaneously in the ten modes or enter all the studies 
** only in one mode. In the modes not used, the lines of data have to be 
** cleared, but not the corresponding command lines.
**
** If the input are means, the program assumes that Group 1 is the 
** experimental or focus group and Group 2 is the control or comparison 
** group. 
**
** If the input are differences between group means or observed Ts, they 
** are registered in absolute values (DIF=|M1-M2| or T_OBS=|Tobs|) and the 
** user specifies the direction of effect in a different variable (DIRECT): 
** +1 (if the effect is in the expected direction: Group 1 mean greater 
** than Group 2 mean) and -1 (if the effect is reversed: Group 1 mean lesser 
** than Group 2 mean).
**
** When the input are degrees of freedom, the syntax asssumes equal Ns if df 
** are even, and N2=N1-1 if they are odd.
**
** When the data are selected from two contrasting ANOVA treatments, the 
** user can input them in modes 2 or 4 and let the pooled standard deviation 
** (SD_POOL) equals the squared root of the original ANOVA MS Error. 
**
** By default the measure of effect size is Hedges' correction to Cohen's d. 
** If you want to use d statistic without correction,  you can change the 
** default in the corresponding command line.   
**
** The OUTPUT is organized in nine tables:
**
** Table 1  User's data
**
** Table 2  Program imputations
**
** Table 3  Individual T Tests and observed power
** - N1, N2, degrees of freedom (DF), difference between group means (DIF), 
**   observed T (T_OBS), two-tailed probability (P_TWO), and one-tailed 
**   probability (P_ONE);
** - Alfa (ALFA), Harmonic N (N_HARM), noncentrality parameter (NCP), and 
**   observed power (OPOWER).
**   [for algorithm, see Borenstein et al., 2001]
**
** Table 4  Measures of Effect Size and Nonoverlap
** Measures of effect size:
** - Cohen's d (D);
**   [Cohen, 1988, p. 20]
** - Hedges' correction (D_H);
**   [D_H = d, in Hedges & Olkin, 1985; D_H = d*, in Hunter & Schmidt, 
**   1990; see Cortina & Nouri, 2000, p. 9];
** - r point biserial (R);
** - Squared r point biserial (R2);
** - Binomial Effect Size Display (BESD_LO and BESD_UP).
**   [see formulas in Rosenthal et al. 2000, pp. 8-19]
**
** Measures of nonoverlap:
** - U1 (percent of nonoverlap between the two distributions);
** - U2 (the highest percent in Group 1 that exceeds 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);
**   [see formulas in Cohen, 1988, pp. 21-23]
**
** Table 5 - Non weighted effect size - Descriptive statistics
** - Number of studies (NSTUDIES), Cohen's d (D), and Hedges' correction 
**   (D_H) (minimun, maximun, mean, sem, and sd).
**
** Table 6  Fixed effects model
** - Weighted average effect size (EF_SIZE), VARIANCE, and standard error 
**   (SE);
** - z Test (z), two-tailed probability (P_TWO), and one-tailed probability 
**   (P_ONE);
** - Confidence level (CL), and lower (CI_LOWER) and upper (CI_UPPER) 
**   interval confidence limits.
**   [see formulas in Shadish & Haddock, 1994, pp. 265-268]
**
** Table 7 - Chi-square Test for homogeneity of effect size:
** - Q statistic, degrees of freedom (K), and two-tailed probability 
**   (P_CHISQ)
**   [see formula in Shadish & Haddock, 1994, p. 266]
**
** Table 8 - Random Variance Component
** - V0 [see formula in Lipsey & Wilson, 2001, p. 134].
**
** Table 9  Random effects model
** - Weighted average effect size (EF_SIZE), VARIANCE, and standard error 
**   (SE);
** - z Test (z), two-tailed probability (P_TWO), and one-tailed probability 
**   (P_ONE);
** - Confidence level (CL), and lower (CI_LOWER) and upper (CI_UPPER) 
**   interval confidence limits.
**   [see formulas and procedures in Lipsey & Wilson, 2001, pp. 134-135]
**
** For calculating observed power of individual studies, the syntax assumes 
** alfa = 0.05. For calculating the confidence interval of weighted effect 
** sizes, the syntax assumes confidence level = 95%. If you want, you can 
** modify these values in the corresponding lines (see PART 2).
**
** After running the syntax, the user can have access to Tables 2, 3 and 4 
** in SPSS active file, so that he may handle the data for other meta-
** analytic procedures based on different effect size measures or exact 
** probabilities (see other syntaxes in this site).
**
** In the example, we have 20 studies and we have used the ten input data 
** modes. 

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

*** BEGIN OF THE SYNTAX.

** PART 1: ENTERING SUMMARY DATA.

* Mode 1: Enter, row by row, Study No., N1, M1, SD1, N2, M2 SD2.
DATA LIST LIST /Study(F8.0) N1(F8.0) M1(F8.2) SD1(F8.2) N2(F8.0) M2(F8.2) 
SD2(F8.2).
BEGIN DATA
1  17  7.46  1.98  16  6.23  2.45
2  15  5.34  2.14  15  4.47  2.51
END DATA.
SAVE OUTFILE=DATA1.

* Mode 2: Enter, row by row, Study No., N1, M1, N2, M2 SD_POOL.
DATA LIST LIST /Study(F8.0) N1(F8.0) M1(F8.2) N2(F8.0) M2(F8.2) 
SD_POOL(F8.2).
BEGIN DATA
3  14  7.32  16  8.23  2.67
4  23  6.20  27  4.47  2.21
END DATA.
SAVE OUTFILE=DATA2.

* Mode 3: Enter, row by row, Study No., Direction of Effect, Difference, 
* N1, SD1, N2, SD2.
DATA LIST LIST /Study(F8.0) Direct(F8.0) DIF(F8.2) N1(F8.0) SD1(F8.2) 
N2(F8.0) SD2(F8.2).
BEGIN DATA
5  +1  1.04  10  3.04  11  2.98
6  -1  2.25  12  2.63  12  2.21
END DATA.
SAVE OUTFILE=DATA3.

* Mode 4: Enter, row by row, Study No., Direction of Effect, Difference, N1, 
* N2, SD_POOL.
DATA LIST LIST /Study(F8.0) Direct(F8.0) DIF(F8.2) N1(F8.0) N2(F8.0) 
SD_POOL(F8.2).
BEGIN DATA
7  -1  1.32  34  33  2.44
8  +1  1.25  20  20  3.09
END DATA.
SAVE OUTFILE=DATA4.

* Mode 5: Enter, row by row, Study No., DF, M1, SD1, M2 SD2.
DATA LIST LIST /Study(F8.0) DF(F8.0) M1(F8.2) SD1(F8.2) M2(F8.2) SD2(F8.2).
BEGIN DATA
9   34  7.46  1.69  6.33  2.98
10  33  5.34  2.94  5.46  2.31
END DATA.
SAVE OUTFILE=DATA5.

* Mode 6: Enter, row by row, Study No., DF, M1, M2, SD_POOL.
DATA LIST LIST /Study(F8.0) DF(F8.0) M1(F8.2) M2(F8.2) SD_POOL(F8.2).
BEGIN DATA
11  27  7.76  5.29  2.77
12  28  6.30  4.21  2.41
END DATA.
SAVE OUTFILE=DATA6.

* Mode 7: Enter, row by row, Study No., Direction of Effect, DF, Difference, 
* SD1, SD2.
DATA LIST LIST /Study(F8.0) Direct(F8.0) DF(F8.0) DIF(F8.2) SD1(F8.2) SD2(F8.2).
BEGIN DATA
13  +1  40  3.07  1.77  2.87
14  -1  37  2.11  2.62  2.21
END DATA.
SAVE OUTFILE=DATA7.

* Mode 8: Enter, row by row, Study No., Direction of Effect, DF, Difference, 
* SD_POOL.
DATA LIST LIST /Study(F8.0) Direct(F8.0) DF(F8.0) DIF(F8.2) SD_POOL(F8.2).
BEGIN DATA
15  -1  23  2.22  1.88
16  +1  34  3.17  1.94
END DATA.
SAVE OUTFILE=DATA8.

* Mode 9: Enter, row by row, Study No., Direction of Effect, N1, N2, T_OBS.
DATA LIST LIST /Study(F8.0) Direct(F8.0) N1(F8.0) N2(F8.0) T_OBS(F8.2).
BEGIN DATA
17  +1  20  20  4.74
18  -1  14  15  3.17
END DATA.
SAVE OUTFILE=DATA9.

* Mode 10: Enter, row by row, Study No., Direction of Effect, DF, T_OBS.
DATA LIST LIST /Study(F8.0) Direct(F8.0) DF(F8.0) T_OBS(F8.2).
BEGIN DATA
19  +1  54  5.46
20  -1  49  2.27
END DATA.
SAVE OUTFILE=DATA10.
GET FILE=DATA1.
ADD FILES/FILE=*/FILE=DATA2/FILE=DATA3/FILE=DATA4/FILE=DATA5
/FILE=DATA6/FILE=DATA7/FILE=DATA8/FILE=DATA9/FILE=DATA10.
EXECUTE.


** PART 2: SETTING ALFA AND CONFIDENCE LEVEL, CHOOSING EFFECT SIZE MEASURE 
** AND RUNNIG META-ANALYSIS.

* Enter alfa for computing observed power (by default, AFFA = 0.05).
COMPUTE ALFA = 0.05.
EXECUTE.
SORT CASES BY STUDY(A).
IF (M1>=M2) DIRECT=1.
IF (M1<M2) DIRECT=-1.
SUMMARIZE/TABLES=STUDY DIRECT N1 N2 DF M1 M2 DIF SD1 SD2 SD_POOL T_OBS
/FORMAT=VALIDLIST NOCASENUM TOTAL/TITLE="Table 1 - User's data"/CELLS=NONE.
COMPUTE MOD_DF=MOD(DF,2).
IF (MOD_DF=0) N1=(DF/2)+1.
IF (MOD_DF=0) N2=N1.
IF (MOD_DF=1) N1=((DF+1)/2)+1.
IF (MOD_DF=1) N2=N1-1.
COMPUTE DF=(N1+N2)-2.
IF (M1<=0 OR M1>0) DIF=ABS(M1-M2).
COMPUTE SDX=(((N1-1)*(SD1**2))+((N2-1)*(SD2**2)))/(N1+N2-2).
IF (SD_POOL<=0 OR SD_POOL>0) SDX=SD_POOL**2.
IF (SDX<=0 OR SDX>0) T_OBS=DIF/SQR(SDX*((1/N1)+(1/N2))).
COMPUTE SD_POOL=SQR(SDX).
COMPUTE T_OBS=DIRECT*T_OBS.
COMPUTE DIF=DIRECT*DIF.
COMPUTE TABS=ABS(T_OBS).
COMPUTE P_TWO=(1-CDF.T(TABS,DF))*2.
COMPUTE P_ONE=1-CDF.T(TABS,DF).
COMPUTE D=T_OBS*SQR((1/N1)+(1/N2)).
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,DF).
COMPUTE POWER1=1-NCDF.T(T_ALPHA,DF,NCP).
COMPUTE POWER2=1-NCDF.T(T_ALPHA,DF,-NCP).
COMPUTE OPOWER=POWER1+POWER2.
COMPUTE R=T_OBS/SQR((T_OBS**2)+DF).
COMPUTE R2=R**2.
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.
FORMATS P_TWO P_ONE ALFA N_HARM NCP OPOWER D D_H R R2 BESD_LO BESD_UP(F8.4) 
U1 U2 U3(F8.1).
SUMMARIZE/TABLES=STUDY DIRECT N1 N2 DF M1 M2 DIF SD1 SD2 SD_POOL T_OBS
/FORMAT=VALIDLIST NOCASENUM TOTAL/TITLE="Table 2  Program imputations" 
/CELLS=NONE.
SUMMARIZE/TABLES=STUDY DIRECT DIF DF T_OBS P_TWO P_ONE ALFA N_HARM NCP 
OPOWER/FORMAT=VALIDLIST NOCASENUM TOTAL
/TITLE="TABLE 3  Individual T Tests and observed power"/CELLS=NONE.
SUMMARIZE/TABLES=STUDY DIRECT D D_H R R2 BESD_LO BESD_UP U1 U2 U3
/FORMAT=VALIDLIST NOCASENUM TOTAL
/TITLE="Table 4 - Measures of effect size and nonoverlap"/CELLS=NONE.
SUMMARIZE/TABLES=D D_H/FORMAT=NOLIST TOTAL/TITLE="Table 5 - Non weighted "
+"effect size  Descriptive statistics: Cohens d and Hedges' correction"
/CELLS=COUNT MIN MAX MEAN SEMEAN STDDEV.
SAVE OUTFILE=META_DATA.

* Choose the effect size measure (Cohen's d = 1; Hedges' correction = 2) 
* (by default, ES = 2).
COMPUTE ES = 2.
IF (ES=1) D=D.
IF (ES=2) D=D_H.
EXECUTE.
COMPUTE V=((N1+N2)/(N1*N2))+((D**2)/(2*(N1+N2))).
COMPUTE W=1/V.
COMPUTE WD=W*D.
COMPUTE WD2=W*D**2.
COMPUTE W2=W**2.
COMPUTE X=1.
EXECUTE.
SAVE OUTFILE=FOUTX.
AGGREGATE/OUTFILE=*/BREAK=X/SUM_W=SUM(W)/SUM_WD=SUM(WD)
/SUM_WD2=SUM(WD2)/SUM_W2=SUM(W2)/NSTUDIES=N.
COMPUTE K=NSTUDIES-1.
COMPUTE EF_SIZE=SUM_WD/SUM_W.
COMPUTE VARIANCE=1/SUM_W.
COMPUTE SE=SQR(1/SUM_W).
COMPUTE Z=ABS(EF_SIZE)/SE.
COMPUTE P_TWO=(1-CDF.NORMAL(Z,0,1))*2 .
COMPUTE P_ONE=1-CDF.NORMAL(Z,0,1).
EXECUTE.

* Enter confidence level for interval confidence (by default, CL=95%).
COMPUTE CL = 95.
COMPUTE ZCL=IDF.NORMAL((1-(((100-CL)/100)/2)),0,1).
COMPUTE CI_LOWER=EF_SIZE-ZCL*SE.
COMPUTE CI_UPPER=EF_SIZE+ZCL*SE.
COMPUTE Q=SUM_WD2-SUM_WD**2/SUM_W.
COMPUTE P_CHISQ = 1-CDF.CHISQ(Q,K).
COMPUTE V0 = (Q-K)/(SUM_W-SUM_W2/SUM_W) .
EXECUTE.
SAVE OUTFILE=FOUTY/KEEP=V0 X.
FORMATS ALL(F8.4) VARIANCE SE(F8.5) NSTUDIES CL K(F8.0).
SUMMARIZE/TABLES=NSTUDIES EF_SIZE VARIANCE SE Z P_TWO P_ONE CL CI_LOWER 
CI_UPPER/FORMAT=LIST NOCASENUM TOTAL /TITLE='Table 6  Fixed effects model:'
+' Weighted average effect size, z test, and confidence interval' 
/CELLS=NONE.
SUMMARIZE/TABLES=Q K P_CHISQ/FORMAT=LIST NOCASENUM TOTAL/TITLE=
'Table 7 - Chi-square test for homogeneity of effect size'/cells=none.
GET FILE=FOUTX.
MATCH FILES /FILE=*/TABLE=FOUTY/BY X.
EXECUTE.
COMPUTE V=V+V0.
COMPUTE W=1/V.
COMPUTE WD=W*D.
COMPUTE WD2=W*D**2.
COMPUTE W2=W**2.
EXECUTE.
FORMATS V0(F8.3).
SUMMARIZE/TABLES=v0/FORMAT=NOLIST TOTAL/TITLE='Table 8 - Random variance'
+' component'/CELLS=MEAN.
AGGREGATE/OUTFILE=*/BREAK=X/SUM_W=SUM(W)/SUM_WD=SUM(WD)
/SUM_WD2=SUM(WD2)/SUM_W2=SUM(W2)/NSTUDIES=N.
COMPUTE K=NSTUDIES-1.
COMPUTE EF_SIZE=SUM_WD / SUM_W.
COMPUTE VARIANCE=1/SUM_W.
COMPUTE SE=SQR(1/SUM_W).
COMPUTE Z=ABS(EF_SIZE)/SE.
COMPUTE P_TWO=(1-CDF.NORMAL(Z,0,1))*2 .
COMPUTE P_ONE=1-CDF.NORMAL(Z,0,1).
EXECUTE.

* Enter confidence level for interval confidence (by default, CL=95%).
COMPUTE CL = 95.
COMPUTE ZCL=IDF.NORMAL((1-(((100-CL)/100)/2)),0,1).
COMPUTE CI_LOWER=EF_SIZE-ZCL*SE.
COMPUTE CI_UPPER=EF_SIZE+ZCL*SE.
FORMATS ALL(F8.4) VARIANCE SE(F8.5) NSTUDIES CL K(F8.0).
SUMMARIZE/TABLES=NSTUDIES EF_SIZE VARIANCE SE Z P_TWO P_ONE CL CI_LOWER 
CI_UPPER/FORMAT=LIST NOCASENUM TOTAL /TITLE='Table 9  Random effects '
+'model: Weighted average effect size, z test, and confidence interval' 
/CELLS=NONE.
GET FILE=META_DATA/KEEP=STUDY DIRECT N1 N2 DF M1 M2 DIF SD1 SD2 
SD_POOL T_OBS P_TWO P_ONE ALFA N_HARM NCP OPOWER D D_H R R2 BESD_LO 
BESD_UP U1 U2 U3.

*** END OF THE SYNTAX.

****************************************************************************
** Note **
**
** Beginning in line:
**
** COMPUTE W=1/V.
**
** with effect sizes (D) and variances (V) from original sources, this 
** syntax was tested with data reported in Lipsey and Wilson (2001, p. 130, 
** Table 7.1) and Shadish and Haddock (1994, p. 267, Table 18.2).
**
** Imputations procedures and Individual T Tests were tested in SPSS, 
** comparing the results with outputs obtained from raw data examples.
**
** Power calculations are the same given by SamplePower (Borenstein et al.,
** 2001) and measures of effect size and nonoverlap were tested with 
** tabulated values and examples given by Cohen (1988) and Rosenthal et al. 
** (2000).
**
** Feel free to use and modify this syntax as you wish. In case you want to 
** refer it, the proper form is:
** 
** Alferes, V. R. (2003). Meta-analysis: Fixed and random effects models 
**    [SPSS Syntax File]. Retrieved [Date], from [URL]
****************************************************************************
** References **
**
** 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.
** Cortina, J. M., & Nouri, H. (2000). Effect sizes for ANOVA designs. 
**    Thousand Oaks, CA: Sage.
** Hedges, L. V., & Olkin, I. (1985). Statistical methods for meta-analysis.
**    Orlando, FL: Academic Press.
** Hunter, J. E., & Schmidt, F. L. (1990). Methods of meta-analysis:
**    Correcting error and bias in research findings. Newbury Park, CA: 
**    Sage.
** Lipsey, M. W., & Wilson, D. B. (2001). Pratical meta-analysis. Thousand 
**    Oaks, CA: Sage.
** Rosenthal, R., Rosnow, R. L, & Rubin, D. B. (2000). Contrasts and 
**    effect sizes in behavioral research: A correlational approach. 
**    Cambridge, UK: Cambridge University Press.
** Shadish, W. R., & Haddock, C. K. (1994). Combining estimates of effect
**    size. In H. Cooper and L. V. Hedges (Eds.), The handbook of research
**    synthesis (pp. 261-281). New York: Russell Sage Foundation.
***************************************************************************.