Announcement

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

  • Testing for equality of marginal effects

    In the following example, I run a regression with quadratic term in the independent variable, followed by the computation of marginal effects at different values of the regressor. Subsequently, I would like to test for equality of the marginal effects at different values of the regressor. What does not make sense to me is that the test command produces identical test statistics for the comparison of the marginal effects at different values. Clearly, these test statistics should be different. Is this a bug or am I doing something fundamentally wrong here?

    Code:
    . sysuse nlsw88
    (NLSW, 1988 extract)
    
    . regress wage c.ttl_exp##c.ttl_exp
    
          Source |       SS           df       MS      Number of obs   =     2,246
    -------------+----------------------------------   F(2, 2243)      =     87.46
           Model |  5379.78611         2  2689.89305   Prob > F        =    0.0000
        Residual |  68988.1813     2,243  30.7571027   R-squared       =    0.0723
    -------------+----------------------------------   Adj R-squared   =    0.0715
           Total |  74367.9674     2,245  33.1260434   Root MSE        =    5.5459
    
    -------------------------------------------------------------------------------------
                   wage | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    --------------------+----------------------------------------------------------------
                ttl_exp |   .5570376   .1093103     5.10   0.000     .3426777    .7713976
                        |
    c.ttl_exp#c.ttl_exp |  -.0094074   .0044334    -2.12   0.034    -.0181014   -.0007135
                        |
                  _cons |   2.462498   .6392859     3.85   0.000     1.208844    3.716152
    -------------------------------------------------------------------------------------
    
    . margins, dydx(ttl_exp) at(ttl_exp=(5(5)25)) post
    
    Conditional marginal effects                             Number of obs = 2,246
    Model VCE: OLS
    
    Expression: Linear prediction, predict()
    dy/dx wrt:  ttl_exp
    1._at: ttl_exp =  5
    2._at: ttl_exp = 10
    3._at: ttl_exp = 15
    4._at: ttl_exp = 20
    5._at: ttl_exp = 25
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
    ttl_exp      |
             _at |
              1  |   .4629635   .0669852     6.91   0.000      .331604    .5943229
              2  |   .3688893   .0309232    11.93   0.000     .3082482    .4295304
              3  |   .2748151   .0368297     7.46   0.000     .2025913    .3470389
              4  |   .1807409   .0754159     2.40   0.017     .0328486    .3286332
              5  |   .0866667   .1181086     0.73   0.463    -.1449469    .3182803
    ------------------------------------------------------------------------------
    
    . test 1._at = 2._at
    
     ( 1)  [ttl_exp]1bn._at - [ttl_exp]2._at = 0
    
           F(  1,  2243) =    4.50
                Prob > F =    0.0340
    
    . test 1._at = 3._at
    
     ( 1)  [ttl_exp]1bn._at - [ttl_exp]3._at = 0
    
           F(  1,  2243) =    4.50
                Prob > F =    0.0340
    
    . test 1._at = 4._at
    
     ( 1)  [ttl_exp]1bn._at - [ttl_exp]4._at = 0
    
           F(  1,  2243) =    4.50
                Prob > F =    0.0340
    
    . test 1._at = 5._at
    
     ( 1)  [ttl_exp]1bn._at - [ttl_exp]5._at = 0
    
           F(  1,  2243) =    4.50
                Prob > F =    0.0340
    https://www.kripfganz.de/stata/

  • #2
    Are you sure about thT
    I think what you are trying to do is equivalent to estimating the second derivative. Marginal effects of a marginal effect, which in a quadratic model depends only on the coefficient of the squared parameter
    this explains why the comparison tests all give the same results

    Comment


    • #3
      But that is not what those commands should be doing, should they? The post option of the margins command should post the computed marginal effects to e(b) and e(V) as if they were regression estimates:
      Code:
      . matrix list e(b)
      
      e(b)[1,5]
            ttl_exp:   ttl_exp:   ttl_exp:   ttl_exp:   ttl_exp:
                  1.         2.         3.         4.         5.
                _at        _at        _at        _at        _at
      y1  .46296345  .36888927  .27481509   .1807409  .08666672
      I am then testing whether the first coefficient (marginal effect) equals the second one, and then whether the first equals the third one, ....
      https://www.kripfganz.de/stata/

      Comment


      • #4
        Fernando has the right idea. I've attached a PDF to illustrate what is going on here.

        quadratic.pdf
        Attached Files
        Last edited by Jeff Pitblado (StataCorp); 19 Nov 2023, 12:26.

        Comment


        • #5
          Excellent. Thank you very much. That's insightful.
          https://www.kripfganz.de/stata/

          Comment

          Working...
          X