clear set more off run confa.mata cap pro drop CONFAData pro def CONFAData args n nfac nipf clear set obs `n' mat A = I(`nfac') + J(`nfac',`nfac',2) if `nfac'>1 local todraw f1-f`nfac' else local todraw f1 drawnorm `todraw' , cov(A) cs(full) forvalues i=1/`nfac' { forvalues j=1/`nipf' { gen x_`i'_`j' = f`i'+rnormal() } } end * to be posted cap postclose topost postfile topost double time int n byte(nfac nipf converged init) using confa-order, replace foreach n of numlist 100 150 200 250 300 400 500 700 1000 { foreach nfac of numlist 1/5 { foreach nipf of numlist 2/6 { // create the data CONFAData `n' `nfac' `nipf' local toconfa if `nfac'*`nipf'>2 { forvalues i=1/`nfac' { local toconfa `toconfa' (f`i': forvalues j=1/`nipf' { local toconfa `toconfa' x_`i'_`j' } local toconfa `toconfa') } // the data have been created di _n "{txt}{hline}{p}No. factors = {res}`nfac'{txt}, indicators per factor = {res}`nipf'{txt}, sample size = {res}`n'{p_end}" di as inp ". confa `toconfa', from(smart) iter(100)" timer clear 5 timer on 5 cap noi confa `toconfa', from(smart) iter(100) search(off) local rcconfa = _rc timer off 5 timer list 5 if !`rcconfa' { post topost ( r(t5) ) (`n') (`nfac') (`nipf') (`e(converged)' ) (1) } else { di as inp ". confa `toconfa', from(iv) iter(100)" timer clear 5 timer on 5 cap noi confa `toconfa', from(iv) iter(100) search(off) local rcconfa = _rc timer off 5 timer list 5 if !`rcconfa' { post topost ( r(t5) ) (`n') (`nfac') (`nipf') (`e(converged)' ) (2) } } sleep 1000 } } // of nipf } // of nfac } // of for n postclose topost exit