*fitindex.sps **** khori 2000/5/17. *title "power analysis and effect size (fixed) 90% confidence intervals". * Steiger and Fouladi(1997) in Harlow, Mulaik and Steiger(eds) * What if there were no significance tests? LEA. *Steiger, J.H. (1996). 共分散構造分析(SEPATH)  *STATISTICA ユーザーマニュアル応用統計編 デザインテクノロジーズ *p3463-3606 (StatSoft,1995). *modelfit.sas by Gregorich,S. preserve. set printback=none. *set printback=listing. set mxloops=10000. data list free/nvar nfac chivalue n . /* nfac +:spss出力 -:その他出力 自由度 */ begin data 13 4 68.412 200 6 2 2.335 220 6 1 51.99568 220 26 -162 324.4 2038 26 -166 406.6 2038 26 -175 430.2 2038 26 -176 444.0 2038 26 -179 485.4 2038 24 -276 1264.00 86 24 -252 600.51 86 24 -229 417.81 86 24 -207 314.70 86 24 -186 266.99 86 24 -166 215.74 86 24 -147 176.72 86 24 -129 143.61 86 24 -112 124.13 86 24 -96 105.89 86 24 -81 80.90 86 end data. *initialize values. compute n1=n-1. compute ci_width=.90. compute zero=0.00000001. compute past=nvar*(nvar+1)/2. do if (nfac>0). ****** compute degree of freedom. compute df=((nvar-nfac)**2-(nvar+nfac))/2. compute bpvalue=1-cdf.chisq(chivalue,df). ****** convert ml-chi-squared value to normal-chi-squared value. compute chi2=chivalue/(n1-(2*nvar+5)/6-2*nfac/3)*(n1). else. compute df=nfac*(-1). compute chi2=chivalue. recode chivalue nfac (lo thru hi=sysmis). end if. compute p=nvar. compute p_star=p*(p+1)/2. /*p_star は past と同じ*/ compute q=p_star-df. compute ci_l=(1-ci_width)/2. compute ci_u=1-ci_l. compute f_hat=chi2/n1. compute ml_x2=(n1-p-1)*f_hat. compute rmsea=f_hat/df-1/(n1). If (rmsea<0) rmsea=0. compute McDonald=exp(rmsea*df/2*(-1)). compute rmsea=Sqr(rmsea). compute exactfit=1-cdf.chisq(chi2,df). compute cfit=1-ncdf.chisq(chi2,df,(n*df*(.05)*(.05))). compute ecvi= f_hat+2/(n1-p-1)*q. compute GAMMA=nvar/(2*chi2/(n1)+nvar-2*df/(n1)). if (gamma>1) gamma=1. compute gfidash=nvar/(nvar+2*chi2/(n-1)). compute agfidash=1-(past/df)*(1-gfidash). compute aic=chi2-2*df. compute bic=chi2-(ln(n)*df). compute bic2=chi2-(ln(n/(2*3.14159265359))*df). compute GAMMA2=1-(past/df)*(1-GAMMA). compute lambda=chi2-df. if (lambda<10) lambda=10. compute pvalue=1-cdf.chisq(chi2,df). compute stepl=lambda/20. do repeat cumpd=ci_l, ci_u /xrmsea=urmsea lrmsea /xf0=uf0 lf0 /xGAMMA=lGAMMA uGAMMA /xGAMMA2=lGAMMA2 uGAMMA2 /xMcDonal=lMcDonal uMcDonal. do if (cumpd=ci_l and cdf.chisq(chi2,df)zero). compute xlambda=xlambda-stepl. if (xlambda=cumpd and xlambda>0). compute xlambda=xlambda+stepl. compute cumpa=ncdf.chisq(chi2,df,xlambda). end loop. end if. *begin loop for interval halving. compute dir=1. if (cumpa=.00001 and nlambda>zero). compute intv=intv*.5. compute nlambda=nlambda +dir*intv*.5. if (nlambda1) xgamma=1. compute xGAMMA2=1-(past/df)*(1-xGAMMA). end repeat. ******** ml chi-squarrs. compute stepl=lambda/20. do repeat cumpd=ci_l, ci_u /xecvi=uecvi lecvi. do if (cumpd=ci_l and cdf.chisq(ml_x2,df)zero). compute xlambda=xlambda-stepl. if (xlambda=cumpd and xlambda>0). compute xlambda=xlambda+stepl. compute cumpa=ncdf.chisq(ml_x2,df,xlambda). end loop. end if. *begin loop for interval halving. compute dir=1. if (cumpa=.00001 and nlambda>zero). compute intv=intv*.5. compute nlambda=nlambda +dir*intv*.5. if (nlambda