rndseed 12345 !nrep=10000 !n=30 ' Net sample size is 20 less than this value, as the first 20 obs. are discarded series y series s series ts series dfs series prod series abbs series dumm scalar rho=1 scalar rhohat vector(!nrep) t vector(!nrep) df for !I =1 to !nrep smpl 1 !n y=0 s=1 smpl 2 !n y=rho*y(-1)+@rnorm smpl if y(-1)<0 s=-1 smpl 21 !n ' Discard the first 20 observations prod=s*y abbs=@abs(y(-1)) rhohat=@sum(prod)/@sum(abbs) ' See So & Shin, p.166 equation eq1.ls y y(-1) ' Use OLS to estimate sigma - see So & Shin p.167 t(!i)=(rhohat-rho) / (@sqrt(!n-20)*@se / @sum(abbs)) ' This is the Cauchy t-statistic df(!i) = (@coefs(1) - rho) / @stderrs(1) ' Construct the usual DF test statistic next smpl 1 !nrep mtos(t,ts) mtos(df,dfs) dumm=(ts < -1.645) ' Assume a 5% nominal significance level scalar size=@sum(dumm) / !nrep ' Compute the empirical size of the Cauchy test show size smpl 1 !nrep show ts hist ts show ts dfs