Announcement

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

  • Margin plots after xtreg not working

    I have researched a lot on internet on different forums and could not find any satisfactory answer. I tried a lot but some how I cant get output of marginsplot after fixed effect regression.
    Here is the code:
    Code:
    xtreg ES l.ES  INT  PAT_POP c.FDI##c.DCPP##c.Employers TAX_REV GDPGR trend, fe vce(robust)
    Code:
    margins, at( FDI=(-46(132)86) Employers=(0(2)2) DCPP=(2(3.3)5.3)) plot
    When I run the same after Pooled OLS and xtabond2 it works, but it does not work after xtreg......,fe and xtreg...., re.
    The stata gives the following message
    default prediction is a function of possibly stochastic quantities other than e(b)

    I will appreciate any clue.
    Regards
    Zubair Khan

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

    Have you tried doing the margins without the plot option and then use marginsplot? It sounds like the problem is in your margin statement, not the plot. By the way, if you only want to do it for two values, instead of the increment representation you use, you can just list the two values. However, you're going to get a somewhat odd looking plot when you only have two values of each of three variables. It is quite common instead to have many values for one of the variables.

    Comment


    • #3
      The problem is lagged dependent variable as a regressor. You could use the -force- option, but a dynamic panel data model should be used instead.

      Comment


      • #4
        Originally posted by Scott Merryman View Post
        The problem is lagged dependent variable as a regressor. You could use the -force- option, but a dynamic panel data model should be used instead.
        Thank you so much Scott. It works without lagged depvar though it's strange as the same model can be plotted with OLS and GMM. I would be interested in force option, would you post how to use force option?

        Comment


        • #5
          For example:
          Code:
          webuse grunfeld
          xtreg invest l.invest kstock,fe
          margins, at(kstock = (200 400)) atmeans force

          Comment


          • #6
            Thank you Scott. That's so kindness. Simply I put force at the end, and it works.

            Comment

            Working...
            X