Announcement

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

  • Gradually Add Variables to FE Regression

    Hello, I have a country and time fixed effect panel data (1985-2020) and 210 countries. (Using xtreg command)

    I have three questions:

    1. The gradual addition of variable in a regression has a technical term which I forgot. If you know the term please let me know.
    2. Since I have fixed time effect, do I have to include i.year in every line or add it when all variables are in the last command?
    3. How to interpret the years which are statistically significant
    4. Do I also have to interpret sigma e and u?

    Code:
    . xtreg patrat rnd_L1 rinterest govtinfluence researchers exports tertiary i.year, fe vce (cluster countryid)
    
    Fixed-effects (within) regression               Number of obs     =        245
    Group variable: countryid                       Number of groups  =         19
    
    R-squared:                                      Obs per group:
         Within  = 0.3911                                         min =          1
         Between = 0.0360                                         avg =       12.9
         Overall = 0.0497                                         max =         22
    
                                                    F(17, 18)         =          .
    corr(u_i, Xb) = -0.3941                         Prob > F          =          .
    
                                  (Std. err. adjusted for 19 clusters in countryid)
    -------------------------------------------------------------------------------
                  |               Robust
           patrat | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    --------------+----------------------------------------------------------------
           rnd_L1 |   2126.027   968.6726     2.19   0.042     90.92132    4161.133
        rinterest |  -8.623156   61.71921    -0.14   0.890    -138.2904    121.0441
    govtinfluence |   2515.222   1044.284     2.41   0.027     321.2633    4709.181
      researchers |   11.59978   315.6822     0.04   0.971    -651.6239    674.8234
          exports |  -7.59e-09   1.82e-09    -4.16   0.001    -1.14e-08   -3.76e-09
         tertiary |   10.60074   8.216852     1.29   0.213    -6.662226    27.86371
                  |
             year |
            1998  |   2138.259   4477.179     0.48   0.639    -7267.945    11544.46
            2000  |     5272.5   4098.802     1.29   0.215    -3338.763    13883.76
            2002  |   5433.746   4243.408     1.28   0.217    -3481.324    14348.82
            2003  |   6065.682   4394.566     1.38   0.184    -3166.958    15298.32
            2004  |   6909.649   4603.323     1.50   0.151    -2761.574    16580.87
            2005  |    7056.43   4754.351     1.48   0.155    -2932.091    17044.95
            2006  |   6134.375   4363.421     1.41   0.177    -3032.832    15301.58
            2007  |   5170.367   4156.456     1.24   0.229    -3562.024    13902.76
            2008  |   4695.539   4191.898     1.12   0.277    -4111.312    13502.39
            2009  |   4618.774   3998.354     1.16   0.263    -3781.455       13019
            2010  |   5107.141   4140.362     1.23   0.233    -3591.437    13805.72
            2011  |   5420.778    4268.75     1.27   0.220    -3547.533    14389.09
            2012  |    5555.76   4408.601     1.26   0.224    -3706.368    14817.89
            2013  |   5663.731   4642.599     1.22   0.238    -4090.008    15417.47
            2014  |    5477.33   4497.866     1.22   0.239    -3972.337       14927
            2015  |   5693.621   4531.896     1.26   0.225    -3827.539    15214.78
            2016  |   5628.207   4380.078     1.28   0.215    -3573.995    14830.41
            2017  |   5800.678   4414.901     1.31   0.205    -3474.685    15076.04
            2018  |   5906.987   4544.846     1.30   0.210     -3641.38    15455.35
            2019  |   5685.905   4455.138     1.28   0.218    -3673.992     15045.8
            2020  |   5440.221   4256.401     1.28   0.217    -3502.146    14382.59
                  |
            _cons |   2272.985    4108.67     0.55   0.587     -6359.01    10904.98
    --------------+----------------------------------------------------------------
          sigma_u |  18149.373
          sigma_e |   1963.744
              rho |  .98842845   (fraction of variance due to u_i)
    -------------------------------------------------------------------------------

    Thank you.

  • #2
    use reghdfe to absorb the year fixed effect. It is not of general interest. (ssc install reghdfe).

    reghdfe patrat rnd_L1 rinterest govtinfluence researchers exports tertiary , absorb(countryid year) cluster(countryid)
    sometimes "stepwise" is used to reflect adding variables, but normally you use to select variables that are significant by some standard. It is not a good approach. The variables included should reflect the theory.

    unless you have some specific interest in the sigma, you can ignore them.

    Comment


    • #3
      George Ford Thank you for your input. I just noticed that my F statistic is not displayed (Should I rely on rsquared on the left). I noticed that as soon as I switch to robust error I start having this issue. I reckon it's a serious issue for misspecification. I did plot my DV and IV just to see if I can use a non-linear relationship and it looks nothing like any known shape. Any assistance is appreciated
      Click image for larger version

Name:	Graph.jpg
Views:	1
Size:	183.3 KB
ID:	1751928

      Comment


      • #4
        No F usually signals a problem of some sort.

        19 clusters is at below the typical rule of thumb for clustered errors. You may want to boottest (ssc install boottest) the variables of interest.

        Robust errors with panel/clustered data can give you unreliable results (se are way too small).

        What are the reghdfe results?

        Comment


        • #5
          George Ford Again thank you for following up.

          Here's the result of reghdfe

          Code:
          reghdfe PT RND_L1 LVG GI RER EX EDU, absorb(countryid year) cluster(countryid)
          (dropped 1 singleton observations)
          (MWFE estimator converged in 7 iterations)
          
          HDFE Linear regression                            Number of obs   =        244
          Absorbing 2 HDFE groups                           F(   6,     17) =      10.80
          Statistics robust to heteroskedasticity           Prob > F        =     0.0001
                                                            R-squared       =     0.9918
                                                            Adj R-squared   =     0.9900
                                                            Within R-sq.    =     0.2598
          Number of clusters (countryid) =         18       Root MSE        =  1969.1221
          
                                       (Std. err. adjusted for 18 clusters in countryid)
          ------------------------------------------------------------------------------
                       |               Robust
                    PT | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
          -------------+----------------------------------------------------------------
                RND_L1 |    2164.44   964.1444     2.24   0.038     130.2731    4198.607
                   LVG |  -9.488715   62.18688    -0.15   0.881    -140.6916    121.7141
                    GI |   2554.214   1057.312     2.42   0.027     323.4806    4784.947
                   RER |   24.95778   319.3699     0.08   0.939    -648.8538    698.7694
                    EX |  -2.33e-09   5.99e-10    -3.89   0.001    -3.59e-09   -1.07e-09
                   EDU |   10.49908   8.338971     1.26   0.225    -7.094612    28.09277
                 _cons |   7816.972   1592.341     4.91   0.000     4457.427    11176.52
          ------------------------------------------------------------------------------
          
          Absorbed degrees of freedom:
          -----------------------------------------------------+
           Absorbed FE | Categories  - Redundant  = Num. Coefs |
          -------------+---------------------------------------|
             countryid |        18          18           0    *|
                  year |        22           1          21     |
          -----------------------------------------------------+
          * = FE nested within cluster; treated as redundant for DoF computation
          Indeed, I've read that the cluster should minimum 30 but there is no way I can reach that number with the dataset and deadline I have.
          I will try the boottest and get back to you.

          Thank you again

          Comment


          • #6
            George Ford Sorry I forgot to mention that I have a balanced panel data, don't know if that information is relevant here.

            I installed boottest but I don't know how to use.

            Comment


            • #7
              boottest RND_L1

              Comment


              • #8
                But it won’t work after reghdfe. Have to use street.

                Comment


                • #9
                  George Ford Can you please further elaborate, My Stata knowledge is quite basic. Do I have to install another package for 'street' and then which command to type in? Will the output from 'street' be my final regressions results that I need to report, instead of my main command xtreg? or boottest and street (are only robustness test that I need to conduct). Thank you

                  Comment


                  • #10
                    xtreg. Siri doesn't know Stata.

                    clear all
                    sysuse auto, clear
                    reg price weight mpg , cluster(rep78)
                    boottest weight

                    Comment


                    • #11
                      Thank you for your response.

                      I don't know where to input the repetition number here.

                      But I followed you example without (rep 78) and here's what I've got.
                      What can I make of the result below?

                      Code:
                      . xtreg PT RND_L1 LVG EX GI RER EDU i.year, fe vce (cluster countryid)
                      
                      Fixed-effects (within) regression               Number of obs     =        245
                      Group variable: countryid                       Number of groups  =         19
                      
                      R-squared:                                      Obs per group:
                           Within  = 0.3877                                         min =          1
                           Between = 0.0325                                         avg =       12.9
                           Overall = 0.0440                                         max =         22
                      
                                                                      F(17, 18)         =          .
                      corr(u_i, Xb) = -0.3831                         Prob > F          =          .
                      
                                                   (Std. err. adjusted for 19 clusters in countryid)
                      ------------------------------------------------------------------------------
                                   |               Robust
                                PT | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
                      -------------+----------------------------------------------------------------
                            RND_L1 |    2164.44   962.4089     2.25   0.037      142.494    4186.386
                               LVG |  -9.488715   62.07494    -0.15   0.880    -139.9033    120.9259
                                EX |  -2.33e-09   5.98e-10    -3.90   0.001    -3.59e-09   -1.07e-09
                                GI |   2554.214   1055.409     2.42   0.026     336.8824    4771.546
                               RER |   24.95778    318.795     0.08   0.938    -644.8057    694.7213
                               EDU |   10.49908    8.32396     1.26   0.223    -6.988913    27.98707
                                   |
                              year |
                             1998  |   2087.353   4470.809     0.47   0.646    -7305.468    11480.17
                             2000  |   5236.217   4088.405     1.28   0.217    -3353.203    13825.64
                             2002  |   5382.284   4227.416     1.27   0.219    -3499.186    14263.75
                             2003  |   6014.595   4379.043     1.37   0.186    -3185.432    15214.62
                             2004  |   6872.364   4593.117     1.50   0.152    -2777.417    16522.15
                             2005  |   7027.979   4750.897     1.48   0.156    -2953.285    17009.24
                             2006  |   6117.976   4364.503     1.40   0.178    -3051.505    15287.46
                             2007  |   5164.399   4163.899     1.24   0.231    -3583.629    13912.43
                             2008  |    4689.47   4203.356     1.12   0.279    -4141.453    13520.39
                             2009  |   4581.994   3995.849     1.15   0.267    -3812.974    12976.96
                             2010  |   5091.124   4145.518     1.23   0.235    -3618.287    13800.53
                             2011  |   5416.439   4279.219     1.27   0.222    -3573.867    14406.74
                             2012  |   5553.965   4422.742     1.26   0.225    -3737.871     14845.8
                             2013  |    5662.42   4660.256     1.22   0.240    -4128.415    15453.25
                             2014  |   5480.171   4517.319     1.21   0.241    -4010.363    14970.71
                             2015  |   5702.537   4553.131     1.25   0.226    -3863.236    15268.31
                             2016  |   5640.498   4400.157     1.28   0.216    -3603.889    14884.89
                             2017  |   5814.023   4433.433     1.31   0.206    -3500.273    15128.32
                             2018  |   5907.245   4560.699     1.30   0.212    -3674.428    15488.92
                             2019  |   5677.564   4468.463     1.27   0.220    -3710.328    15065.46
                             2020  |   5405.357   4255.616     1.27   0.220    -3535.361    14346.07
                                   |
                             _cons |    2332.33   4084.389     0.57   0.575    -6248.653    10913.31
                      -------------+----------------------------------------------------------------
                           sigma_u |  18137.871
                           sigma_e |  1969.1221
                               rho |  .98835113   (fraction of variance due to u_i)
                      ------------------------------------------------------------------------------
                      
                      . boottest RND_L1
                      
                      Wild bootstrap-t, null imposed, 999 replications, Wald test, bootstrap clustering by countryid, Rademacher weights:
                        RND_L1
                      
                                                 t(18) =     2.2542
                                              Prob>|t| =     0.0821
                      
                      95% confidence set for null hypothesis expression: [−343, 4318]
                      
                      .

                      Comment


                      • #12
                        Yup.

                        Your lack of an F is still a concern. Something isn't kosher. Note that you've got a singleton reported in reghdfe (essentially, the model has a perfectly linear relationship with Y for an observation). I'd track that down. Is the sample balanced?

                        Comment


                        • #13
                          George Ford Thank you for your time.

                          Indeed

                          Code:
                          xtset countryid year 
                          
                          Panel variable: countryid (strongly balanced)
                           Time variable: year, 1985 to 2020
                                   Delta: 1 year

                          Comment


                          • #14
                            This might work. add "residuals" as an option in reghdfe. look at the recorded residuals (a new variables called _reghdfe_residuals, or some such) and see which one is missing. Then figure out why.

                            Comment


                            • #15
                              Thank you immensely for your assistance.

                              There's lots of missing observations from the residuals, and this is due to lack of observations in some of the variables included. Something that is beyond my power.

                              For instance, my main variabkles are patent counts and R&D investment, patent counts have more obs. than R&D when you add other variables the number of obs. drops even lower.

                              What do you recommend doing in my case, provided the data I have?
                              Thank you

                              Code:
                              reghdfe PT RND_L1 LVG GI RER EX EDU, absorb(countryid year) residuals cluster(countryid)
                              (dropped 1 singleton observations)
                              (MWFE estimator converged in 7 iterations)
                              
                              HDFE Linear regression                            Number of obs   =        244
                              Absorbing 2 HDFE groups                           F(   6,     17) =      10.80
                              Statistics robust to heteroskedasticity           Prob > F        =     0.0001
                                                                                R-squared       =     0.9918
                                                                                Adj R-squared   =     0.9900
                                                                                Within R-sq.    =     0.2598
                              Number of clusters (countryid) =         18       Root MSE        =  1969.1221
                              
                                                           (Std. err. adjusted for 18 clusters in countryid)
                              ------------------------------------------------------------------------------
                                           |               Robust
                                        PT | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
                              -------------+----------------------------------------------------------------
                                    RND_L1 |    2164.44   964.1444     2.24   0.038     130.2731    4198.607
                                       LVG |  -9.488715   62.18688    -0.15   0.881    -140.6916    121.7141
                                        GI |   2554.214   1057.312     2.42   0.027     323.4806    4784.947
                                       RER |   24.95778   319.3699     0.08   0.939    -648.8538    698.7694
                                        EX |  -2.33e-09   5.99e-10    -3.89   0.001    -3.59e-09   -1.07e-09
                                       EDU |   10.49908   8.338971     1.26   0.225    -7.094612    28.09277
                                     _cons |   7816.972   1592.341     4.91   0.000     4457.427    11176.52
                              ------------------------------------------------------------------------------
                              
                              Absorbed degrees of freedom:
                              -----------------------------------------------------+
                               Absorbed FE | Categories  - Redundant  = Num. Coefs |
                              -------------+---------------------------------------|
                                 countryid |        18          18           0    *|
                                      year |        22           1          21     |
                              -----------------------------------------------------+
                              * = FE nested within cluster; treated as redundant for DoF computation
                              
                              . sum _reghdfe_resid
                              
                                  Variable |        Obs        Mean    Std. dev.       Min        Max
                              -------------+---------------------------------------------------------
                              _reghdfe_r~d |        244    6.11e-09    1781.952  -17067.15   5727.225

                              Comment

                              Working...
                              X