Announcement

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

  • Which observations are not dropped with xtreg but dropped with reghdfe (singleton observations)

    Hello,

    I found that several hundred observations in my data are dropped if I use reghdfe compared to when I use xtreg. It says it drops singleton observations, but I cannot really understand why these observations are singleton observations and thus dropped. They are not dropped if I use xtreg. This means the sample sizes are different when I use reghdfe and xtreg. These dropped observations are not limited to the cases where there is only one observation (per person). Is there anyone who knows how to idenfity why each observation is singleton observation or not? I really want to understand why the sample size gets smaller when I use reghdfe compared to xtreg.

    Thank you so much!!

  • #2
    Your chances of getting a helpful response would be greatly improved if you showed example data (use -dataex- for that) as well as the exact -xtreg- and -reghdfe- commands that exhibit this problem.

    If you are running version 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    Comment


    • #3
      Halim:
      as an aside to Clyde's helpful advice, the -reghdfe- help file highlights that:
      e) Iteratively removes singleton groups by default, to avoid biasing the standard errors (see ancillary document).
      Therefore, the remotion of singletons is related to the way the standard errors are calculated, that differs between -xtreg,fe- and the community-contributed module -xtoverid-.
      You may also come across omission due to list wise deletion, that Stata applies to each and every observation with missing value(s) in any of the variables.

      The following toy-example can hopefully give you some clues about this issue:
      Code:
      . use "https://www.stata-press.com/data/r17/nlswork.dta"
      (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
      
      . reghdfe ln_wage c.age##c.age, abs(idcode year) vce(cluster idcode)
      (dropped 551 singleton observations)
      (MWFE estimator converged in 8 iterations)
      
      HDFE Linear regression                            Number of obs   =     27,959
      Absorbing 2 HDFE groups                           F(   2,   4158) =      44.91
      Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                        R-squared       =     0.6593
                                                        Adj R-squared   =     0.5995
                                                        Within R-sq.    =     0.0115
      Number of clusters (idcode)  =      4,159         Root MSE        =     0.3013
      
                                   (Std. err. adjusted for 4,159 clusters in idcode)
      ------------------------------------------------------------------------------
                   |               Robust
           ln_wage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
      -------------+----------------------------------------------------------------
               age |   .0728746   .0136873     5.32   0.000     .0460402    .0997089
                   |
       c.age#c.age |  -.0010113   .0001076    -9.39   0.000    -.0012224   -.0008003
                   |
             _cons |   .4586164   .3651743     1.26   0.209    -.2573205    1.174553
      ------------------------------------------------------------------------------
      
      Absorbed degrees of freedom:
      -----------------------------------------------------+
       Absorbed FE | Categories  - Redundant  = Num. Coefs |
      -------------+---------------------------------------|
            idcode |      4159        4159           0    *|
              year |        15           0          15     |
      -----------------------------------------------------+
      * = FE nested within cluster; treated as redundant for DoF computation
      
      . xtreg ln_wage c.age##c.age i.year,  vce(cluster idcode)
      
      Random-effects GLS regression                   Number of obs     =     28,510
      Group variable: idcode                          Number of groups  =      4,710
      
      R-squared:                                      Obs per group:
           Within  = 0.1161                                         min =          1
           Between = 0.1085                                         avg =        6.1
           Overall = 0.0936                                         max =         15
      
                                                      Wald chi2(16)     =    1562.37
      corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
      
                                   (Std. err. adjusted for 4,710 clusters in idcode)
      ------------------------------------------------------------------------------
                   |               Robust
           ln_wage | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
               age |   .0796275   .0059355    13.42   0.000     .0679941    .0912609
                   |
       c.age#c.age |  -.0010976   .0001013   -10.83   0.000    -.0012962    -.000899
                   |
              year |
               69  |   .0637492   .0101545     6.28   0.000     .0438467    .0836517
               70  |   .0244819   .0106043     2.31   0.021     .0036978    .0452659
               71  |   .0509767   .0116758     4.37   0.000     .0280925    .0738609
               72  |   .0449968   .0130061     3.46   0.001     .0195054    .0704883
               73  |    .033712   .0141079     2.39   0.017      .006061    .0613629
               75  |   .0007332   .0167184     0.04   0.965    -.0320343    .0335007
               77  |   .0195207    .019748     0.99   0.323    -.0191847    .0582261
               78  |    .040391   .0214546     1.88   0.060    -.0016594    .0824413
               80  |   .0201939   .0246534     0.82   0.413     -.028126    .0685137
               82  |    .017258   .0274902     0.63   0.530    -.0366218    .0711378
               83  |   .0387877   .0295387     1.31   0.189    -.0191072    .0966825
               85  |   .0848054   .0326423     2.60   0.009     .0208277    .1487831
               87  |    .102961   .0366035     2.81   0.005     .0312194    .1747027
               88  |   .1663279    .039915     4.17   0.000      .088096    .2445598
                   |
             _cons |   .2738513   .0811817     3.37   0.001     .1147381    .4329646
      -------------+----------------------------------------------------------------
           sigma_u |  .36296996
           sigma_e |  .30127563
               rho |  .59208444   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      
      . bysort idcode: gen wanted=1 if year[1]==year[_N]
      
      . tab wanted
      
           wanted |      Freq.     Percent        Cum.
      ------------+-----------------------------------
                1 |        547      100.00      100.00
      ------------+-----------------------------------
            Total |        547      100.00
      .
      Last edited by Carlo Lazzaro; 05 Mar 2023, 05:22.
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        These dropped observations are not limited to the cases where there is only one observation (per person)
        To expand on Carlo's point, you need to look at the estimation sample in the regressions instead of the full dataset.

        Is there anyone who knows how to idenfity why each observation is singleton observation or not?
        See #4 https://www.statalist.org/forums/for...n-observations
        Last edited by Andrew Musau; 05 Mar 2023, 05:17.

        Comment


        • #5
          Thank you so much for your reply Clyde Schechter Carlo Lazzaro Andrew Musau ! I will provide my data as an example this time. I am sorry I didn't because there was an error message saying input statement exceeds linesize limit. I just cut off many of the variables.

          Code:
          * Example generated by -dataex-. To install: ssc install dataex
          clear
          input long rahhidpn str7 house_id float(wave age a0 female edu_4c race4 hhnumber rwmstat marr_partn child_n child_10mile cond8num_ever cond8miss_num homeown rwbmi randadl0_5 rearning_adj searning_adj eventm3 eventm2 eventm1 event0 event1 event2 event3)
          10571010 "0105710" 2002 61 -2 1 1 2 2 7 0 4 0 3 0 1   32 1  5583.258         . 0 1 0 0 0 0 0
          10672031 "0106722" 2004 59 -2 1 4 2 1 4 0 . 0 5 0 1 24.8 3         0         . 0 1 0 0 0 0 0
          10672031 "0106722" 2006 61 -1 1 4 2 1 5 0 1 0 5 0 1 31.5 5         0         . 0 0 1 0 0 0 0
          10822010 "0108220" 2002 60 -1 0 2 1 2 1 1 4 1 0 0 1 23.6 0         0         0 0 0 1 0 0 0 0
          10822040 "0108220" 2008 61 -3 1 3 1 2 1 1 4 1 2 0 1 25.2 0         0         0 1 0 0 0 0 0 0
          11256010 "0112560" 2002 61 -3 0 3 1 3 1 1 0 . 2 0 0 27.6 0  32103.73         0 1 0 0 0 0 0 0
          12172010 "0121720" 2002 60 -2 1 1 2 2 1 1 6 0 2 0 1 37.1 0 26520.475  41874.43 0 1 0 0 0 0 0
          12345020 "0123450" 2002 61 -1 1 2 1 1 7 0 3 0 0 0 1 25.7 0         0         . 0 0 1 0 0 0 0
          12549040 "0125492" 2004 51 -2 1 4 4 2 5 0 3 0 0 0 1 21.5 0 114852.55         . 0 1 0 0 0 0 0
          12549040 "0125492" 2006 54 -1 1 4 4 2 5 0 . . 0 0 0 21.6 0  118329.2         . 0 0 1 0 0 0 0
          12549040 "0125492" 2008 55  0 1 4 4 1 5 0 0 . 0 0 1 21.6 0  115463.3         . 0 0 0 1 0 0 0
          12549040 "0125492" 2010 58  1 1 4 4 1 5 0 0 . 1 0 0 20.8 0  211263.5         . 0 0 0 0 1 0 0
          12549040 "0125492" 2012 59  2 1 4 4 1 5 0 0 . 1 0 0 19.3 0  68246.89         . 0 0 0 0 0 1 0
          12549040 "0125492" 2014 61  3 1 4 4 1 5 0 0 . 1 0 0 21.5 0  145846.9         . 0 0 0 0 0 0 1
          12761040 "0127611" 2002 59 -2 1 2 1 1 4 0 2 1 1 0 . 28.5 0  68394.91         . 0 1 0 0 0 0 0
          12761040 "0127611" 2004 61 -1 1 2 1 1 7 0 2 1 1 0 . 29.8 0         0         . 0 0 1 0 0 0 0
          13137021 "0131370" 2014 50  3 1 1 1 2 7 0 6 1 6 0 . 30.8 0         0         . 0 0 0 0 0 0 1
          13194011 "0131940" 2002 57 -3 0 2 2 2 1 1 3 1 1 0 . 33.7 0  69790.72  6979.072 1 0 0 0 0 0 0
          13194011 "0131940" 2004 59 -2 0 2 2 2 1 1 3 1 1 0 . 35.1 0  66465.59         0 0 1 0 0 0 0 0
          13231010 "0132310" 2002 61 -1 0 3 1 2 1 1 4 0 2 0 . 27.4 0         0         0 0 0 1 0 0 0 0
          13433030 "0134330" 2004 54 -3 1 2 2 1 7 0 2 1 2 0 . 34.7 0         0         . 1 0 0 0 0 0 0
          13433030 "0134330" 2006 56 -2 1 2 2 2 7 0 2 0 2 0 .   36 0         0         . 0 1 0 0 0 0 0
          13433030 "0134330" 2008 58 -1 1 2 2 1 7 0 2 0 2 0 .   35 0         0         . 0 0 1 0 0 0 0
          13433030 "0134330" 2010 60  0 1 2 2 2 7 0 2 0 3 0 . 37.8 0         0         . 0 0 0 1 0 0 0
          13518040 "0135181" 2006 59 -3 1 2 2 2 4 0 2 1 0 0 .   32 0  74734.23         . 1 0 0 0 0 0 0
          13518040 "0135181" 2008 61 -2 1 2 2 1 4 0 2 1 0 0 . 33.8 0   58314.8         . 0 1 0 0 0 0 0
          13561010 "0135610" 2002 61 -2 1 2 1 2 1 1 4 1 1 0 . 30.5 0         0 111665.16 0 1 0 0 0 0 0
          13561020 "0135610" 2002 61 -2 0 3 1 2 1 1 4 1 3 0 .   28 0 111665.16         0 0 1 0 0 0 0 0
          13595011 "0135950" 2002 60 -1 1 2 1 1 5 0 3 1 1 0 . 19.6 0  53040.95         . 0 0 1 0 0 0 0
          13817011 "0138171" 2004 58 -3 1 3 1 2 3 1 2 0 0 0 . 32.2 0  39879.36         0 1 0 0 0 0 0 0
          13817011 "0138171" 2006 61 -2 1 3 1 2 3 1 2 0 2 0 . 30.1 0 19929.127         0 0 1 0 0 0 0 0
          14214010 "0142140" 2002 61 -1 1 3 2 1 8 0 1 1 1 0 . 33.7 0  55832.58         . 0 0 1 0 0 0 0
          14332010 "0143321" 2002 61 -3 1 2 2 2 5 0 . 1 2 0 1 29.2 0  41874.43         . 1 0 0 0 0 0 0
          14427040 "0144271" 2010 60 -3 1 2 1 4 1 1 5 0 3 0 1   51 3         0         0 1 0 0 0 0 0 0
          14427040 "0144271" 2012 61 -2 1 2 1 3 1 1 5 0 3 0 1 51.4 2         0         0 0 1 0 0 0 0 0
          14617020 "0146170" 2002 61 -3 1 1 1 2 1 1 2 1 2 0 1 23.1 0         0  46061.88 1 0 0 0 0 0 0
          14981011 "0149810" 2010 60 -1 0 2 2 2 1 1 6 0 2 0 0 35.2 0         0         0 0 0 1 0 0 0 0
          14981011 "0149812" 2012 61  0 0 2 2 1 4 0 8 0 4 0 0 29.8 3         0         . 0 0 0 1 0 0 0
          15000011 "0150000" 2006 51  1 1 4 1 2 1 1 2 0 0 0 1 23.9 0  80962.08 311392.63 0 0 0 0 1 0 0
          15000011 "0150000" 2010 56  3 1 4 1 2 1 1 2 0 0 0 1 26.4 0  90974.13  307469.5 0 0 0 0 0 0 1
          15445010 "0154450" 2002 61 -1 0 2 1 2 1 1 2 1 1 0 1 28.7 0 141821.38  47457.69 0 0 1 0 0 0 0
          15636010 "0156360" 2002 61 -3 1 1 1 5 5 0 2 1 2 0 1 31.3 1         0         . 1 0 0 0 0 0 0
          15659010 "0156590" 2002 61 -3 0 1 2 4 1 1 8 0 0 0 1 26.6 0  6979.072 11166.516 1 0 0 0 0 0 0
          15734040 "0157340" 2002 59 -2 1 2 1 1 7 0 2 0 1 0 1 21.3 0  60020.02         . 0 1 0 0 0 0 0
          15734040 "0157340" 2004 61 -1 1 2 1 1 7 0 2 0 1 0 1 21.4 0         0         . 0 0 1 0 0 0 0
          15779040 "0157790" 2004 60 -3 1 2 1 2 1 1 6 1 1 0 1 24.3 1   22598.3         0 1 0 0 0 0 0 0
          15836020 "0158360" 2002 60 -3 1 1 1 2 1 1 2 1 3 0 1 33.3 0         0 101894.45 1 0 0 0 0 0 0
          15991040 "0159910" 2004 61  0 1 2 1 3 1 1 2 1 1 0 1 25.7 0         0         0 0 0 0 1 0 0 0
          16022040 "0160220" 2004 61 -3 1 2 1 2 1 1 1 1 1 0 1   22 0         0         0 1 0 0 0 0 0 0
          16197020 "0161970" 2002 60 -2 1 2 1 2 1 1 5 0 0 0 1 25.7 0  41874.43         0 0 1 0 0 0 0 0
          16247030 "0162470" 2002 60 -1 1 1 1 3 1 1 8 0 4 0 1 27.4 0         0         0 0 0 1 0 0 0 0
          16566020 "0165660" 2002 61 -2 0 3 1 2 1 1 2 0 0 0 1 22.2 0         0         0 0 1 0 0 0 0 0
          16715030 "0167150" 2004 55 -3 1 3 1 2 1 1 4 1 2 0 1 29.9 0         0         0 1 0 0 0 0 0 0
          16715030 "0167150" 2006 56 -2 1 3 1 2 1 1 4 0 2 0 1   22 0         0         0 0 1 0 0 0 0 0
          16715030 "0167150" 2008 59 -1 1 3 1 2 1 1 4 1 2 0 1 24.1 0         0         0 0 0 1 0 0 0 0
          16715030 "0167150" 2010 61  0 1 3 1 2 1 1 4 1 2 0 1 24.2 0         0         0 0 0 0 1 0 0 0
          16799040 "0167990" 2002 52 -1 1 4 2 2 1 1 3 0 0 0 1 30.2 0  94915.38  22333.03 0 0 1 0 0 0 0
          16799040 "0167990" 2004 54  0 1 4 2 2 1 1 3 0 0 0 1 30.5 0  93051.83         0 0 0 0 1 0 0 0
          16799040 "0167990" 2006 56  1 1 4 2 2 1 1 3 0 0 0 1   31 0  99645.63         0 0 0 0 0 1 0 0
          16799040 "0167990" 2008 58  2 1 4 2 2 1 1 3 0 0 0 1 31.9 0  81640.72         0 0 0 0 0 0 1 0
          16799040 "0167990" 2010 60  3 1 4 2 2 1 1 3 0 0 0 1 29.2 0         0         0 0 0 0 0 0 0 1
          16959011 "0169590" 2012 53 -1 1 3 2 2 1 1 8 1 3 0 1 27.7 0  5468.501  8749.602 0 0 1 0 0 0 0
          16959011 "0169590" 2014 54  0 1 3 2 2 1 1 8 1 3 0 1 27.9 0 16653.064         0 0 0 0 1 0 0 0
          16959011 "0169590" 2016 57  1 1 3 2 2 7 0 8 1 3 0 1 28.3 0  48545.94         . 0 0 0 0 1 0 0
          16959011 "0169590" 2018 59  2 1 3 2 2 7 0 8 1 3 0 1 25.2 0     16000         . 0 0 0 0 0 1 0
          16973020 "0169731" 2002 61 -2 0 3 3 2 5 0 2 0 0 0 0 24.4 0         0         . 0 1 0 0 0 0 0
          16975040 "0169750" 2004 60 -3 1 2 1 2 1 1 4 1 1 0 1 31.5 0 15951.742  35891.42 1 0 0 0 0 0 0
          17003040 "0170030" 2002 56 -2 0 2 1 2 1 1 . 1 0 0 1 27.9 0  54436.76         0 0 1 0 0 0 0 0
          17003040 "0170030" 2004 58 -1 0 2 1 3 1 1 . 1 0 0 1 26.5 0  75770.77  1329.312 0 0 1 0 0 0 0
          17003040 "0170030" 2006 60  0 0 2 1 2 1 1 . 1 0 0 1 25.8 0  56050.67  2491.141 0 0 0 1 0 0 0
          17159011 "0171590" 2008 51 -3 0 2 1 2 3 1 2 1 0 0 1 21.1 0  52483.32  13995.55 1 0 0 0 0 0 0
          17159011 "0171590" 2010 53 -2 0 2 1 2 3 1 2 1 0 0 1 21.7 0  48941.77 13818.854 0 1 0 0 0 0 0
          17159011 "0171590" 2012 55 -1 0 2 1 2 3 1 2 1 0 0 1 24.1 0     39756 13124.402 0 0 1 0 0 0 0
          17159011 "0171590" 2014 57  0 0 2 1 2 3 1 2 1 1 0 1 22.7 0  68945.81         0 0 0 0 1 0 0 0
          17209011 "0172090" 2004 51 -3 1 1 1 2 1 1 . . 3 0 1 27.4 1         0 531.72473 1 0 0 0 0 0 0
          17209011 "0172090" 2006 53 -2 1 1 1 4 1 1 0 . 4 0 1 22.9 3         0 16192.416 0 1 0 0 0 0 0
          17209011 "0172090" 2008 55 -1 1 1 1 2 1 1 6 1 5 0 1 27.4 2         0 16328.144 0 0 1 0 0 0 0
          17209011 "0172090" 2010 57  0 1 1 1 2 1 1 6 1 5 0 1 27.4 1         0 13818.854 0 0 0 1 0 0 0
          17209011 "0172090" 2012 59  1 1 1 1 2 1 1 6 1 5 0 1 31.1 1         0 25155.105 0 0 0 0 1 0 0
          17209011 "0172090" 2014 61  2 1 1 1 2 1 1 6 1 5 0 1 25.6 4         0  26517.62 0 0 0 0 0 1 0
          17383011 "0173830" 2006 57 -2 1 2 1 2 3 1 3 1 1 0 0 30.1 0 4359.4966         0 0 1 0 0 0 0 0
          17383011 "0173832" 2008 59 -1 1 2 1 1 5 0 3 0 1 0 0   31 0  17144.55         . 0 0 1 0 0 0 0
          17383011 "0173832" 2010 61  0 1 2 1 1 5 0 3 1 3 0 0 26.6 0 230.31422         . 0 0 0 1 0 0 0
          18204020 "0182040" 2002 60 -1 1 1 3 1 7 0 3 1 3 0 1 31.8 1         0         . 0 0 1 0 0 0 0
          18435042 "0184351" 2002 52 -2 0 4 1 2 3 1 6 0 2 0 1   30 0  671386.8         0 0 1 0 0 0 0 0
          18435042 "0184351" 2004 54 -1 0 4 1 2 3 1 2 0 2 0 1   29 0  483869.5         0 0 0 1 0 0 0 0
          18435042 "0184351" 2006 56  0 0 4 1 2 1 1 4 0 3 0 1 30.8 0  227939.4         0 0 0 0 1 0 0 0
          18435042 "0184351" 2008 58  1 0 4 1 2 1 1 4 0 3 0 1 30.4 5  129639.2         0 0 0 0 0 1 0 0
          18435042 "0184351" 2010 61  2 0 4 1 2 1 1 3 0 3 0 1 31.6 3         0         0 0 0 0 0 0 1 0
          18494022 "0184942" 2002 59 -3 1 3 1 2 1 1 . 0 5 0 1 22.5 0         0         0 1 0 0 0 0 0 0
          18494022 "0184942" 2004 61 -2 1 3 1 2 1 1 . 0 5 0 1 27.5 0         0         0 0 1 0 0 0 0 0
          18889040 "0188890" 2008 61 -3 1 3 1 2 1 1 4 1 4 0 1 38.3 0         0         0 1 0 0 0 0 0 0
          18972011 "0189722" 2006 52 -3 1 1 1 2 1 1 4 1 0 0 1 25.7 0 12455.704         0 1 0 0 0 0 0 0
          18972011 "0189722" 2008 54 -2 1 1 1 3 1 1 4 1 0 0 1   24 0  9330.367         0 0 1 0 0 0 0 0
          18972011 "0189722" 2010 56 -1 1 1 1 3 1 1 4 1 0 0 1 26.6 0 2072.8281         0 0 0 1 0 0 0 0
          18972011 "0189722" 2012 58  0 1 1 1 3 1 1 4 1 0 0 1 28.3 0         0         0 0 0 0 1 0 0 0
          18972011 "0189722" 2014 60  1 1 1 1 3 7 0 . 0 0 0 1 27.5 0         0         . 0 0 0 0 1 0 0
          18990040 "0189900" 2004 58 -3 1 1 1 2 1 1 5 1 4 0 1 26.4 0         0  93051.83 1 0 0 0 0 0 0
          18990040 "0189900" 2006 60 -2 1 1 1 2 1 1 5 1 5 0 1 28.3 2         0         0 0 1 0 0 0 0 0
          19053040 "0190530" 2002 58 -2 1 1 3 5 1 1 3 1 1 0 1   30 0         0 13958.145 0 1 0 0 0 0 0
          end
          Code:
          global controls "c.age##c.age i.edu_4c i.race4 c.hhnumber c.child_n c.cond8num_ever i.child_10mile c.rwbmi"
          Code:
          global years3 "eventm3 eventm2 event0 event1 event2 event3"
          Code:
          xtset rahhidpn wave
          Code:
          xtreg rearning_adj $controls $years3 if marr_partn==0, fe
          Code:
          gen sample = e(sample) if marr_partn==0
          Code:
          reghdfe rearning_adj $controls $years3 if marr_partn==0, absorb(rahhidpn)
          Code:
          gen sample2 = e(sample) if marr_partn==0
          If I compare sample and sample2, the number of observations are different because of the singleton observations that are dropped. The number of missings is already considered in the sample from xtreg, so missings do not explain the difference in the sample size. I really cannot understand which additional observations are dropped when I use reghdfe and why. Do you have any ideas?

          Thank you.

          Halim
          Last edited by Halim Yoon; 05 Mar 2023, 10:17.

          Comment


          • #6
            The only reason why I cannot use xtreg and insead try using reghdfe is that xtreg does not allow using weights that vary within each individual. Is it right that I can only use reghdfe when I use time-varying weights, right? Or is there any other thing I should consider when I use weights in fixed-effects model? Thank you so much!!

            Comment


            • #7
              I can explain the difference in the estimation samples between -xtreg, fe- and -reghdfe-. In -reghdfe-, the following are grounds for exclusion from the estimation sample:
              1. Not satisfying the -if- and -in- qualifiers in the command, if any.
              2. Having a missing value for any variable mentioned in the regression command (including weights, clusters).
              3. Having no variation in the outcome variable within the panel. (This includes singleton panels, but also includes panels with multiple observations all having the same value of the outcome variable.)
              The third criterion, however, does not apply in -xtreg, fe-. In your example data, all of the observations that were dropped by -reghdfe- but not by -xtreg, fe- fulfill the third criterion. I believe that will be true in your entire data set as well.

              I do not know the answer to your question about time varying weights in fixed-effects models. I hope somebody will chime in who does, so we can both learn.

              Added: Bear in mind that the three conditions noted above are applied repetitively to drop observations until no further problematic observations are found. These rules can feed each other. For example, after 2 is applied, an observation that was not originally a singleton may become one as a result of its "mates" being dropped. Or application of 1 may result in the removal of all observations whose outcome value was different from those of the remaining observation(s) in the panel.
              Last edited by Clyde Schechter; 05 Mar 2023, 12:52.

              Comment


              • #8
                Thank you Clyde for your response. After reading your post, I finally figured out which observations are singleton observations and why they are dropped. I appreciate your insights!

                Comment

                Working...
                X