Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: margins [,over()] after xtreg-fe not estimable


From   Alessandro Martinello <[email protected]>
To   [email protected]
Subject   st: margins [,over()] after xtreg-fe not estimable
Date   Wed, 19 Mar 2014 15:54:59 +0100

.
Dear all,

When I run -margins-  after a FE estimation using -xtreg- the command
shows that the derivatives are now estimable. For reference, I am
using Stata/SE 12.1 for Windows (32-bit) (updated in January 2014).
A very similar question has been posted in
http://www.stata.com/statalist/archive/2011-08/msg01073.html but it
did not seem to get any response.

I include a short simulation code that shows the problem. Basically, I
want to run a polynomial regression, where I suspect that the
polynomial (in x) varies according to a discrete observable (t). In
the example, t is fixed by individuals. I get the same problem if t is
a time-varying, categorical variable and c is continuous but fixed by
individuals instead.

*-----*
/*working example*/
*-----*
clear all
set obs 20
gen id = _n
gen c = rnormal()
gen t=c<0
expand 50
gen x = rnormal()

gen y = 2*x + x^2 + 1 +c +rnormal() if t
replace y = x + 2*x^2 + 1 +c +rnormal() if !t

xtset id
xtreg y c.x##c.x##i.t, fe
margins, dydx(x) over(t) at(x==1)
*-----*


------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
x            |
           t |
          0  |          .  (not estimable)
          1  |          .  (not estimable)
------------------------------------------------------------------------------

The derivatives here should be equal to 5 and 4 respectively at x=1. I
should be able to identify them because of the variation in the
within-individual-varying variable x - in this simple case, it's easy
to compute them directly from the regression results.
Indeed, I obtain the correct derivatives if I include individual dummies instead

*----*
reg y i.id c.x##c.x##i.t
margins, dydx(x) over(t) at(x==1)
*----*

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
x            |
           t |
          0  |   4.990517   .0774455    64.44   0.000     4.838727    5.142308
          1  |   4.048728   .0852937    47.47   0.000     3.881556    4.215901
------------------------------------------------------------------------------

----

This approach is however not feasible in the more complex model in my
real dataset.
I guess the problem arises because t is dropped in a different way in
-reg- with individual dummies and -xtreg, fe - . Specifying the option
noestimcheck in -margins- delivers the correct estimates, but I am
wary about using it without understanding where the problem comes
from. I hope you will be able to help me with that.

Thanks for your time!

Best,

Alessandro Martinello
Ph.D. Candidate
University of Copenhagen
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index