1# PS9.3, for the LM test in Example 9.4
2open data4-7
3ols chd 0 cig edfat spirits beer
4# save residuals
5genr ut=$uhat
6# generate lag of ut
7genr ut1=ut(-1)
8# print ut and ut1 to see how ut1 is internally stored
9print ut ut1
10# suppress first obs. because ut1 is not defined for it
11smpl 1948 1980
12# auxiliary regression for LM test
13ols ut 0 cig edfat spirits beer ut1
14# compute nrsquare statistic
15genr LM = $nrsq
16# compute pvalue for it
17pvalue X 1 LM
18