# st: Problem with -estat endogenous- after -ivregress gmm- with time-series operators

 From Michael Hanson <[email protected]> To [email protected] Subject st: Problem with -estat endogenous- after -ivregress gmm- with time-series operators Date Fri, 26 Jun 2009 12:08:08 -0400

As the subject might give away, I believe I have found an obscure bug (a term I don't use lightly) with -estat endogenous- following an - ivregress gmm- estimation in which one or more of the variables in the estimation use Stata's time series operators. Below is a stylized estimation problem (based loosely on Campbell & Mankiw, 1989, for the curious) that exhibits the apparent bug.
```
// begin example

clear
use http://www.stata-press.com/data/r10/lutkepohl2.dta

gen c = log(consump)
gen y = log(inc)
gen s = c - y

// Approach 1: works OK
ivregress 2sls D.c (D.y = L(2/4)D.c L(2/4)D.y L2.s), vce(hac nw 1)
estat endogenous

// Approach 2: gives error msg in -estat- command
ivregress gmm D.c (D.y = L(2/4)D.c L(2/4)D.y L2.s), vce(hac nw 1)
estat endogenous

// Approach 3: works OK
gen Dc = D.c
gen Dy = D.y
foreach v in c y {
forval k = 2/4 {
gen L`k'D`v' = L`k'.D`v'
}
}
gen L2s = L2.s
ivregress gmm Dc (Dy = L2Dc-L4Dc L2Dy-L4Dy L2s), vce(hac nw 1)
estat endogenous

// end example

```
The error seems to only occur with the -gmm- form of -ivregress- (approach 2), and not with the -2sls- form (approach 1). Similarly, estimating the identical equation with -gmm- but first creating variables that do not use the time series operators (approach 3) does not yield an error.
```
```
My Stata 10 manuals must be sufficiently old as they do not contain documentation on -estat endogenous-, but -help ivregress_postestimation- didn't turn up any obvious reason for the error message I see.
```
```
With the announcement of Stata 11 in a month or so, I'm still hoping this issue will be fixed in an update to Stata 10.
```
Thanks for any assistance,
Mike

```
Reference: John Y. Campbell and N. Gregory Mankiw, "Consumption, Income and Interest Rates: Reinterpreting the Time Series Evidence," NBER Macroeconomics Annual 1989, eds. Olivier Jean Blanchard and Stanley Fischer, Boston: MIT Press.
```*
*   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/
```

• Follow-Ups: