title "因子分析のの必要サンプル数 (cmsの応用)". * MacCallum,R.C.,Browne,M.W.,and Sugawara,H.M.(1996) Power analysis and * determination of sample size for covariance structure modeling. * Psychologica Mesthods, 1(2) 130-149.3.. *http://quantrm2.psy.ohio-state.edu:80/MacCallum/power.htm にプログラムがある. set mxloops=10000. data list free/ alpha rmsea0 rmseaa powd vn. begin data 0.05 0.08 0.05 .80 13 0.05 0.05 0.01 .80 13 0.05 0.08 0.05 .80 20 0.05 0.05 0.01 .80 20 0.05 0.08 0.05 .80 100 0.05 0.05 0.01 .80 100 end data. *最大因子数 自由度>0 となるもの. compute mxf=trunc(((2*vn+1)-sqrt(8*vn+1))/2-0.000001). compute mxf=min(mxf,9). *close fit. *rmsea0=.05 ; *null hyp rmsea ; *rmseaa=.08 ; *alt hyp rmsea ; *not close fit. *rmsea0=.05 ; *null hyp rmsea ; *rmseaa=.01 ; *alt hyp rmsea ; * *df=20; *degrees of freedom. *alpha=.05; *alpha level. *powd=.80; *desired power.df. compute m=1. *write /'rmsea0 rmseaa powd powa alpha df vn m minn' . write /'rmsea0 rmseaa powd powa alpha df 変数数 因子数 必要サンプル数' . loop if (mncdf.chisq(cval,dfcinv,lambdaci)). do if (icinv=0). loop icinv=0 to 1000. compute cval=start+stepcinv*icinv. end loop if ((beta)=prec). compute intvcinv=intvcinv*.5. compute newncinv=newncinv +dircinv*intvcinv*.5. *compute new betaa. compute betaa=ncdf.chisq(newncinv,dfcinv,lambdaci). compute betadiff=abs(betaa-beta). do if (betaa=.0001). compute intv=intv*.5. compute newn=newn +dir*intv*.5. *compute new power. compute ncp0=(newn-1)*df*rmsea0**2. compute ncpa=(newn-1)*df*rmseaa**2. compute start=df+2*ncp0. *compute power . *compute cinv ****************************. compute lambdaci=ncp0. compute stepcinv=start/20. compute prec=.00000001. loop icinv=0 to 1000. compute cval=start-stepcinv*icinv. end loop if ((beta)>ncdf.chisq(cval,dfcinv,lambdaci)). do if (icinv=0). loop icinv=0 to 1000. compute cval=start+stepcinv*icinv. end loop if ((beta)=prec). compute intvcinv=intvcinv*.5. compute newncinv=newncinv +dircinv*intvcinv*.5. *compute new betaa. compute betaa=ncdf.chisq(newncinv,dfcinv,lambdaci). compute betadiff=abs(betaa-beta). do if (betaa