Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: -xthtaylor- by hand or using -xtivreg2-


From   "Schaffer, Mark E" <M.E.Schaffer@hw.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: -xthtaylor- by hand or using -xtivreg2-
Date   Thu, 17 Nov 2011 11:34:56 -0000

Hi Marc.  Comments below. 

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu 
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of M.M. Kramer
> Sent: 17 November 2011 09:15
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: -xthtaylor- by hand or using -xtivreg2-
> 
> Dear Mark,
> 
> You really helped me last time wit the -xtoverid- command. Is 
> there anything you can say about my problem stated below?
> 
> Thanks,
> Marc
> 
> 
> Dear Statalist users,
> 
> After using -xtoverid- I receive the following 4 warnings: 
> (1) "endogenous variable(s) collinear with instruments" ; (2) 
> "*:  3200 conformability error"; (3) "s_egmm(): - function 
> returned error", and
> (4) "<istmt>:  -  function returned error".

The first error message is probably the culprit.  The internal call to
ivreg2 is detecting that you have an endogeneous regressor that is
collinear with the (constructed) instruments, which means it's actually
exogenous.  The remaining errors are probably the result of this
failure, but for some reason the errors aren't being caught in time.

Are you using the most up-to-date versions of ivreg2 and ranktest?

More comments below.

> I use -xtoverid- to access the quality of the instruments 
> after estimating an unbalanced panel using the xthtaylor 
> command. In my estimations I also use time-dummies. For each 
> individual in my data set I have a maximum of 52 monthly 
> observations, so I included 51 time dummies to absorb 
> aggregate time effects.
> 
>  From an earlier discussion with Mark Schaffer I understood 
> that when running -xthtaylor- with an unbalanced panel, 3 
> instruments (a mean, a demeaned and a GLS transformation) are 
> created from the time-varying exogenous variables. In an 
> unbalanced panel the GLS transformation is added to the 
> estimation as another endogenous variable.

That's basically right.  More precisely, the GLS transformation is
applied to all the regressors, endogenous and exogenous, as well as to
the dep var.  Then, in the IV estimation, the GLS-transformed endogenous
regressors are treated as endogenous (of course), and the
GLS-transformed exogenous regressors are instrumented by their means and
demeans [sic].

In the balanced cased, if the GLS-transformed exogenous regressors were
treated as endogenous and instrumented by the means and demeans, you'd
have perfect collinearity because the GLS versions would be a simple
linear combination of the (exogenous) mean and demean, and you'd get
exactly the same result as if you treated the exog GLS regressors as
exogenous.  There's no perfect collinearity in the unbalanced case,
hence the trick used by xthtaylor works.

> Given that time 
> dummies are also time-varying and exogenous, they will be 
> transformed and used as instruments. The warnings I receive 
> very likely have to do with these GLS transformed time 
> dummies that are added as endogenous variables. When limiting 
> my estimation to a balanced panel, only the 1st error message 
> ("Warning - endogenous variable(s) collinear with
> instruments") remains, but -xtoverid- provides me with useful 
> output..

The collinearity message should be a concern.  ivreg2 is finding that
one of your endogenous variables is actually exogenous, in the sense
that it is simply a linear combination of other variables that you have
specified as exogenous.  I suspect it is reclassifying this endogenous
regressor as an exogenous regressor, and dropping some other variables
as collinear.

You should try to identify the source of the collinearity.  It should be
apparent from the xtoverid output.  It might be one of the variables you
have specified as endogenous in the command line, or it might be one of
the created exogenous GLS vars as above.

> When removing the time dummies and using my whole unbalanced 
> panel all error messages disappear, except that after all the 
> output Stata returns
> ("-xtoverid- error: internal reestimation of eqn differs from 
> original"), but I ignored this so far.

Best not to ignore this.  It's probably caused by a collinearity, and
xthtaylor and xtoverid are dealing with it in different ways.

> My question is, what can I do? I want to include the 
> time-dummies and use all my data (for most individuals I do 
> not have 52 monthly observations, so my data set would be 
> severely reduced when using only the balanced data set). 
> Another issue is that it feels a little awkward to use time 
> dummies as instruments, as they do not have any cross 
> sectional variation, but that's what -xthtaylor- does.

I have an almost working version of xtivreg2 that handles GLS/RE models,
including the HT estimator.  If your investigations don't isolate the
problem, contact me off-list and I can send it to you with instructions
on how to get it to do HT estimation.

--Mark

> 
> Thanks for your help.
> Marc
> 
> 
> 
> Schaffer, Mark E wrote:
> > Martin,
> >
> > There is no easy way to do what you want to do, but I can 
> think of a 
> > slightly laborious way.
> >
> > Say you rescale a single variable in your estimation by x1000.  The 
> > estimation results won't change except for the 
> coefficient(s) on the 
> > variable, which will also change by a factor of 1000.
> >
> > If you do this for each of your variables, one by one, you 
> should be 
> > able to deduce what the temporary variables correspond to.
> >
> > Not exactly an interesting way to spend your time, but it 
> should work.
> >
> > --Mark
> >
> >   
> >> -----Original Message-----
> >> From: owner-statalist@hsphsun2.harvard.edu
> >> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
> >> Sent: 10 November 2011 11:30
> >> To: 'statalist@hsphsun2.harvard.edu'
> >> Subject: RE: st: xthtaylor by hand or using xtivreg2
> >>
> >> Those are all names of temporary variables used within a 
> program and 
> >> which disappear at program end.
> >>
> >> Nick
> >> n.j.cox@durham.ac.uk
> >>
> >>
> >> -----Original Message-----
> >> From: owner-statalist@hsphsun2.harvard.edu
> >> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of M.M. 
> >> Kramer
> >> Sent: 10 November 2011 11:22
> >> To: statalist@hsphsun2.harvard.edu
> >> Subject: Re: st: xthtaylor by hand or using xtivreg2
> >>
> >> Dear Mark,
> >>
> >> The xtoverid works very well, thanks a lot for your help. It now 
> >> gives first stage results for all instrumented variables, 
> and given 
> >> that all variables are instrumented, I get many first 
> stage results, 
> >> including some useful statistics. My only question is 
> whether there 
> >> is an easy way to see which variable is behind the 
> "recoded" variable 
> >> that xtoverid creates (with names like: __00000J __00000M __00000P 
> >> __00000S __00000V, etc). I was thinking to correlate them with the 
> >> original variables to see whether something can be inferred from 
> >> that, but the new variables are not kept in Stata. Do you have any 
> >> suggestion for this?
> >>
> >> Thanks,
> >> Marc
> >>
> >>
> >>     
> >>> Schaffer, Mark E wrote:
> >>>       
> >>>> Marc,
> >>>>
> >>>> The xtoverid update is now available (with thanks as usual
> >>>>         
> >> to Kit Baum).
> >>     
> >>>> The -noi- option automatically triggers the -first- 
> option in the 
> >>>> internal call to -ivreg2- so you should see everything about the 
> >>>> first-stage estimations.
> >>>>
> >>>>         
> >> *
> >> *   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/
> >>
> >>     
> >
> >
> >   
> 
> 
> --
> Marc Kramer
> University of Groningen
> Faculty of Economics & Business
> Department of Economics, Econometrics and Finance Room WSN 
> 860 P.O. Box 800 9700 AV Groningen
> Tel.: 050-363.4532 / 3685
> 
> *
> *   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.

Heriot-Watt University is the Sunday Times
Scottish University of the Year 2011-2012



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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index