set verbose off nulldata 250 K = 5000 alpha = 0.05 x = normal() matrix rej = zeros(1, 4) loop i=1..K # generate the error term u = normal() # generate the dependent var y = 1 + u # use all 250 observations ols y 0 x --quiet tstat = $coeff[2] / $stderr[2] # two tailed test if 2 * pvalue(z, abs(tstat)) < alpha rej[1] += 1 endif if 2 * pvalue(t, $df, abs(tstat)) < alpha rej[2] += 1 endif # use only the first 20 observations smpl 1 20 ols y 0 x --quiet tstat = $coeff[2] / $stderr[2] # two tailed test if 2 * pvalue(z, abs(tstat)) < alpha rej[3] += 1 endif if 2 * pvalue(t, $df, abs(tstat)) < alpha rej[4] += 1 endif # reset to full sample range smpl full endloop rej *= 100/K printf "Rejection rates at alpha = %g:\n", alpha printf "n = 250, using z: %.2f%%\n", rej[1] printf "n = 250, using t: %.2f%%\n", rej[2] printf "n = 20, using z: %.2f%%\n", rej[3] printf "n = 20, using t: %.2f%%\n", rej[4]