Announcement

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

  • Help with variance decomposition in a panel data setting

    Suppose I have a panel data setting and I run a regression like this:

    Code:
    webuse nlswork.dta, clear
    reghdfe ln_wage age ttl_exp tenure, absorb(idcode year)
    I would like to understand the relative contribution of each regressor (age, ttl_exp and tenure) separately to explain the variance of ln_wage.

    Any ideas on how can I perform that in a panel data setting like this?

    It would be great if I could do it by groups. Suppose age and ttl_exp are in a group and tenure in another. I would like to understand the contribution of the two groups instead of the three variables.

  • #2
    Originally posted by Wagner Oliveira View Post

    It would be great if I could do it by groups. Suppose age and ttl_exp are in a group and tenure in another. I would like to understand the contribution of the two groups instead of the three variables.
    Once you account for individual and time effects, the contribution of an individual regressor is probably very small. If you are thinking in terms of the output of nestreg, then the change in \(R^2\) is the difference in the statistic between nested regressions whereas the F-statistic for a block of regressors can be generated using the test command. This generalizes to the linear fixed effects model.

    Code:
    webuse census4, clear
    nestreg: regress brate (medage) (pop)
    
    *F-STATS
    qui regress brate medage
    test medage
    
    qui regress brate medage pop
    test pop
    Res.:

    Code:
    . nestreg: regress brate (medage) (pop)
    
    Block  1: medage
    
          Source |       SS           df       MS      Number of obs   =        50
    -------------+----------------------------------   F(1, 48)        =    164.72
           Model |  32675.1044         1  32675.1044   Prob > F        =    0.0000
        Residual |  9521.71561        48  198.369075   R-squared       =    0.7743
    -------------+----------------------------------   Adj R-squared   =    0.7696
           Total |    42196.82        49  861.159592   Root MSE        =    14.084
    
    ------------------------------------------------------------------------------
           brate |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          medage |  -15.24893   1.188141   -12.83   0.000    -17.63785   -12.86002
           _cons |   618.3935   35.15416    17.59   0.000     547.7113    689.0756
    ------------------------------------------------------------------------------
    
    Block  2: pop
    
          Source |       SS           df       MS      Number of obs   =        50
    -------------+----------------------------------   F(2, 47)        =     80.67
           Model |  32677.3425         2  16338.6713   Prob > F        =    0.0000
        Residual |  9519.47749        47  202.542074   R-squared       =    0.7744
    -------------+----------------------------------   Adj R-squared   =    0.7648
           Total |    42196.82        49  861.159592   Root MSE        =    14.232
    
    ------------------------------------------------------------------------------
           brate |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          medage |  -15.29296   1.271534   -12.03   0.000    -17.85096   -12.73496
             pop |   4.80e-08   4.57e-07     0.11   0.917    -8.71e-07    9.67e-07
           _cons |   619.4771   36.98767    16.75   0.000     545.0676    693.8867
    ------------------------------------------------------------------------------
    
    
      +-------------------------------------------------------------+
      |       |          Block  Residual                     Change |
      | Block |       F     df        df   Pr > F       R2    in R2 |
      |-------+-----------------------------------------------------|
      |     1 |  164.72      1        48   0.0000   0.7743          |
      |     2 |    0.01      1        47   0.9167   0.7744   0.0001 |
      +-------------------------------------------------------------+
    
    .
    .
    .
    . *F-STATS
    
    .
    . qui regress brate medage
    
    .
    . test medage
    
     ( 1)  medage = 0
    
          F(  1,    48) =  164.72
                Prob > F =    0.0000
    
    .
    .
    .
    . qui regress brate medage pop
    
    .
    . test pop
    
     ( 1)  pop = 0
    
          F(  1,    47) =    0.01
                Prob > F =    0.9167

    Comment


    • #3
      Hi Andrew. Thanks a lot for your reply. It is very helpful!

      I achieved what I wanted using nestreg: regress, but it seems to be incompatible with typical fixed effects commands in Stata such as reghdfe, areg and xtreg.

      As of now, I'm implementing using fixed effects 'by hand', like this:

      Code:
      nestreg: regress ln_wage (i.idcode i.year) (age ttl_exp) (tenure)
      Do you know of any other way I could implement something like this?

      Comment


      • #4
        You can write a wrapper for the panel data commands that replicates the nestreg output. But I wouldn't bother, if I had many fixed effects, I would just run several regressions and use the test command.

        Comment

        Working...
        X