Dear SPSS-L, As always, I try to share with the list interesting statistical methods I come across from time to time that can be implemented in SPSS. While reading the latest (3rd) edition of "Research Design and Statistical Analysis" by Myers, Well and Lorch, I stumbled upon a discussion about constructing a confidence interval about the difference between two R^2s. I located the referenced article to figure out exactly how to construct the confidence interval. Similar to the Vuong test I posted the other day, the response variable must be the same and the same cases must be used.
Here is the reference: Alf, E. F. Jr. & Graf, R. G. (1999). Asymptotic confidence limits for the difference between two squared multiple correlations: A simplified approach. Psychological Methods, 4, 70-75.
Note that this confidence interval construction allows for scenarios where there is some overlap or no overlap whatsoever with respect to predictors across the OLS linear regression models.
While the mathematics used in building the confidence interval is intriguing, I would recommend caution in implementing this approach. There are a couple of scenarios in which I would argue that it would be valid to use this approach, but in general I would recommend caution.
At any rate, the point of this post is to show how to construct the interval in SPSS. Note that this simulated example produces a confidence interval about the differences between two R^2s for a completely non-overlapping scenario (4 predictors entered simultaneously into one model and 4 different predictors entered simultaneously into the other model; note that each of the predictors ~ N(0,1).
As always, comments and/or questions are welcome. Of course, if somebody finds an error, then please do let SPSS-L know. Even though I double and triple check my code, it is always possible that I have made an error.
Best, Ryan p.s. As with the Vuong demonstration, I adapted the simulation code from code provided on the IBM website. The rest is my doing, for better or worse. :-) -- /*--------------------------*/ /*---Generate data---*/ /*--------------------------*/. set seed 9875394. input program. loop ID=1 to 1000. compute x1 = rv.norm(0,1). compute x2 = rv.norm(0,1). compute x3 = rv.norm(0,1). compute x4 = rv.norm(0,1). compute x5 = rv.norm(0,1). compute x6 = rv.norm(0,1). compute x7 = rv.norm(0,1). compute x8 = rv.norm(0,1). compute x9 = rv.norm(0,1). end case. end loop. end file. end input program. execute. matrix.
get x / variables=x1 to x9. compute cor={1.000,0.441,0.301,0.400,0.200,0.150,0.225,0.125,0.135; 0.441,1.000,0.001,0.001,0.001,0.001,0.001,0.001,0.001; 0.301,0.001,1.000,0.001,0.001,0.001,0.001,0.001,0.001; 0.400,0.001,0.001,1.000,0.001,0.001,0.001,0.001,0.001; 0.200,0.001,0.001,0.001,1.000,0.001,0.001,0.001,0.001; 0.150,0.001,0.001,0.001,0.001,1.000,0.001,0.001,0.001; 0.225,0.001,0.001,0.001,0.001,0.001,1.000,0.001,0.001; 0.125,0.001,0.001,0.001,0.001,0.001,0.001,1.000,0.001; 0.135,0.001,0.001,0.001,0.001,0.001,0.001,0.001,1.000}. print cor /format=f5.3.
compute deter=det(cor). print deter / title "determinant of corr matrix" / format=f10.7 . print sval(cor) / title "singular value decomposition of corr". print eval(cor) / title "eigenvalues of input corr". compute condnum=mmax(sval(cor))/mmin(sval(cor)). print condnum / title "condition number of corr matrix" / format=f10.2 . compute cho=chol(cor). print cho / title "cholesky factor of corr matrix" . compute chochek=t(cho)*cho. print chochek / title "chol factor premult by its transpose " /format=f10.3 . compute newx=x*cho. save newx /outfile=* /variables= x1 to X9. end matrix. RENAME VARIABLES (x1 x2 x3 x4 x5 x6 x7 x8 x9= y x1 x2 x3 x4 x5 x6 x7 x8).
DATASET NAME original_data_file. EXAMINE VARIABLES=x1 x2 x3 x4 x5 x6 x7 x8 y /PLOT HISTOGRAM /STATISTICS NONE. /*--------------------------------------------------------------------------*/ /*---Calculate Pearson correlations for x1 through y---*/ /*--------------------------------------------------------------------------*/. CORRELATIONS /VARIABLES=x1 x2 x3 x4 x5 x6 x7 x8 y /PRINT=TWOTAIL NOSIG /MISSING=PAIRWISE /MATRIX=OUT(*). FILTER OFF. USE ALL. SELECT IF (ROWTYPE_ = 'CORR'). EXECUTE. DELETE VARIABLES VARNAME_. /*---------------------------------------------------------------------------------------------------*/ /*-----------Convert each element of correlation matrix into a variable------*/ /*---------------------------------------------------------------------------------------------------*/. COMPUTE idx=$CASENUM. VECTOR x=x1 TO y /n(81F8.4). LOOP cnt=1 TO 9. COMPUTE n((idx-1)*9+cnt)=x(cnt). END LOOP. COMPUTE nobreak=1. * Collapse all 9 cases into one line. AGGREGATE
/OUTFILE=* /BREAK=nobreak /n1 TO n81 = MAX(n1 TO n81). RENAME VARIABLES (n1 to n81 = r11 r12 r13 r14 r15 r16 r17 r18 r19
r21 r22 r23 r24 r25 r26 r27 r28 r29 r31 r32 r33 r34 r35 r36 r37 r38 r39 r41 r42 r43 r44 r45 r46 r47 r48 r49 r51 r52 r53 r54 r55 r56 r57 r58 r59 r61 r62 r63 r64 r65 r66 r67 r68 r69 r71 r72 r73 r74 r75 r76 r77 r78 r79 r81 r82 r83 r84 r85 r86 r87 r88 r89 r91 r92 r93 r94 r95 r96 r97 r98 r99). DELETE VARIABLES nobreak. DATASET NAME correlation_data_file. DATASET ACTIVATE original_data_file. /*-----------------------------------------*/ /*---Standardize all variables---*/ /*-----------------------------------------*/. DESCRIPTIVES VARIABLES=x1 x2 x3 x4 x5 x6 x7 x8 y /SAVE. /*------------------------------------------------------------------------------------------------------------------------------------*/ /*-Run multiple regression analysis with Zx1, Zx2, Zx3, and Zx4 as predictors and Zy and DV-*/ /*------------------------------------------------------------------------------------------------------------------------------------*/. DATASET DECLARE Model1_Standardized_Coefficients. REGRESSION /MISSING LISTWISE /STATISTICS COEFF OUTS R ANOVA /CRITERIA=PIN(.05) POUT(.10) /NOORIGIN /DEPENDENT Zy /METHOD=ENTER Zx1 Zx2 Zx3 Zx4 /OUTFILE=COVB(Model1_Standardized_Coefficients). DATASET ACTIVATE Model1_Standardized_Coefficients. /*---------------------------------------------------------------------------------------*/ /*---Only keep standardized regression coefficients (BETAs)---*/ /*---------------------------------------------------------------------------------------*/. FILTER OFF. USE ALL. SELECT IF (ROWTYPE_ = 'EST'). EXECUTE. compute Model1_Beta1 = 0. compute Model1_Beta2 = 0. compute Model1_Beta3 = 0. compute Model1_Beta4 = 0. compute Model1_Beta5 = 0. compute Model1_Beta6 = 0. compute Model1_Beta7 = 0. compute Model1_Beta8 = 0. compute Model1_Beta1 = Zx1. compute Model1_Beta2 = Zx2. compute Model1_Beta3 = Zx3. compute Model1_Beta4 = Zx4. *compute Model1_Beta5 = Zx5. *compute Model1_Beta6 = Zx6. *compute Model1_Beta7 = Zx7. *compute Model1_Beta8 = Zx8. execute. DELETE VARIABLES DEPVAR_ ROWTYPE_ VARNAME_ CONST_ Zx1 Zx2 Zx3 Zx4. *DELETE VARIABLES Zx5 Zx6 Zx7 Zx8. DATASET ACTIVATE original_data_file. /*----------------------------------------------------------------------------------------------------------------------------------------*/ /*---Run multiple regression analysis with Zx5, Zx6, Zx7, and Zx8 as predictors and Zy and DV---*/ /*----------------------------------------------------------------------------------------------------------------------------------------*/. DATASET DECLARE Model2_Standardized_Coefficients. REGRESSION /MISSING LISTWISE /STATISTICS COEFF OUTS R ANOVA /CRITERIA=PIN(.05) POUT(.10) /NOORIGIN /DEPENDENT Zy /METHOD=ENTER Zx5 Zx6 Zx7 Zx8 /OUTFILE=COVB(Model2_Standardized_Coefficients). /*---------------------------------------------------------------------------------------*/
/*---Only keep standardized regression coefficients (BETAs)---*/ /*---------------------------------------------------------------------------------------*/. DATASET ACTIVATE Model2_Standardized_Coefficients. FILTER OFF. USE ALL. SELECT IF (ROWTYPE_ = 'EST'). EXECUTE. compute Model2_Beta1 = 0.
compute Model2_Beta2 = 0. compute Model2_Beta3 = 0. compute Model2_Beta4 = 0. compute Model2_Beta5 = 0. compute Model2_Beta6 = 0. compute Model2_Beta7 = 0. compute Model2_Beta8 = 0. *compute Model2_Beta1 = Zx1. *compute Model2_Beta2 = Zx2. *compute Model2_Beta3 = Zx3. *compute Model2_Beta4 = Zx4. compute Model2_Beta5 = Zx5. compute Model2_Beta6 = Zx6. compute Model2_Beta7 = Zx7. compute Model2_Beta8 = Zx8. execute. DELETE VARIABLES DEPVAR_ ROWTYPE_ VARNAME_ CONST_ Zx5 Zx6 Zx7 Zx8. *DELETE VARIABLES (Zx1 Zx2 Zx3 Zx4). MATCH FILES /FILE=* /FILE='Model1_Standardized_Coefficients'. EXECUTE. MATCH FILES /FILE=* /FILE='correlation_data_file'. EXECUTE. DATASET CLOSE original_data_file.
DATASET CLOSE Model1_Standardized_Coefficients. DATASET CLOSE correlation_data_file. /*------------------------------------------*/ /*---Specify Sample Size (N)---*/ /*------------------------------------------*/. compute N = 1000. execute. /*-------------------------------------------------------------------------------*/ /*---Calculate multiple R and R-squared for each model---*/ /*-------------------------------------------------------------------------------*/. compute Model1_R = sqrt(sum(r19*Model1_Beta1, r29*Model1_Beta2, r39*Model1_Beta3, r49*Model1_Beta4, r59*Model1_Beta5, r69*Model1_Beta6, r79*Model1_Beta7, r89*Model1_Beta8)). compute Model2_R = sqrt(sum(r19*Model2_Beta1, r29*Model2_Beta2, r39*Model2_Beta3, r49*Model2_Beta4, r59*Model2_Beta5, r69*Model2_Beta6, r79*Model2_Beta7, r89*Model2_Beta8)). compute Model1_R_squared = Model1_R**2. compute Model2_R_squared = Model2_R**2. execute. /*-------------------------------------------------------*/ /*---Calculate difference in multiple Rs---*/ /*-------------------------------------------------------*/. compute R_squared_diff = Model1_R**2 - Model2_R**2. execute. /*--------------------------------*/ /*---Calculate variance---*/ /*--------------------------------*/. compute R_AB = (Model1_Beta1 * (r11 * Model2_Beta1 + r12 * Model2_Beta2 + r13 * Model2_Beta3 + r14 * Model2_Beta4 + r15 * Model2_Beta5 + r16 * Model2_Beta6 + r17 * Model2_Beta7 + r18 * Model2_Beta8) + Model1_Beta2 * (r21 * Model2_Beta1 + r22 * Model2_Beta2 + r23 * Model2_Beta3 + r24 * Model2_Beta4 + r25 * Model2_Beta5 + r26 * Model2_Beta6 + r27 * Model2_Beta7 + r28 * Model2_Beta8) + Model1_Beta3 * (r31 * Model2_Beta1 + r32 * Model2_Beta2 + r33 * Model2_Beta3 + r34 * Model2_Beta4 + r35 * Model2_Beta5 + r36 * Model2_Beta6 + r37 * Model2_Beta7 + r38 * Model2_Beta8) + Model1_Beta4 * (r41 * Model2_Beta1 + r42 * Model2_Beta2 + r43 * Model2_Beta3 + r44 * Model2_Beta4 + r45 * Model2_Beta5 + r46 * Model2_Beta6 + r47 * Model2_Beta7 + r48 * Model2_Beta8) + Model1_Beta5 * (r51 * Model2_Beta1 + r52 * Model2_Beta2 + r53 * Model2_Beta3 + r54 * Model2_Beta4 + r55 * Model2_Beta5 + r56 * Model2_Beta6 + r57 * Model2_Beta7 + r58 * Model2_Beta8) + Model1_Beta6 * (r61 * Model2_Beta1 + r62 * Model2_Beta2 + r63 * Model2_Beta3 + r64 * Model2_Beta4 + r65 * Model2_Beta5 + r66 * Model2_Beta6 + r67 * Model2_Beta7 + r68 * Model2_Beta8) + Model1_Beta7 * (r71 * Model2_Beta1 + r72 * Model2_Beta2 + r73 * Model2_Beta3 + r74 * Model2_Beta4 + r75 * Model2_Beta5 + r76 * Model2_Beta6 + r77 * Model2_Beta7 + r78 * Model2_Beta8) + Model1_Beta8 * (r81 * Model2_Beta1 + r82 * Model2_Beta2 + r83 * Model2_Beta3 + r84 * Model2_Beta4 + r85 * Model2_Beta5 + r86 * Model2_Beta6 + r87 * Model2_Beta7 + r88 * Model2_Beta8)) / (Model1_R * Model2_R). execute. compute Var = (4 * (Model1_R_squared) * ((1 - Model1_R_squared)**2) + 4 * (Model2_R_squared) * ((1 - Model2_R_squared)**2) - (8 * Model1_R * Model2_R) * (0.5 * (2 * R_AB - Model1_R * Model2_R) * (1 - Model1_R_squared- Model2_R_squared - R_AB**2)) + R_AB**3) / N. execute. /*-------------------------------------------------*/ /*---Specify % Confidence Interval---*/ /*-------------------------------------------------*/. compute percent_CI = .95. execute. /*-------------------------------------------------------------------------------------------------*/ /*---Calculate 95% confidence limits about difference in multiple Rs---*/ /*-------------------------------------------------------------------------------------------------*/. compute LL = R_squared_diff - IDF.NORMAL(((1-(1-percent_CI)/2)),0,1) * sqrt(Var*(Model1_R_squared - Model2_R_squared)). compute UL = R_squared_diff + IDF.NORMAL(((1-(1-percent_CI)/2)),0,1) * sqrt(Var*(Model1_R_squared - Model2_R_squared)). execute. delete variables Model2_Beta1 to r99 R_AB Var. |
Administrator
|
Hi Ryan. I don't have time to study this right now, but the fact that you're looking at a confidence interval for the difference between two R-squared values reminded me of this article:
Zou, G. Y. (2007). Toward using confidence intervals to compare correlations. Psychological Methods, 12, 399–413. It includes a method for comparing two independent R-squared values. The reference list also includes the Alf & Graf article you mention below. So it may be of interest to you. Cheers, Bruce
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Familiar with both, but thanks for mentioning Zou's approach in this thread, as that would reflect a related scenario that I did not address: testing for a sig difference in R^2s between independent samples. Similar to the Alf and Graf, I would only use this approach under certain conditions. No time to elaborate.
Ryan On Apr 27, 2013, at 1:21 PM, Bruce Weaver <[hidden email]> wrote: > Hi Ryan. I don't have time to study this right now, but the fact that you're > looking at a confidence interval for the difference between two R-squared > values reminded me of this article: > > Zou, G. Y. (2007). Toward using confidence intervals to compare > correlations. Psychological Methods, 12, 399–413. > > It includes a method for comparing two independent R-squared values. The > reference list also includes the Alf & Graf article you mention below. So > it may be of interest to you. > > Cheers, > Bruce > > > > Subscribe SAS-L Anonymous-2 wrote >> Dear SPSS-L, >> >> >> >> As always, I try to share with the list interesting statistical methods I >> come across from time to time that can be implemented in SPSS. While >> reading the latest (3rd) edition of "Research Design and Statistical >> Analysis" by Myers, Well and Lorch, I stumbled upon a discussion about >> constructing a confidence interval about the difference between two R^2s. >> I >> located the referenced article to figure out exactly how to construct the >> confidence interval. Similar to the Vuong test I posted the other day, the >> response variable must be the same and the same cases must be used. >> >> >> >> Here is the reference: >> >> Alf, E. F. Jr. & Graf, R. G. (1999). Asymptotic confidence limits for the >> difference between two squared multiple correlations: A simplified >> approach. Psychological Methods, 4, 70-75. >> >> Note that this confidence interval construction allows for scenarios where >> there is some overlap or no overlap whatsoever with respect to predictors >> across the OLS linear regression models. >> >> While the mathematics used in building the confidence interval is >> intriguing, I would recommend caution in implementing this approach. >> There are a couple of scenarios in which I would argue that it would be >> valid to use this approach, but in general I would recommend caution. >> >> >> At any rate, the point of this post is to show how to construct the >> interval in SPSS. Note that this simulated example produces a confidence >> interval about the differences between two R^2s for a completely >> non-overlapping scenario (4 predictors entered simultaneously into one >> model and 4 different predictors entered simultaneously into the other >> model; note that each of the predictors ~ N(0,1). >> >> As always, comments and/or questions are welcome. Of course, if somebody >> finds an error, then please do let SPSS-L know. Even though I double and >> triple check my code, it is always possible that I have made an error. >> >> >> >> Best, >> >> >> >> Ryan >> >> p.s. As with the Vuong demonstration, I adapted the simulation code from >> code provided on the IBM website. The rest is my doing, for better or >> worse. :-) >> >> -- >> >> /*--------------------------*/ >> /*---Generate data---*/ >> /*--------------------------*/. >> set seed 9875394. >> input program. >> loop ID=1 to 1000. >> compute x1 = rv.norm(0,1). >> compute x2 = rv.norm(0,1). >> compute x3 = rv.norm(0,1). >> compute x4 = rv.norm(0,1). >> compute x5 = rv.norm(0,1). >> compute x6 = rv.norm(0,1). >> compute x7 = rv.norm(0,1). >> compute x8 = rv.norm(0,1). >> compute x9 = rv.norm(0,1). >> end case. >> end loop. >> end file. >> end input program. >> execute. >> matrix. >> get x / variables=x1 to x9. >> compute cor={1.000,0.441,0.301,0.400,0.200,0.150,0.225,0.125,0.135; >> >> 0.441,1.000,0.001,0.001,0.001,0.001,0.001,0.001,0.001; >> >> 0.301,0.001,1.000,0.001,0.001,0.001,0.001,0.001,0.001; >> >> 0.400,0.001,0.001,1.000,0.001,0.001,0.001,0.001,0.001; >> >> 0.200,0.001,0.001,0.001,1.000,0.001,0.001,0.001,0.001; >> >> 0.150,0.001,0.001,0.001,0.001,1.000,0.001,0.001,0.001; >> >> 0.225,0.001,0.001,0.001,0.001,0.001,1.000,0.001,0.001; >> >> 0.125,0.001,0.001,0.001,0.001,0.001,0.001,1.000,0.001; >> >> 0.135,0.001,0.001,0.001,0.001,0.001,0.001,0.001,1.000}. >> print cor /format=f5.3. >> compute deter=det(cor). >> print deter / title "determinant of corr matrix" / format=f10.7 . >> print sval(cor) / title "singular value decomposition of corr". >> print eval(cor) / title "eigenvalues of input corr". >> compute condnum=mmax(sval(cor))/mmin(sval(cor)). >> print condnum / title "condition number of corr matrix" / format=f10.2 . >> compute cho=chol(cor). >> print cho / title "cholesky factor of corr matrix" . >> compute chochek=t(cho)*cho. >> print chochek / title "chol factor premult by its transpose " >> /format=f10.3 >> . >> compute newx=x*cho. >> save newx /outfile=* /variables= x1 to X9. >> end matrix. >> RENAME VARIABLES (x1 x2 x3 x4 x5 x6 x7 x8 x9= y x1 x2 x3 x4 x5 x6 x7 x8). >> DATASET NAME original_data_file. >> EXAMINE VARIABLES=x1 x2 x3 x4 x5 x6 x7 x8 y >> /PLOT HISTOGRAM >> /STATISTICS NONE. >> /*--------------------------------------------------------------------------*/ >> /*---Calculate Pearson correlations for x1 through y---*/ >> /*--------------------------------------------------------------------------*/. >> CORRELATIONS >> /VARIABLES=x1 x2 x3 x4 x5 x6 x7 x8 y >> /PRINT=TWOTAIL NOSIG >> /MISSING=PAIRWISE >> /MATRIX=OUT(*). >> FILTER OFF. >> USE ALL. >> SELECT IF (ROWTYPE_ = 'CORR'). >> EXECUTE. >> DELETE VARIABLES VARNAME_. >> /*---------------------------------------------------------------------------------------------------*/ >> /*-----------Convert each element of correlation matrix into a >> variable------*/ >> /*---------------------------------------------------------------------------------------------------*/. >> COMPUTE idx=$CASENUM. >> VECTOR x=x1 TO y /n(81F8.4). >> LOOP cnt=1 TO 9. >> COMPUTE n((idx-1)*9+cnt)=x(cnt). >> END LOOP. >> COMPUTE nobreak=1. >> * Collapse all 9 cases into one line. >> AGGREGATE >> /OUTFILE=* >> /BREAK=nobreak >> /n1 TO n81 = MAX(n1 TO n81). >> RENAME VARIABLES (n1 to n81 = r11 r12 r13 r14 r15 r16 r17 r18 r19 >> r21 r22 r23 r24 r25 >> r26 r27 r28 r29 >> r31 r32 r33 r34 r35 >> r36 r37 r38 r39 >> r41 r42 r43 r44 r45 >> r46 r47 r48 r49 >> r51 r52 r53 r54 r55 >> r56 r57 r58 r59 >> r61 r62 r63 r64 r65 >> r66 r67 r68 r69 >> r71 r72 r73 r74 r75 >> r76 r77 r78 r79 >> r81 r82 r83 r84 r85 >> r86 r87 r88 r89 >> r91 r92 r93 r94 r95 >> r96 r97 r98 r99). >> DELETE VARIABLES nobreak. >> DATASET NAME correlation_data_file. >> DATASET ACTIVATE original_data_file. >> /*-----------------------------------------*/ >> /*---Standardize all variables---*/ >> /*-----------------------------------------*/. >> DESCRIPTIVES VARIABLES=x1 x2 x3 x4 x5 x6 x7 x8 y >> /SAVE. >> /*------------------------------------------------------------------------------------------------------------------------------------*/ >> /*-Run multiple regression analysis with Zx1, Zx2, Zx3, and Zx4 as >> predictors and Zy and DV-*/ >> /*------------------------------------------------------------------------------------------------------------------------------------*/. >> DATASET DECLARE Model1_Standardized_Coefficients. >> REGRESSION >> /MISSING LISTWISE >> /STATISTICS COEFF OUTS R ANOVA >> /CRITERIA=PIN(.05) POUT(.10) >> /NOORIGIN >> /DEPENDENT Zy >> /METHOD=ENTER Zx1 Zx2 Zx3 Zx4 >> /OUTFILE=COVB(Model1_Standardized_Coefficients). >> DATASET ACTIVATE Model1_Standardized_Coefficients. >> /*---------------------------------------------------------------------------------------*/ >> /*---Only keep standardized regression coefficients (BETAs)---*/ >> /*---------------------------------------------------------------------------------------*/. >> FILTER OFF. >> USE ALL. >> SELECT IF (ROWTYPE_ = 'EST'). >> EXECUTE. >> compute Model1_Beta1 = 0. >> compute Model1_Beta2 = 0. >> compute Model1_Beta3 = 0. >> compute Model1_Beta4 = 0. >> compute Model1_Beta5 = 0. >> compute Model1_Beta6 = 0. >> compute Model1_Beta7 = 0. >> compute Model1_Beta8 = 0. >> compute Model1_Beta1 = Zx1. >> compute Model1_Beta2 = Zx2. >> compute Model1_Beta3 = Zx3. >> compute Model1_Beta4 = Zx4. >> *compute Model1_Beta5 = Zx5. >> *compute Model1_Beta6 = Zx6. >> *compute Model1_Beta7 = Zx7. >> *compute Model1_Beta8 = Zx8. >> execute. >> DELETE VARIABLES DEPVAR_ ROWTYPE_ VARNAME_ CONST_ Zx1 Zx2 Zx3 Zx4. >> *DELETE VARIABLES Zx5 Zx6 Zx7 Zx8. >> DATASET ACTIVATE original_data_file. >> /*----------------------------------------------------------------------------------------------------------------------------------------*/ >> /*---Run multiple regression analysis with Zx5, Zx6, Zx7, and Zx8 as >> predictors and Zy and DV---*/ >> /*----------------------------------------------------------------------------------------------------------------------------------------*/. >> DATASET DECLARE Model2_Standardized_Coefficients. >> REGRESSION >> /MISSING LISTWISE >> /STATISTICS COEFF OUTS R ANOVA >> /CRITERIA=PIN(.05) POUT(.10) >> /NOORIGIN >> /DEPENDENT Zy >> /METHOD=ENTER Zx5 Zx6 Zx7 Zx8 >> /OUTFILE=COVB(Model2_Standardized_Coefficients). >> /*---------------------------------------------------------------------------------------*/ >> /*---Only keep standardized regression coefficients (BETAs)---*/ >> /*---------------------------------------------------------------------------------------*/. >> DATASET ACTIVATE Model2_Standardized_Coefficients. >> FILTER OFF. >> USE ALL. >> SELECT IF (ROWTYPE_ = 'EST'). >> EXECUTE. >> compute Model2_Beta1 = 0. >> compute Model2_Beta2 = 0. >> compute Model2_Beta3 = 0. >> compute Model2_Beta4 = 0. >> compute Model2_Beta5 = 0. >> compute Model2_Beta6 = 0. >> compute Model2_Beta7 = 0. >> compute Model2_Beta8 = 0. >> *compute Model2_Beta1 = Zx1. >> *compute Model2_Beta2 = Zx2. >> *compute Model2_Beta3 = Zx3. >> *compute Model2_Beta4 = Zx4. >> compute Model2_Beta5 = Zx5. >> compute Model2_Beta6 = Zx6. >> compute Model2_Beta7 = Zx7. >> compute Model2_Beta8 = Zx8. >> execute. >> DELETE VARIABLES DEPVAR_ ROWTYPE_ VARNAME_ CONST_ Zx5 Zx6 Zx7 Zx8. >> *DELETE VARIABLES (Zx1 Zx2 Zx3 Zx4). >> MATCH FILES /FILE=* >> /FILE='Model1_Standardized_Coefficients'. >> EXECUTE. >> MATCH FILES /FILE=* >> /FILE='correlation_data_file'. >> EXECUTE. >> DATASET CLOSE original_data_file. >> DATASET CLOSE Model1_Standardized_Coefficients. >> DATASET CLOSE correlation_data_file. >> /*------------------------------------------*/ >> /*---Specify Sample Size (N)---*/ >> /*------------------------------------------*/. >> compute N = 1000. >> execute. >> /*-------------------------------------------------------------------------------*/ >> /*---Calculate multiple R and R-squared for each model---*/ >> /*-------------------------------------------------------------------------------*/. >> compute Model1_R = sqrt(sum(r19*Model1_Beta1, r29*Model1_Beta2, >> r39*Model1_Beta3, r49*Model1_Beta4, r59*Model1_Beta5, r69*Model1_Beta6, >> r79*Model1_Beta7, r89*Model1_Beta8)). >> compute Model2_R = sqrt(sum(r19*Model2_Beta1, r29*Model2_Beta2, >> r39*Model2_Beta3, r49*Model2_Beta4, r59*Model2_Beta5, r69*Model2_Beta6, >> r79*Model2_Beta7, r89*Model2_Beta8)). >> compute Model1_R_squared = Model1_R**2. >> compute Model2_R_squared = Model2_R**2. >> execute. >> /*-------------------------------------------------------*/ >> /*---Calculate difference in multiple Rs---*/ >> /*-------------------------------------------------------*/. >> compute R_squared_diff = Model1_R**2 - Model2_R**2. >> execute. >> /*--------------------------------*/ >> /*---Calculate variance---*/ >> /*--------------------------------*/. >> compute R_AB = (Model1_Beta1 * (r11 * Model2_Beta1 + r12 * Model2_Beta2 >> + >> r13 * Model2_Beta3 + r14 * Model2_Beta4 + >> r15 * Model2_Beta5 >> + >> r16 * Model2_Beta6 + r17 * Model2_Beta7 + r18 * Model2_Beta8) + >> Model1_Beta2 * (r21 * Model2_Beta1 + r22 * >> Model2_Beta2 + r23 * Model2_Beta3 + r24 * Model2_Beta4 + >> r25 * Model2_Beta5 >> + >> r26 * Model2_Beta6 + r27 * Model2_Beta7 + r28 * Model2_Beta8) >> + >> Model1_Beta3 * (r31 * Model2_Beta1 + r32 * >> Model2_Beta2 + r33 * Model2_Beta3 + r34 * Model2_Beta4 + >> r35 * Model2_Beta5 >> + >> r36 * Model2_Beta6 + r37 * Model2_Beta7 + r38 * Model2_Beta8) + >> Model1_Beta4 * (r41 * Model2_Beta1 + r42 * >> Model2_Beta2 + r43 * Model2_Beta3 + r44 * Model2_Beta4 + >> r45 * Model2_Beta5 >> + >> r46 * Model2_Beta6 + r47 * Model2_Beta7 + r48 * Model2_Beta8) + >> Model1_Beta5 * (r51 * Model2_Beta1 + r52 * >> Model2_Beta2 + r53 * Model2_Beta3 + r54 * Model2_Beta4 + >> r55 * Model2_Beta5 >> + >> r56 * Model2_Beta6 + r57 * Model2_Beta7 + r58 * Model2_Beta8) + >> Model1_Beta6 * (r61 * Model2_Beta1 + r62 * >> Model2_Beta2 + r63 * Model2_Beta3 + r64 * Model2_Beta4 + >> r65 * Model2_Beta5 >> + >> r66 * Model2_Beta6 + r67 * Model2_Beta7 + r68 * Model2_Beta8) + >> Model1_Beta7 * (r71 * Model2_Beta1 + r72 * >> Model2_Beta2 + r73 * Model2_Beta3 + r74 * Model2_Beta4 + >> r75 * Model2_Beta5 >> + >> r76 * Model2_Beta6 + r77 * Model2_Beta7 + r78 * Model2_Beta8) + >> Model1_Beta8 * (r81 * Model2_Beta1 + r82 * >> Model2_Beta2 + r83 * Model2_Beta3 + r84 * Model2_Beta4 + >> r85 * Model2_Beta5 >> + >> r86 * Model2_Beta6 + r87 * Model2_Beta7 + r88 * Model2_Beta8)) / >> (Model1_R * Model2_R). >> execute. >> compute Var = (4 * (Model1_R_squared) * ((1 - Model1_R_squared)**2) + 4 * >> (Model2_R_squared) * ((1 - Model2_R_squared)**2) - (8 * Model1_R * >> Model2_R) >> * (0.5 * (2 * R_AB - Model1_R * >> Model2_R) >> * (1 - Model1_R_squared- Model2_R_squared - R_AB**2)) + R_AB**3) / N. >> execute. >> /*-------------------------------------------------*/ >> /*---Specify % Confidence Interval---*/ >> /*-------------------------------------------------*/. >> compute percent_CI = .95. >> execute. >> /*-------------------------------------------------------------------------------------------------*/ >> /*---Calculate 95% confidence limits about difference in multiple Rs---*/ >> /*-------------------------------------------------------------------------------------------------*/. >> compute LL = R_squared_diff - IDF.NORMAL(((1-(1-percent_CI)/2)),0,1) * >> sqrt(Var*(Model1_R_squared - Model2_R_squared)). >> compute UL = R_squared_diff + IDF.NORMAL(((1-(1-percent_CI)/2)),0,1) * >> sqrt(Var*(Model1_R_squared - Model2_R_squared)). >> execute. >> delete variables Model2_Beta1 to r99 R_AB Var. > > > > > > ----- > -- > Bruce Weaver > [hidden email] > http://sites.google.com/a/lakeheadu.ca/bweaver/ > > "When all else fails, RTFM." > > NOTE: My Hotmail account is not monitored regularly. > To send me an e-mail, please use the address shown above. > > -- > View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Confidence-Interval-About-difference-between-two-R-2s-tp5719785p5719786.html > Sent from the SPSSX Discussion mailing list archive at Nabble.com. > > ===================== > To manage your subscription to SPSSX-L, send a message to > [hidden email] (not to SPSSX-L), with no body text except the > command. To leave the list, send the command > SIGNOFF SPSSX-L > For a list of commands to manage subscriptions, send the command > INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
Free forum by Nabble | Edit this page |