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]
Re: st: margins [,over()] after xtreg-fe not estimable
From
Scott Merryman <[email protected]>
To
[email protected]
Subject
Re: st: margins [,over()] after xtreg-fe not estimable
Date
Wed, 19 Mar 2014 15:22:14 -0500
You could write the -xtreg- line as:
xtreg y c.x##c.x c.x#i.t c.x#c.x#i.t, fe
margins, dydx(x) over(t) at(x==1)
Scott
On Wed, Mar 19, 2014 at 9:54 AM, Alessandro Martinello
<[email protected]> wrote:
> .
> 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)
> *-----*
>
*
* 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/