Announcement

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

  • Issue with using margins after reghdfe

    Hello,

    I am trying to understand better the relationship of a quadratic term and the dependent variable. Unfortunately, I am having trouble with the margins command even after forcing an estimation with noestimcheck. Any idea what could be the problem?


    Code:
    * Regression for full sample 
    reghdfe fouls_rate c.abs_crew_mean_diff##c.abs_crew_mean_diff $controls [aw=min], absorb(player_year gameid) vce(cluster player_year gameid)
    margins, at(abs_crew_mean_diff = (0(5)30)) noestimcheck

    The resulting output being the below mostly empty margins table.

    Code:
    . margins, at(abs_crew_mean_diff = (0(5)30)) noestimcheck
    warning: variance matrix is nonsymmetric or highly singular.
    
    Predictive margins                                      Number of obs = 80,324
    Model VCE: Robust
    
    Expression: Linear prediction, predict()
    1._at: abs_crew_mean_~f =  0
    2._at: abs_crew_mean_~f =  5
    3._at: abs_crew_mean_~f = 10
    4._at: abs_crew_mean_~f = 15
    5._at: abs_crew_mean_~f = 20
    6._at: abs_crew_mean_~f = 25
    7._at: abs_crew_mean_~f = 30
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |     Margin   std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             _at |
              1  |   3.679857          .        .       .            .           .
              2  |   3.720406          .        .       .            .           .
              3  |   3.717581          .        .       .            .           .
              4  |   3.671381          .        .       .            .           .
              5  |   3.581808          .        .       .            .           .
              6  |    3.44886          .        .       .            .           .
              7  |   3.272538          .        .       .            .           .
    ------------------------------------------------------------------------------
    
    .
    Best,
    KC

  • #2
    Do margins for or two at a time
    otherwise you need to modify the vcv matrix to be symmetrical
    right now it is not due to small precision discrepancies

    Comment


    • #3
      Hello Fernando,

      Thank you very much for such a quick reply. My apologies, but I'm not sure that I follow what you are suggesting.

      Best,
      KC

      Comment


      • #4
        It is a technical problem
        Its not that you cannot estimate margins after reghdfe, but that because of the two-way errors, clusters, etc. When Margins tries to estimate the VCV for all "at values", there are small differences in the numerical differentiation. Because of this, your VCV comes as nonsymmetrical, and margins trows the error you see.

        Two options:
        - Easy: Do margins for one "at" at a time.
        - Hard: get the e(V) from margins, make a transformation that makes it symetrical, but it back into the regression. And done.

        Second one requires some programming.


        Comment

        Working...
        X