* J Test for a Consumption Function
*
* Keywords:
* regression, ols, specification, j-test, consumption, function
*
* Description:
* We illustrate how to do a J-test of model specification on the US
* Consumption Function
*
* Author(s):
* Noel Roy
* Skif Pankov
*
* Source:
* William H. Greene, Econometric Analysis - 7th Edition
* Pearson International Edition, Chapter 5, Example 5.7 (page 176)
*
* Reading the datafile and naming the variables, specifying to ignore the
* first line of the file
read (TableF5-2.shd) year qtr gdp c inv g y / skiplines=1
* Generating lagged values of c and y
genr lagc=lag(c)
genr lagy=lag(y)
* Setting the first time period in the sample to the 1st quarter of 1950
time 1950.1 4
* Because we have no data for the lagged variables for 1950.1, we
* must discard this observation
sample 1950.2 2000.4
* We estimate both h0 and h1 equations in order to obtain the fitted
* values
?ols c y lagy / predict=h0hat
?ols c y lagc / predict=h1hat
* Testing h0 against h1
?ols c y lagy h1hat
test h1hat
* Testing h1 against h0
?ols c y lagc h0hat
test h0hat
stop