Skip to Main Content

Choosing between nonnested models | Stata Code Fragments

The example here is taken from Chapter 7 of Greene’s Econometric Analysis,
Fourth Edition.

clear
input year    y       c  
1950   791.8   733.2   
1951   819.0   748.7   
1952   844.3   771.4   
1953   880.0   802.5   
1954   894.0   822.7   
1955   944.5   873.8   
1956   989.4   899.8   
1957  1012.1   919.7   
1958  1028.8   932.9   
1959  1067.2   979.4   
1960  1091.1  1005.1   
1961  1123.2  1025.2   
1962  1170.2  1069.0   
1963  1207.3  1108.4   
1964  1291.0  1170.6   
1965  1365.7  1236.4   
1966  1431.3  1298.9   
1967  1493.2  1337.7   
1968  1551.3  1405.9   
1969  1599.8  1456.7   
1970  1688.1  1492.0   
1971  1728.4  1538.8   
1972  1797.4  1621.9   
1973  1916.3  1689.6   
1974  1896.6  1674.0
1975  1931.7  1711.9
1976  2001.0  1803.9
1977  2066.6  1883.8
1978  2167.4  1961.0
1979  2216.2  2004.4
1980  2214.3  2000.4
1981  2248.6  2024.2
1982  2261.5  2050.7
1983  2334.6  2145.9
1984  2468.4  2239.9
1985  2509.0  2312.6
 end
gen c1 = c[_n-1]
gen y1 = y[_n-1]
* regression 1 (M1)
reg c y y1
      Source |       SS       df       MS              Number of obs =      35
-------------+------------------------------           F(  2,    32) =10598.34
       Model |  7887172.12     2  3943586.06           Prob > F      =  0.0000
    Residual |  11907.0301    32  372.094689           R-squared     =  0.9985
-------------+------------------------------           Adj R-squared =  0.9984
       Total |  7899079.15    34  232325.857           Root MSE      =   19.29
------------------------------------------------------------------------------
           c |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           y |   .8769845   .1068808     8.21   0.000     .6592755    1.094693
          y1 |   .0226182   .1087415     0.21   0.837    -.1988809    .2441174
       _cons |   10.17258   10.49558     0.97   0.340    -11.20622    31.55139
------------------------------------------------------------------------------
* regression 2 (M2)
* reg c y c1

We can use the nnest command written by Gregorio Impavido to test
these non-nested models.  Please note that you will need to download
and install nnest, which you can do by typing search nnest in
the command window (see
How can I use the search command to search for programs and get additional help?
for more
information about using search).  It is not necessary to run the
second regression model, so we show only the Stata code for it.

nnest y c1

                   Competing Models                 
  --------------------------------------------------
  M1 : Y = [c]
       X = [y y1]
  M2 : Y = [c]
       Z = [y c1]
  --------------------------------------------------
             J test for non-nested models           
  --------------------------------------------------
                    Dist         Stat      P>|Stat|
  H0:M1 / H1:M2    t(31)         4.30       0.000
  H0:M2 / H1:M1    t(31)        -3.29       0.002
  --------------------------------------------------
        Cox-Pesaran test for non-nested models      
  --------------------------------------------------
                    Dist         Stat      P>|Stat|
  H0:M1 / H1:M2    N(0,1)      -28.34       0.000
  H0:M2 / H1:M1    N(0,1)        1.59       0.055
  --------------------------------------------------

According to the J test, either model M1 or model M2 should be rejected.
However,
according to the Cox-Pesaran test, we should not reject model M2 with the variables
y and c1 as the predictors. Greene gave a reference for
a discussion of why J test would reject both.