# demonstrate the effect of E(u|X) not equal to 0 set verbose off # create an artificial dataset with 200 observations nulldata 200 setobs 1 1 --special-time-series # uniform() generates a uniformly distributed r.v. series x = 20 * uniform() K = 1000 hsrej = 0 acrej = 0 loop K # error term will be correlated with x series u = 0.2*x + normal() series y = 10 + 1.5*x + u ols y 0 x -q modtest --white --silent hsrej += $pvalue modtest --autocorr --silent acrej += $pvalue endloop printf "hsk test: mean p-value %g\n", hsrej/K printf "autocorr test: mean p-value %g\n", acrej/K