# st: RE: How to treat a variable that switches from being endogenous to exogenous in a dynamic panel data model

 From "Schaffer, Mark E" To Subject st: RE: How to treat a variable that switches from being endogenous to exogenous in a dynamic panel data model Date Sat, 13 Feb 2010 17:48:42 -0000

```Dev,

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of
> Dev Vencappa
> Sent: 13 January 2010 18:41
> To: statalist@hsphsun2.harvard.edu
> Subject: st: How to treat a variable that switches from being
> endogenous to exogenous in a dynamic panel data model
>
> STATA users,
> problem. I am currently using IV GMM on a dynamic panel data
> model. One of the X variables measures the amount of excess
> that every organisation in the data set pays on its insurance
> policy. There are good reasons to believe this is endogenous
> and this should be treated accordingly in estimation.
> However, at a certain point in time, a policy change means
> that none of the organisations has to pay this excess anymore
> and the variable becomes zero from that point on and the
> endogeneity issue goes away. I am not sure how to treat that
> variable in this case. Should I treat it as endogenous (there
> are more time periods when it is endogenous than it is
> exogenous) and assume that the instruments for this are
> superfluous on the Sargan test from the point of switching to
> being treated as exogenous or should I assume it to be
> exogenous altogether for the whole time period? I don't seem
> to find a suitable source for this in the literature and
> would appreciate some guidance towards this and a solution to
> implement this in STATA if it exists.

I think you're saying that your setup is

Y_t = X_t*B + u_t

E(X_t*u_t) \ne 0 for t <  t~

E(X_t*u_t)   = 0 for t >= t~

So X is endogenous for t before t~, and exogenous afterwards.

My instinct is to set this up as two equations, and impose the
constraint that B in the first equation (where X is endogeous) is equal
to X in the second equation (where X is exogenous).

Imposing the constraint gets you the efficiency gains you want, and that
means systems estimation.  But I think you may be able to do it in a
single equation estimation, by defining your instruments cleverly.

Say Z is the instrument for X for t < t~.  You don't want it to be the
instrument for the later period, so create a new instrument, Z1, which
has zeros in the later period.

For the later period, t >= t~, the instrument for X is just X.  But you
don't want it to be the instrument for the earlier period, so create
another new instrument, Z2, which has zeros in the earlier period.

Then estimate using IV/GMM, instrumenting X with Z1 and Z2.

If you've got a constant term, you want the coefficient on that to
change value before/after t~ as well.

Here's an example using the sample dataset idle2 that uses lagged idle
as an instrument for time<=15, and treats idle as exogenous for time>15.
The -first- option confirms that the coefficient on Z2 is =1:

**********************
webuse idle2, clear
tsset time

gen Z1=l.idle if time<=15
replace Z1=0 if time>15

gen Z2=idle if time>15
replace Z2=0 if time<=15

gen consdummy=(time>15)

ivreg2 usr (idle = Z1 Z2 consdummy), first
************************

HTH and sorry for the long wait,
Mark

>
>
> Dev
> This message has been checked for viruses but the contents of
> an attachment may still contain software viruses which could
> communications with the University of Nottingham may be
> monitored as permitted by UK legislation.
> *
> *   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/
>

--
Heriot-Watt University is a Scottish charity
registered under charity number SC000278.

*
*   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/
```