Announcement

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

  • Marginsplot with no constant - for Treatment Effect only and not Outcome value Y

    Hi there,

    I am running a household fixed effects model on some panel data to estimate the effect of 'length of exposure (in months) to the intervention' on a bunch of outcome indicators, and I want to use marginsplot to see how the 'treatment effect' varies over months of exposure. My model (which includes a second order team) is as follows:

    xtreg outcome exposure exposure_sq, fe cluster(ea)

    In order to get the figure that I want (i.e. treatment effect only and not the fitted values of the outcome variable), I would need to exclude the constant that is estimated in the regression but I am unable to do this.

    Instead of using marginsplot, I did consider using the twoway function approach where I use:

    twoway function y=_b[exposure]*x + _b[exposure_sq]*x^2

    This works very well - but I can't plot the confidence intervals - hence the need for marginsplot.

    Does anybody have a suggestion? I would be very grateful.

    Thanks very much!

  • #2
    Well, you will get incorrect results from -margins- and -marginsplot- because your model is not coded correctly for use with -margins-. You cannot use your own quadratic term if you are going to use -margins-, you must use factor variable notation.
    So re-do your model in accordance with this code, and then -margins- will do what you need:

    Code:
    xtreg outcome c.exposure##c.exposure, fe vce(cluster ea)
    margins, dydx(exposure) ///
        at(exposure = (numlist_of_interesting_values_of_exposure))
    margnsplot
    Replace numlist_of_interesting_values_of_exposure by a list of the values of variable exposure that cover the range you want on the horizontal axis of your graph.

    Comment

    Working...
    X