Hello,
Margins works fine for me but marginsplot does not. I would like some advice on a way to meaningfully plot the marginal effects I would like to plot, or on whether my entire approach is ill-conceived. Details below:
I am running a fixed effects regression, treating my id variable and time variable as categorical, but also including an interaction between a continuous version of the time variable and the id variable.
I removed a couple variables that might otherwise clutter this. I'm also using a lagged variable and interacting it with two other variables.
Here's my model:
I run this margins command, which works fine and appears to do what I want, which is to estimate the average marginal effect at PosEmpGrowth = 0 (so the marginal effect only where the change is negative; I'm trying to permit asymmetric interactions of SWIndex and changes in Emp) and at various other values.
It gives me normal-looking margins output (not pasting the entire thing here because it is so long).
First snippet:
Second snippet:
I then request a marginsplot and receive this return message:
I understand what it means when it says that treating a variable as a factor variable and a regular variable is not supported (I am indeed doing this with Year), but I do not know why this is the case and would like to know whether there is a way to accomplish what I would like to accomplish, which is to visualize the average marginal effect, other than exporting it to Excel and doing it myself. Or, am I misunderstanding something, and is the whole idea of what I'm trying to do ill-conceived?
Margins works fine for me but marginsplot does not. I would like some advice on a way to meaningfully plot the marginal effects I would like to plot, or on whether my entire approach is ill-conceived. Details below:
I am running a fixed effects regression, treating my id variable and time variable as categorical, but also including an interaction between a continuous version of the time variable and the id variable.
I removed a couple variables that might otherwise clutter this. I'm also using a lagged variable and interacting it with two other variables.
Here's my model:
Code:
xtreg $depvar c.l.SWIndex##c.PosEmpGrowth c.l.SWIndex##c.NegEmpGrowth TotalEmp i.Year i.id#c.Year ,vce(robust) fe i(id)
Code:
margins ,dydx(L.SWIndex) at(PosEmpGrowth = (0(5000)200000))
First snippet:
Code:
Average marginal effects Number of obs = 40,695 Model VCE : Robust Expression : Linear prediction, predict() dy/dx w.r.t. : L.SWIndex 1._at : PosEmpGrowth = 0 2._at : PosEmpGrowth = 5000
Code:
------------------------------------------------------------------------------ | Delta-method | dy/dx Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- L.SWIndex | _at | 1 | -1.362592 .7528628 -1.81 0.070 -2.838176 .1129921 2 | -1.19614 1.103605 -1.08 0.278 -3.359165 .9668854 3 | -1.029688 1.595174 -0.65 0.519 -4.156171 2.096796 4 | -.8632358 2.132302 -0.40 0.686 -5.042472 3.316 5 | -.6967838 2.687814 -0.26 0.795 -5.964802 4.571235
Code:
. marginsplot invalid at() dimension information; using variable Year as a factor variable and a regular variable is not supported r(322);
I understand what it means when it says that treating a variable as a factor variable and a regular variable is not supported (I am indeed doing this with Year), but I do not know why this is the case and would like to know whether there is a way to accomplish what I would like to accomplish, which is to visualize the average marginal effect, other than exporting it to Excel and doing it myself. Or, am I misunderstanding something, and is the whole idea of what I'm trying to do ill-conceived?
Comment