********************************************************************** *** Factorial ANOVA: Measures of Association, Effect Size and *** Observed Power *** Valentim R. Alferes (University of Coimbra, Portugal) *** valferes@fpce.uc.pt ** This syntax does an A*B Factorial ANOVA and calculates: ** - variance components; ** - measures of association (squared etas and partial squared ** etas; squared omegas and partial squared omegas); ** - measures of effect size (Cohen's f); ** - observed power. ** The user has two methods: Analysing raw data or reproducing ** the ANOVA Table from summary statistics in published articles. ********************************************************************** ** METHOD 1: Analysing raw data ** The data have to be in a SPSS active file with the following ** three numeric variables: ** A – Factor A or IV1; ** B – Factor B or IV2; ** DV – Dependent variable ** The following lines create an active file with an example ** from Keppel (1991, p. 214, Table 10-6). DATA LIST FREE /A(F8.0) B(F8.0) DV(F8.0). BEGIN DATA 1 1 1 1 1 4 1 1 0 1 1 7 2 1 13 2 1 5 2 1 7 2 1 15 3 1 9 3 1 16 3 1 18 3 1 13 1 2 15 1 2 6 1 2 10 1 2 13 2 2 6 2 2 18 2 2 9 2 2 15 3 2 14 3 2 7 3 2 6 3 2 13 END DATA. * Enter alpha for calculating power(by default, alpha = .05). UNIANOVA DV BY A B/PRINT=DESCRIPTIVE ETASQ OPOWER/CRITERIA=ALPHA(.05) /EMMEANS=TABLES(OVERALL)/EMMEANS=TABLES(A)/EMMEANS=TABLES(B) /EMMEANS=TABLES(A*B)/DESIGN=A B A*B. COMPUTE K=1. EXECUTE. AGGREGATE/OUTFILE=OUT_0/BREAK=K/M_G=MEAN(DV)/N_G=N. MATCH FILES/FILE=*/TABLE=OUT_0/BY K. EXECUTE. SORT CASES BY A(A) B(A). COMPUTE CELUL=A*100+B. EXECUTE. AUTORECODE VARIABLES=CELUL/INTO CELULA. AGGREGATE/OUTFILE=OUT_1/BREAK=CELULA/M_AB=MEAN(DV)/N_AB=N. MATCH FILES/FILE=*/TABLE=OUT_1/BY CELULA. EXECUTE. AGGREGATE/OUTFILE=OUT_2/BREAK=A/M_A=MEAN(DV)/N_A=N. MATCH FILES/FILE=*/TABLE=OUT_2/BY A. EXECUTE. SORT CASES BY B(A). AGGREGATE/OUTFILE=OUT_3/BREAK=B/M_B=MEAN(DV)/N_B=N. MATCH FILES/FILE=*/TABLE=OUT_3/BY B. EXECUTE. COMPUTE D2_A=(M_A-M_G)**2. COMPUTE D2_B=(M_B-M_G)**2. COMPUTE D2_ERRO=(DV-M_AB)**2. COMPUTE D2_G=(DV-M_G)**2. EXECUTE. AGGREGATE/OUTFILE=*/BREAK=K/N=MEAN(N_AB)/N_T_A=MAX(A) /N_T_B=MAX(B)/SS_A=SUM(D2_A)/SS_B=SUM(D2_B) /SS_ERRO=SUM(D2_ERRO)/SS_TOT=SUM(D2_G). COMPUTE SS_AB=SS_TOT-SS_A-SS_B-SS_ERRO. COMPUTE GL_A=N_T_A-1. COMPUTE GL_B=N_T_B-1. COMPUTE GL_AB=GL_A*GL_B. COMPUTE GL_ERRO=N*N_T_A*N_T_B-GL_A-GL_B-GL_AB-1. COMPUTE MS_A=SS_A/GL_A. COMPUTE MS_B=SS_B/GL_B. COMPUTE MS_AB=SS_AB/GL_AB. COMPUTE MS_ERRO=SS_ERRO/GL_ERRO. COMPUTE COMV_A=(GL_A*(MS_A-MS_ERRO))/(N_T_A*N_T_B*N). COMPUTE COMV_B=(GL_B*(MS_B-MS_ERRO))/(N_T_A*N_T_B*N). COMPUTE COMV_AB=(GL_AB*(MS_AB-MS_ERRO))/(N_T_A*N_T_B*N). COMPUTE COMV_ERR=MS_ERRO. COMPUTE COMV_TOT=SUM(COMV_A TO COMV_ERR). COMPUTE ETA_A=SS_A/SS_TOT. COMPUTE ETA_B=SS_B/SS_TOT. COMPUTE ETA_AB=SS_AB/SS_TOT. COMPUTE P_ETA_A=SS_A/(SS_A+SS_ERRO). COMPUTE P_ETA_B=SS_B/(SS_B+SS_ERRO). COMPUTE P_ETA_AB=SS_AB/(SS_AB+SS_ERRO). COMPUTE OME_A=COMV_A/COMV_TOT. COMPUTE OME_B=COMV_B/COMV_TOT. COMPUTE OME_AB=COMV_AB/COMV_TOT. COMPUTE P_OME_A=COMV_A/(COMV_A+COMV_ERR). COMPUTE P_OME_B=COMV_B/(COMV_B+COMV_ERR). COMPUTE P_OME_AB=COMV_AB/(COMV_AB+COMV_ERR). COMPUTE F_COH_A=SQR(P_OME_A/(1-P_OME_A)). COMPUTE F_COH_B=SQR(P_OME_B/(1-P_OME_B)). COMPUTE F_COH_AB=SQR(P_OME_AB/(1-P_OME_AB)). EXECUTE. FORMATS COMV_A TO F_COH_AB (F8.3). SUMMARIZE/TABLES=COMV_A COMV_B COMV_AB COMV_ERR/FORMAT=LIST NOCASENUM TOTAL/TITLE='Variance Components'/CELLS=NONE. SUMMARIZE/TABLES=ETA_A ETA_B ETA_AB/FORMAT=LIST NOCASENUM NOTOTAL/TITLE='Squared Eta'/CELLS=NONE. SUMMARIZE/TABLES=P_ETA_A P_ETA_B P_ETA_AB/FORMAT=LIST NOCASENUM NOTOTAL/TITLE='Parcial Squared Eta'/CELLS=NONE. SUMMARIZE/TABLES=OME_A OME_B OME_AB/FORMAT=LIST NOCASENUM NOTOTAL/TITLE='Squared Omega'/CELLS=NONE. SUMMARIZE/TABLES=P_OME_A P_OME_B P_OME_AB/FORMAT=LIST NOCASENUM NOTOTAL/TITLE='Partial Squared Omega'/CELLS=NONE. SUMMARIZE/TABLES=F_COH_A F_COH_B F_COH_AB/FORMAT=LIST NOCASENUM NOTOTAL/TITLE="Cohen's f"/CELLS=NONE. ********************************************************************** ** METHOD 2: Reproducing the ANOVA Table from summary statistics ** in published articles. * Enter, row by row, Factor A levels, Factor B levels, N and Mean * for the experimental conditions (in the example, the same as in * Method 1, you have a A3B2 Design). DATA LIST LIST /a(F8.0) b(F8.0) n(F8.0) m(f8.2). BEGIN DATA 1 1 4 3,00 1 2 4 11,00 2 1 4 10,00 2 2 4 12,00 3 1 4 14,00 3 2 4 10,00 END DATA. * Enter Mean Square Error. COMPUTE mse = 18.333333. COMPUTE iv=\$CASENUM. LOOP id=1 TO n. XSAVE OUTFILE=XOUT1. END LOOP. EXECUTE. GET FILE=XOUT1. COMPUTE dv=m. COMPUTE k=SQR((mse*(N-1))/2). IF (id=1) dv=m+k. IF (id=2) dv=m-k. EXECUTE. SUMMARIZE/TABLES=dv BY a BY b/FORMAT=NOLIST TOTAL /TITLE='Case Summaries'/CELLS=COUNT MEAN. * Enter alpha for calculating power(by default, alpha = .05). UNIANOVA DV BY A B/PRINT=DESCRIPTIVE ETASQ OPOWER/CRITERIA=ALPHA(.05) /DESIGN=A B A*B. COMPUTE K=1. EXECUTE. AGGREGATE/OUTFILE=OUT_0/BREAK=K/M_G=MEAN(DV)/N_G=N. MATCH FILES/FILE=*/TABLE=OUT_0/BY K. EXECUTE. SORT CASES BY A(A) B(A). COMPUTE CELUL=A*100+B. EXECUTE. AUTORECODE VARIABLES=CELUL/INTO CELULA. AGGREGATE/OUTFILE=OUT_1/BREAK=CELULA/M_AB=MEAN(DV)/N_AB=N. MATCH FILES/FILE=*/TABLE=OUT_1/BY CELULA. EXECUTE. AGGREGATE/OUTFILE=OUT_2/BREAK=A/M_A=MEAN(DV)/N_A=N. MATCH FILES/FILE=*/TABLE=OUT_2/BY A. EXECUTE. SORT CASES BY B(A). AGGREGATE/OUTFILE=OUT_3/BREAK=B/M_B=MEAN(DV)/N_B=N. MATCH FILES/FILE=*/TABLE=OUT_3/BY B. EXECUTE. COMPUTE D2_A=(M_A-M_G)**2. COMPUTE D2_B=(M_B-M_G)**2. COMPUTE D2_ERRO=(DV-M_AB)**2. COMPUTE D2_G=(DV-M_G)**2. EXECUTE. AGGREGATE/OUTFILE=*/BREAK=K/N=MEAN(N_AB)/N_T_A=MAX(A) /N_T_B=MAX(B)/SS_A=SUM(D2_A)/SS_B=SUM(D2_B) /SS_ERRO=SUM(D2_ERRO)/SS_TOT=SUM(D2_G). COMPUTE SS_AB=SS_TOT-SS_A-SS_B-SS_ERRO. COMPUTE GL_A=N_T_A-1. COMPUTE GL_B=N_T_B-1. COMPUTE GL_AB=GL_A*GL_B. COMPUTE GL_ERRO=N*N_T_A*N_T_B-GL_A-GL_B-GL_AB-1. COMPUTE MS_A=SS_A/GL_A. COMPUTE MS_B=SS_B/GL_B. COMPUTE MS_AB=SS_AB/GL_AB. COMPUTE MS_ERRO=SS_ERRO/GL_ERRO. COMPUTE COMV_A=(GL_A*(MS_A-MS_ERRO))/(N_T_A*N_T_B*N). COMPUTE COMV_B=(GL_B*(MS_B-MS_ERRO))/(N_T_A*N_T_B*N). COMPUTE COMV_AB=(GL_AB*(MS_AB-MS_ERRO))/(N_T_A*N_T_B*N). COMPUTE COMV_ERR=MS_ERRO. COMPUTE COMV_TOT=SUM(COMV_A TO COMV_ERR). COMPUTE ETA_A=SS_A/SS_TOT. COMPUTE ETA_B=SS_B/SS_TOT. COMPUTE ETA_AB=SS_AB/SS_TOT. COMPUTE P_ETA_A=SS_A/(SS_A+SS_ERRO). COMPUTE P_ETA_B=SS_B/(SS_B+SS_ERRO). COMPUTE P_ETA_AB=SS_AB/(SS_AB+SS_ERRO). COMPUTE OME_A=COMV_A/COMV_TOT. COMPUTE OME_B=COMV_B/COMV_TOT. COMPUTE OME_AB=COMV_AB/COMV_TOT. COMPUTE P_OME_A=COMV_A/(COMV_A+COMV_ERR). COMPUTE P_OME_B=COMV_B/(COMV_B+COMV_ERR). COMPUTE P_OME_AB=COMV_AB/(COMV_AB+COMV_ERR). COMPUTE F_COH_A=SQR(P_OME_A/(1-P_OME_A)). COMPUTE F_COH_B=SQR(P_OME_B/(1-P_OME_B)). COMPUTE F_COH_AB=SQR(P_OME_AB/(1-P_OME_AB)). EXECUTE. FORMATS COMV_A TO F_COH_AB (F8.3). SUMMARIZE/TABLES=COMV_A COMV_B COMV_AB COMV_ERR/FORMAT=LIST NOCASENUM TOTAL/TITLE='Variance Components'/CELLS=NONE. SUMMARIZE/TABLES=ETA_A ETA_B ETA_AB/FORMAT=LIST NOCASENUM NOTOTAL/TITLE='Squared Eta'/CELLS=NONE. SUMMARIZE/TABLES=P_ETA_A P_ETA_B P_ETA_AB/FORMAT=LIST NOCASENUM NOTOTAL/TITLE='Parcial Squared Eta'/CELLS=NONE. SUMMARIZE/TABLES=OME_A OME_B OME_AB/FORMAT=LIST NOCASENUM NOTOTAL/TITLE='Squared Omega'/CELLS=NONE. SUMMARIZE/TABLES=P_OME_A P_OME_B P_OME_AB/FORMAT=LIST NOCASENUM NOTOTAL/TITLE='Partial Squared Omega'/CELLS=NONE. SUMMARIZE/TABLES=F_COH_A F_COH_B F_COH_AB/FORMAT=LIST NOCASENUM NOTOTAL/TITLE="Cohen's f"/CELLS=NONE. ********************************************************************** Keppel, G. (1991). Design and analysis: A researcher's handbook (3rd ed.). Upper Saddle River, NJ: Prentice Hall. **********************************************************************