# st: question about non-linear leasts squares

 From Rudy Fichtenbaum To statalist@hsphsun2.harvard.edu Subject st: question about non-linear leasts squares Date Thu, 28 May 2009 08:25:01 -0400

I am trying to replicate an example in Principles of Econometrics by Hill, Griffiths and Lim on estimating a model with AR(1) on p. 236 using non-linear least squares.
```
```
There is actually an example of this problem in Using Stata for Principles of Econometrics on p. 218. I am able to replicate the example on p 218 exactly but these results are not in agreement with those presented in the text on p. 236.
```
```
The example starts by estimating a simple model using OLS. They it uses newey-west standard errors. Here are those results.
```

. newey la lp, lag(3)

```
Regression with Newey-West standard errors Number of obs = 34 maximum lag: 3 F( 1, 32) = 4.21 Prob > F = 0.0484
```
------------------------------------------------------------------------------
|             Newey-West
```
la | Coef. Std. Err. t P>|t| [95% Conf. Interval]
```-------------+----------------------------------------------------------------
```
lp | .7761187 .3782067 2.05 0.048 .0057369 1.546501 _cons | 3.893256 .0624443 62.35 0.000 3.766061 4.020451
```------------------------------------------------------------------------------

```
Next the text claims to use non-linear least squares estimates but the results presented in the text cannot be gotten using nlls.
```
Here are the results for non-linear least squares.

```
. nl (la = {b1}*(1-{rho}) + {b2}*lp_1+{rho}*la_1-{rho}*{b2}*(lp_1)), variables(lp la la_1 lp_1)
```(obs = 33)

Iteration 0:  residual SS =  29.15276
Iteration 1:  residual SS =  2.979124
Iteration 2:  residual SS =  2.979124

Source |       SS       df       MS
```
-------------+------------------------------ Number of obs = 33 Model | .404285358 2 .202142679 R-squared = 0.1195 Residual | 2.97912389 30 .09930413 Adj R-squared = 0.0608 -------------+------------------------------ Root MSE = .3151256 Total | 3.38340925 32 .105731539 Res. dev. = 14.28896
```
------------------------------------------------------------------------------
```
la | Coef. Std. Err. t P>|t| [95% Conf. Interval]
```-------------+----------------------------------------------------------------
```
/b1 | 4.101714 .1141125 35.94 0.000 3.868666 4.334763 /rho | .3327122 .182082 1.83 0.078 -.0391488 .7045733 /b2 | -.7779345 .614835 -1.27 0.216 -2.033595 .4777261
```------------------------------------------------------------------------------
Parameter b1 taken as constant term in model & ANOVA table

```
Not only do these results not agree with the text, but the sign on b2 is the wrong sign and it is not statistically significant. Also the estimate of rho does not agree with rho on p. 236.
```
```
The closest I can get to the results in the textbook is using Cochrane-Orcutt minimizing the SSE.
```
Cochrane-Orcutt AR(1) regression -- SSE search estimates

```
Source | SS df MS Number of obs = 33 -------------+------------------------------ F( 1, 31) = 12.33 Model | .971527978 1 .971527978 Prob > F = 0.0014 Residual | 2.4435749 31 .078824997 R-squared = 0.2845 -------------+------------------------------ Adj R-squared = 0.2614 Total | 3.41510288 32 .106721965 Root MSE = .28076
```
------------------------------------------------------------------------------
```
la | Coef. Std. Err. t P>|t| [95% Conf. Interval]
```-------------+----------------------------------------------------------------
```
lp | .8883711 .2530456 3.51 0.001 .3722812 1.404461 _cons | 3.898771 .0906242 43.02 0.000 3.713942 4.0836
```-------------+----------------------------------------------------------------
rho |   .4221394
------------------------------------------------------------------------------
Durbin-Watson statistic (original)    1.168987
Durbin-Watson statistic (transformed) 1.820559

```
The textbook actually says that non-linear least squares are equivalent to Cochrane-Orcutt so this result is not particularly surprising and it almost matches the example on p. 236.
```
```
So the question is why are the non-linear least squares results so different?
```
```
The text also suggests that you can run the non-linear least squares model using OLS and then test the restriction. When one does this the magnitude of the estimate of b2 is the same as nlls but the sign is the opposite. In fact, using the nlls model and estimating it with OLS and testing the restriction lead to approximately the same estimate as is obtained with Newey-West estimates.
```
Rudy

--
Rudy Fichtenbaum
Professor of Economics
Chief Negotiator AAUP-WSU
Wright State University
Dayton, OH 45435-0001
937-775-3085

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```