(* PS10.1, using DATA10-1, for Example 10.1 *)
help lags 
(* Generate four lagged variables for M and D *)
lags M D  
(* Reset sample range and suppress first four observations *)
smpl 1965.1 ;
(* Estimate kitchen sink model by OLS *)
ols r const M D M_1 M_2 M_3 M_4 D_1 D_2 D_3 D_4  
(*  Perform LM test for AR(4) *)
genr ut=uhat
lags ut  
smpl 1966.1 ;
(* Auxiliary regression for LM test *)
ols ut const ut_1 ut_2 ut_3 ut_4 M D M_1 M_2 M_3 M_4 D_1 D_2 D_3 D_4  
genr LM=$trsq
(* p-value indicates significant fourth-order autocorrelation *)
pvalue 3 4 LM
(* Reset sample range back and estimate AR(4) by Generalized CORC *)
smpl 1965.1 ;
ar 1 2 3 4 ; r const M D M_1 M_2 M_3 M_4 D_1 D_2 D_3 D_4 
(* omit all variables with p-values greater than 0.5 *)
omit M_2 M_3 M_4 D_1 D_2 D_3 
(* omit variables one at a time *)
omit D_4  
omit D  
