Announcement

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

  • Counterfactual Simulation Using Margins

    Dear members
    I am running an Arelleno Bond regression on a panel data with where the time period is 40 and panels are 289



    Code:
    xtabond2 output l(1/2).output input_L L.input_L input_F L.input_F input_T L. input_T input_R input_I L.input_I c.input_I#c.input_R c.input_I#cL.input_R, gmm(input_L input_F input_T input_I L.logvop, lag(2 2)) iv(input_R) nolevel two robust small

    Post the estimation I want to make counterfactual simulation.
    Specifically I want to see what would be the values of the dependent variable (output) if input_R was 5% 10% and 15% below its actual values. Then I want to plot these values together o na graph
    Below is the figure from the paper that I am following


    Click image for larger version

Name:	Untitled.png
Views:	1
Size:	47.3 KB
ID:	1461846



    I have gone through earlier posts that seem to suggest that the margins command adjusted prediction at means will help in this but I am still not clear how to do this.
    Any help will be appreciated



  • #2
    You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex.

    It seem quite easy to do what you want. You simply insert the values for rain in the at() statements. Something like: margins, at(year=0(1)10) rain=(whatever values you want))

    Comment


    • #3
      Thank you for your reply and suggestion. I try to follow it below

      I run an xtabond2 on a panel dataset with time period=40 and panels=289. The code that I run is as follows

      Code:
      xtabond2 output l(1/2).output input_L L.input_L input_F L.input_F input_T L. input_T input_R input_I L.input_I c.input_I#c.input_R c.input_I#cL.input_R, gmm(input_L input_F input_T input_I L.logvop, lag(2 2)) iv(input_R) nolevel two robust small

      I want to make a counterfactual simulation post the estimation. I try is to get a base scenario of the values of the dependent variables if all the variables are set at the mean. And follow it with counterfactual of what will be the value of the dependent variable if I reduce input_R by 5%, 10% and 15%.

      Margins does not recognize the at() statement for year as year is not included in my model as an explanatory variable.
      So I try the margins command with over(year) setting all other variables atmeans

      Code:
      margins, over(YEAR) atmeans
      But I still cannot figure out how to generate the counterfactuals.
      It does seem easy enough but somehow I am not able to figure it out. Would appreciate any suggestions.

      Thank you

      Comment

      Working...
      X