Announcement

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

  • time invariant variables and fixed effects

    Dear All,

    I wish to estimate the following panel data model using xtreg, fe
    yit = xitβ + γDi + uit
    where D is a time-invariant dummy variable. Estimating the above model following fixed effects method it is not possible to estimate the coefficient γ because due to the fixed-effects transformation, the effect of any time-invariant variable cannot be separated from the fixed-effects.
    Running the model bellow using regress , namely using OLS of the modified x on modified y, what would be the interpretation of the coefficient δ about the relation between y and D?
    (yit-ȳ*i)= (xit –x̄*i) β + δDi + (uit*-ūi)
    where ȳ*I,x̄i*, ūI are the average values of y,x and u over time.

  • #2
    Georgios:
    welcome to this forum.
    Your last code seems an OLS run on first-differenced data, which is another way to apply the within estimator (that is, fixed effect) and does not fix the unfeasible estimate of time-invariant predictors.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      You cannot simply transform the variables y and X but leave D unchanged. That would be a completely different model. You might want to have a look at so-called hybrid or correlated random-effects estimators. Searching through the forum here will bring up several discussions on that matter.
      https://www.kripfganz.de/stata/

      Comment


      • #4
        Thank you very much,

        Georgios

        Comment


        • #5
          Georgios, you cannot estimate δ in (yit-ȳ*i)= (xit –x̄*i) β + δDi + (uit*-ūi).

          Just try it (on a balanced panel data), and you will see that Stata either drops all Di variables because they are collinear with the constant, or the coefficients on all Di are basically 0 with a p-value of 1.

          Comment


          • #6
            Hi Joro
            I haven’t had mean-centering of the dummy variable D as I have done with the others (y and x). So, it has not been removed from the equation and the estimation of δ by OLS is feasible, but this has little to say about the relation between D and y (as Sebastian posted, that would be a completely different model).

            Best ,

            Georgios.

            Comment


            • #7
              The estimation of parameters on Di is *not* feasible in a regression where the within transformation has been applied to both y and x variables. Either you have errors in the code, or you have unbalanced panel data.

              If you do not have errors in the code, and your panel is balances you should be getting 0 estimated slopes on all Di variables as in the example below:

              Code:
              . webuse invest2, clear
              
              . xtset company time
                     panel variable:  company (strongly balanced)
                      time variable:  time, 1 to 20
                              delta:  1 unit
              
              . egen meanmarket = mean(market), by(company)
              
              . egen meanstock = mean(stock), by(company)
              
              . gen mkt = market - meanmarket
              
              . gen stk = stock - meanstock
              
              . reg mkt stk i.company
              
                    Source |       SS           df       MS      Number of obs   =       100
              -------------+----------------------------------   F(5, 94)        =      3.01
                     Model |  3025603.47         5  605120.694   Prob > F        =    0.0146
                  Residual |  18918211.6        94   201257.57   R-squared       =    0.1379
              -------------+----------------------------------   Adj R-squared   =    0.0920
                     Total |  21943815.1        99  221654.698   Root MSE        =    448.62
              
              ------------------------------------------------------------------------------
                       mkt |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
              -------------+----------------------------------------------------------------
                       stk |   .5645685   .1456085     3.88   0.000     .2754594    .8536776
                           |
                   company |
                        2  |    .000175   141.8653     0.00   1.000    -281.6767     281.677
                        3  |   .0002402   141.8653     0.00   1.000    -281.6766    281.6771
                        4  |   .0001641   141.8653     0.00   1.000    -281.6767     281.677
                        5  |   .0002497   141.8653     0.00   1.000    -281.6766    281.6771
                           |
                     _cons |  -.0001953   100.3139    -0.00   1.000    -199.1758    199.1754
              ------------------------------------------------------------------------------
              
              .

              Comment


              • #8
                Hi Joro

                You are right.

                However, in your example the "i.company" variable represents the firm-specific fixed effects of the model. To calculate these effects try this:
                Run the within effect model keeping in mind that you have to suppress the constant term:

                reg mkt stk , nocons Then you may compute the fixed effects:
                gen fixedeffects= meanmarket-_b[stk]*meanstock Moreover the R2 of the above model is incorect as well as the standard error of the coefficient
                Nonetheless, the estimates incorporate all the time-invariant effects Best
                Georgios

                Comment


                • #9
                  Georgios, the fixed effect estimates recovered as in your #8, are estimates of γ in your #1, eq. yit = xitβ + γDi + uit.

                  The estimates of δ in (yit-ȳ*i)= (xit –x̄*i) β + δDi + (uit*-ūi) in your #1 are identically 0. (Yes, standard errors are not correct because there are 5 degrees of freedom lost. It does not matter, the estimates of δ are identically 0.)

                  Coincidentally also what Sebastian said is incorrect. (yit-ȳ*i)= (xit –x̄*i) β + δDi + (uit*-ūi) is not "a completely different model", it is a degenerate model in which δ is identically 0, and β is numerically equivalent to the estimated β in (yit-ȳ*i)= (xit –x̄*i) β + (uit*-ūi) and is numerically equivalent to the estimated β in yit = xitβ + γDi + uit..

                  Code:
                  . xtreg market stock, fe
                  
                  Fixed-effects (within) regression               Number of obs     =        100
                  Group variable: company                         Number of groups  =          5
                  
                  R-sq:                                           Obs per group:
                       within  = 0.1379                                         min =         20
                       between = 0.9529                                         avg =       20.0
                       overall = 0.3740                                         max =         20
                  
                                                                  F(1,94)           =      15.03
                  corr(u_i, Xb)  = 0.5369                         Prob > F          =     0.0002
                  
                  ------------------------------------------------------------------------------
                        market |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                  -------------+----------------------------------------------------------------
                         stock |   .5645685   .1456085     3.88   0.000     .2754594    .8536776
                         _cons |   1746.604   63.75047    27.40   0.000     1620.026    1873.182
                  -------------+----------------------------------------------------------------
                       sigma_u |  1365.6173
                       sigma_e |   448.6174
                           rho |   .9025938   (fraction of variance due to u_i)
                  ------------------------------------------------------------------------------
                  F test that all u_i=0: F(4, 94) = 131.90                     Prob > F = 0.0000
                  
                  . tab company, gen(d)
                  
                      company |      Freq.     Percent        Cum.
                  ------------+-----------------------------------
                            1 |         20       20.00       20.00
                            2 |         20       20.00       40.00
                            3 |         20       20.00       60.00
                            4 |         20       20.00       80.00
                            5 |         20       20.00      100.00
                  ------------+-----------------------------------
                        Total |        100      100.00
                  
                  . reg market stock d1-d5, nocons noheader
                  ------------------------------------------------------------------------------
                        market |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                  -------------+----------------------------------------------------------------
                         stock |   .5645685   .1456085     3.88   0.000     .2754594    .8536776
                            d1 |   3967.759   137.7591    28.80   0.000     3694.235    4241.283
                            d2 |   624.7589   101.8555     6.13   0.000     422.5223    826.9955
                            d3 |   1715.407   116.0081    14.79   0.000      1485.07    1945.744
                            d4 |   622.5604    101.086     6.16   0.000     421.8518     823.269
                            d5 |   1802.536   109.4038    16.48   0.000     1585.312     2019.76
                  ------------------------------------------------------------------------------
                  
                  . reg mkt stk, nocons noheader
                  ------------------------------------------------------------------------------
                           mkt |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                  -------------+----------------------------------------------------------------
                           stk |   .5645685   .1418839     3.98   0.000     .2830401    .8460969
                  ------------------------------------------------------------------------------
                  
                  . reg mkt stk d1-d5, nocons noheader
                  ------------------------------------------------------------------------------
                           mkt |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                  -------------+----------------------------------------------------------------
                           stk |   .5645685   .1456085     3.88   0.000     .2754594    .8536776
                            d1 |  -.0001953   100.3139    -0.00   1.000    -199.1758    199.1754
                            d2 |  -.0000203   100.3139    -0.00   1.000    -199.1756    199.1756
                            d3 |   .0000449   100.3139     0.00   1.000    -199.1756    199.1756
                            d4 |  -.0000312   100.3139    -0.00   1.000    -199.1756    199.1756
                            d5 |   .0000544   100.3139     0.00   1.000    -199.1755    199.1757
                  ------------------------------------------------------------------------------
                  
                  . gen fixedeffects= meanmarket-_b[stk]*meanstock
                  
                  . tab company, summ(fixedeffects)
                  
                              |       Summary of fixedeffects
                      company |        Mean   Std. Dev.       Freq.
                  ------------+------------------------------------
                            1 |   3967.7593           0          20
                            2 |   624.75891           0          20
                            3 |   1715.4072           0          20
                            4 |   622.56036           0          20
                            5 |   1802.5363           0          20
                  ------------+------------------------------------
                        Total |   1746.6044   1227.5987         100
                  
                  .

                  Comment


                  • #10
                    Joro is completely right. The time-invariant dummy variables are orthogonal to both the mean deviations of the dependent and the time-varying independent variables. As a consequence, you can obtain the coefficients from the joint regression (yit-ȳ*i)= (xit –x̄*i) β + δDi + (uit*-ūi) also from separate regressions (yit-ȳ*i)= (xit –x̄*i) β + (uit*-ūi) and (yit-ȳ*i)= δDi + vit:
                    Code:
                    . reg mkt stk, nocons
                    
                          Source |       SS           df       MS      Number of obs   =       100
                    -------------+----------------------------------   F(1, 99)        =     15.83
                           Model |  3025603.47         1  3025603.47   Prob > F        =    0.0001
                        Residual |  18918211.6        99  191093.047   R-squared       =    0.1379
                    -------------+----------------------------------   Adj R-squared   =    0.1292
                           Total |  21943815.1       100  219438.151   Root MSE        =    437.14
                    
                    ------------------------------------------------------------------------------
                             mkt |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                    -------------+----------------------------------------------------------------
                             stk |   .5645685   .1418839     3.98   0.000     .2830401    .8460969
                    ------------------------------------------------------------------------------
                    
                    . reg mkt i.company
                    
                          Source |       SS           df       MS      Number of obs   =       100
                    -------------+----------------------------------   F(4, 95)        =      0.00
                           Model |  7.7859e-07         4  1.9465e-07   Prob > F        =    1.0000
                        Residual |  21943815.1        95  230987.527   R-squared       =    0.0000
                    -------------+----------------------------------   Adj R-squared   =   -0.0421
                           Total |  21943815.1        99  221654.698   Root MSE        =    480.61
                    
                    ------------------------------------------------------------------------------
                             mkt |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                    -------------+----------------------------------------------------------------
                         company |
                              2  |    .000174   151.9827     0.00   1.000    -301.7237    301.7241
                              3  |    .000238   151.9827     0.00   1.000    -301.7236    301.7241
                              4  |   .0001648   151.9827     0.00   1.000    -301.7237     301.724
                              5  |   .0002441   151.9827     0.00   1.000    -301.7236    301.7241
                                 |
                           _cons |  -.0001953    107.468    -0.00   1.000    -213.3512    213.3508
                    ------------------------------------------------------------------------------
                    Moreover, it follows from analytical inspection of the OLS formula that the coefficients δ must be exactly zero. The small deviations from zero in the regression output are a result of numerical inaccuracies when computing the estimator in Stata.
                    https://www.kripfganz.de/stata/

                    Comment

                    Working...
                    X