Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with using -margins- command without using -fvvarlist-

    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).
    Code:
    xtreg y c.x1##c.x2, fe r
    margins, dydx(x1) at(x2=(0(.01)1))
    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

  • #2
    With nice linear models, you can easily calculate the derivatives from the original parameters. If
    y = a x1 + b x2 + c x1*x2
    dy/dx1= a + c x2
    If you want statistics some of the test routines will do them for you.

    Comment


    • #3
      Thanks Phil. To generate confidence intervals, could you please suggest some test routines that I could use?

      Comment

      Working...
      X