Hello,
I am working with a smal panel dataset (N=20, T=20) on Stata 15. I first estimate an equation like this:
y = a + b1x1 +b2x2 + b3x1*x2 (Eq. 1) where x1 and x2 are continuous variables and b1, b2, b3 are estimated coefficients.
I then want to use the margins command to compute the marginal effect of x1 on y as x2 varies. If I use, say xtreg to estimate equation 1, I can easily do this using the following code. Since I use fvvarlist to write the interaction terms, margins know that two continuous variables are being interacted. When it computes dydx for x1, as x2 varies, it takes this into account and I get different values of the marginal effect for each value of x2 between 0 and 1 (see code below).
However, I am using a user-written command (xtivreg2) to estimate equation 1. xtivreg2 does not allow using fvvarlist (I get the following error if I try "cx1#c: operator invalid".)
Is it possible to (manually?) compute the marginal effect of the variable without depending on fvvarlist? E.g., could I replicate the code above without defining interaction terms using fvvarlist?
Many thanks,
Mihir
I am working with a smal panel dataset (N=20, T=20) on Stata 15. I first estimate an equation like this:
y = a + b1x1 +b2x2 + b3x1*x2 (Eq. 1) where x1 and x2 are continuous variables and b1, b2, b3 are estimated coefficients.
I then want to use the margins command to compute the marginal effect of x1 on y as x2 varies. If I use, say xtreg to estimate equation 1, I can easily do this using the following code. Since I use fvvarlist to write the interaction terms, margins know that two continuous variables are being interacted. When it computes dydx for x1, as x2 varies, it takes this into account and I get different values of the marginal effect for each value of x2 between 0 and 1 (see code below).
Code:
xtreg y c.x1##c.x2, fe r margins, dydx(x1) at(x2=(0(.01)1))
Is it possible to (manually?) compute the marginal effect of the variable without depending on fvvarlist? E.g., could I replicate the code above without defining interaction terms using fvvarlist?
Many thanks,
Mihir
Comment