'Simulation 1 !N=1000 'Number of draws !T=500 'Sample size !wind=200 'Window !cl=0.95 'Confidence level !arl=10 'AR model for comparison !tn=!T+!wind rndseed 123 'Seed create u !tn 'Creating workspace ' vector(!N) cols= 0 vector(!N) secols = 0 vector(!N) colsnw= 0 vector(!N) secolsnw = 0 vector(!N) secar = 0 vector(!N) secar!arl = 0 scalar q=@qnorm((1+!cl)/2) smpl 1 !tn 'Range to work for !i = 1 to !N 'DGP '************************************************** ' y1 is AR(1) 'Parameters: !c=10 !phi=0.5 genr y1= !c + nrnd smpl 2 !tn genr y1= !c + !phi*y1(-1) + nrnd smpl !wind+1 !tn '************************************************** scalar mu=!c/(1- !phi) ' Models equation ols.ls y1 c equation olsnw.ls(N) y1 c equation ar1.ls y1 c y1(-1) equation ar!arl.ls y1 c y1(-1 to -!arl) cols(!i)=ols.@coef(1) secols(!i)=ols.@stderrs(1) colsnw(!i)=olsnw.@coef(1) secolsnw(!i)=olsnw.@stderrs(1) secar(!i)=ar1.@se/((1-ar1.@coef(2))*(!T^0.5)) secar!arl(!i)=ar!arl.@se/((1-(@sum(ar!arl.@coefs)-ar!arl.@coef(1)))*(!T^0.5)) next range 1 !N 'Simulation results range smpl 1 !N mtos(cols,muols) 'Matrix to series mtos(secols,seols) mtos(colsnw,muolsnw) mtos(secolsnw,seolsnw) mtos(secar,sear) mtos(secar!arl,sear!arl) delete cols colsnw secar!arl secar secols secolsnw ar1 ar!arl ols olsnw genr ciols=(muols+q*seols>mu and muols-q*seolsmu and muolsnw-q*seolsnwmu and muols-q*searmu and muols-q*sear!arl