%macro combchi(df=,chi=); /****************************************************************************** Version 1.0, 4-27-00 This is a BETA version. USE AT YOUR OWN RISK!. Report any errors, problems or questions to the e-mail address below. The latest version of this macro can be found at the web site below: Author: Paul D. Allison, University of Pennsylvania allison@ssc.upenn.edu http://www.ssc.upenn.edu/~allison/ MACRO COMBCHI combines chi-square statistics from an analysis of several data sets created by multiple imputation, using the method described on p. 115 of Schafer, J.L. (1997) Analysis of Incomplete Multivariate Data. London: Chapman and Hall. The chi-square statistics can be either Wald statistics or likelihood ratio statistics. All that's needed are the several chi-square values and the segrees of freedom. COMBCHI requires the installation of IML. Example of usage: Suppose a 3 d.f. test on four data sets produces chi-squares of 5.8, 7.2, 6.1 and 8.5. Submit the statement: %combchi(df=3, chi=5.8 7.2 6.1 8.5) The following output is printed F DF DDF 2.1201613 3 342.22381 P 0.0974097 The macro calculates an F-statistic of 2.12 with 3 and 342 degrees of freedom. The associated p-value is .097. *****************************************************************************/ proc iml; df=&df; g2={&chi}; m=ncol(g2); g=sqrt(g2); mg2=sum(g2)/m; r=(1+1/m)*(ssq(g)-(sum(g)**2)/m)/(m-1); f=(mg2/df - r*(m-1)/(m+1))/(1+r); ddf=(m-1)*(1+1/r)**2/df**(3/m); p=1-probf(f,df,ddf); print f df ddf; print p; run; %mend combchi;