To the Forum:

I'm having difficulty interpreting the number of observations reported in the output for a set of regressions I have run with lagged operators in the current version (15.1) of Stata. The models of interest are for 8-period unbalanced panel data on various characteristics of 202 organizations and the models have the general form: regress L2.outcome L3.var1 L3.var2 L3var3..., vce(robust).Two example models are:
  • Model 1: regress L2.Coll4yrPctA L3.school_enrollment L3.school_freelunch L3.school_ell L3.school_englishregent L3.Segonet_size L3.Segonet_prtnrcent L3.Segonet_yrspriorties L3.Segonet_industryHerf L3.Segonet_resourceHerf L3.Segonet_density L3.Segonet_prtnRsrcs_factor1 L3.Segonet_prtnRsrcs_factor2 L3.Segonet_prtnRsrcs_factor3 hsdistTRD hsdistALT, vce(robust)
  • Model 2: regress L2.PerAchela2A L3.school_enrollment L3.school_freelunch L3.school_ell L3.school_englishregent L3.Segonet_size L3.Segonet_prtnrcent L3.Segonet_yrspriorties L3.Segonet_industryHerf L3.Segonet_resourceHerf L3.Segonet_density L3.Segonet_prtnRsrcs_factor1 L3.Segonet_prtnRsrcs_factor2 L3.Segonet_prtnRsrcs_factor3 hsdistTRD hsdistALT, vce(robust)
When results are reported, the "Number of obs" reported for ​​​​​​Model 1 is 196 and 385 for Model 2. There is a similar discrepancy for models with some other L2.outcomes. This is odd because there are 202 observations for all outcome vars if interest in L2. (Period 6) and the number of observations for the L3. right-hand side variables (i.e. "school_freelunch in the dataex code below) is the same. The discrepancy *is* resolved when the two dummy variables in the models "hsdistTRD" and "hsdistALT" are also lagged as L3.hsdistTRD and L3.hsdistALT. However, I don't understand WHY this would solve the problem or why it created an issue in the first place. Thanks, in advance, for any thoughts!


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int(SchoolIDnew Period) double(Coll4yrPctA PerAchela2A) float school_enrollment double school_freelunch float Segonet_prtnRsrcs_factor1 double Segonet_industryHerf byte Segonet_size float hsdistTRD
1047 4    .    .  147.5 50.599998474121094 -1.1462839                .25  4 0
1047 5    .    .    136               50.6 -1.1462839                .25  4 0
1047 6    .    0    159               50.6 -1.1462839                .25  4 0
1047 8    .    .      .                  .          .                  .  . 0
1400 1    .    .   1204               31.9   .0816353  .3600000000000001  5 1
1400 2    .    .   1290               31.9   .0816353  .3600000000000001  5 1
1400 3    .    .   1425               31.9  .29680872 .30612244897959184  7 1
1400 4    . 50.9   1527               41.3   .4739265  .2839506172839506  9 1
1400 5    . 55.8   1592               48.7   .4739265  .2839506172839506  9 1
1400 6 74.2 54.6   1510               38.2   .4739265             .28125  8 1
1400 8    .    .      .                  .          .                  .  . 1
1407 1    .    .    201               25.8 -1.0425215 .42857142857142855  7 1
1407 3    .    .    348               25.8 -1.0425215 .42857142857142855  7 1
1407 4    . 27.3 332.75   24.7366666666667  -.8746036 .44000000000000006  5 1
1407 5    . 70.6    376              22.61  -.8746036 .44000000000000006  5 1
1407 6 74.3 69.7    406   24.7366666666667  -.8746036 .44000000000000006  5 1
1407 8    .    .      .                  .          .                  .  . 1
1408 1    .    .    285               10.1  -.9744283  .3333333333333333  3 1
1408 3    .    .    327               10.1  -1.400283               .375  4 1
1408 4    . 52.3 360.25   11.9633333333333  -1.400283               .375  4 1
1408 5    . 54.3    408              15.69  -1.400283               .375  4 1
1408 6    0   40    421   11.9633333333333  -1.400283               .375  4 1
1408 8    .    .      .                  .          .                  .  . 1
1409 1    .    .    369               71.1  -.5091165                  1  4 0
1409 2    .    .    382               71.1  -.8462489                  1  3 0
1409 3    .    .    401               71.1  -.8462489                  1  3 0
1409 4    . 34.6    382               75.4  -.3425202  .5555555555555556  6 0
1409 5    . 46.4    394               75.4  -.3425202  .5555555555555556  6 0
1409 6 81.4 42.7    402               71.8  -.3425202  .5555555555555556  6 0
1409 8    .    .      .                  .          .                  .  . 0
1411 2    .    .    386               39.9   .4530426  .7551020408163265  7 0
1411 3    .    .    391               39.9   .6712472  .5918367346938775  7 0
1411 4    . 54.8    405               43.1   .6712472  .5918367346938775  7 0
1411 5    . 30.4    403               41.4   .6712472  .5918367346938775  7 0
1411 6 94.7 24.7    409               38.9   .6712472  .5918367346938775  7 0
1411 8    .    .      .                  .          .                  .  . 0
1412 2    .    .    439              12.75  .56599855 .26530612244897955  7 0
1412 3    .    .    726               11.8  .56599855 .26530612244897955  7 0
1412 4    . 12.7    375              12.75  .56599855 .26530612244897955  7 0
1412 5    .    0    391               13.8  .56599855 .26530612244897955  7 0
1412 6 94.1 14.6    395               13.6  .56599855 .26530612244897955  7 0
1412 8    .    .      .                  .          .                  .  . 0
1413 2    .    .    580               36.9 -1.0694875                  1  1 0
1413 3    .    .    601               38.3 -1.0694875                  1  1 0
1413 4    . 55.2    607   37.8333333333333 -1.0694875                  1  1 0
1413 5    . 54.2    619   37.8333333333333 -1.0694875                  1  1 0
1413 6 92.3 35.6    627   37.8333333333333 -1.0694875                  1  1 0
1413 8    .    .      .                  .          .                  .  . 0
1414 2    .    .    354               32.5  .40832955                  1  6 0
1414 3    .    .    366               33.8 -.16123778  .7222222222222223  6 0
1414 4    .   59    403   33.3666666666667 -.13760601  .6800000000000002  5 0
1414 5    . 51.5    409   33.3666666666667 -.13760601  .6800000000000002  5 0
1414 6 81.6 57.7    390   33.3666666666667 -.13760601  .6800000000000002  5 0
1414 8    .    .      .                  .          .                  .  . 0
1419 1    .    .    353                 76  -.8175041               .625  4 0
1419 2    .    .    352                 76  1.1508472                 .5  8 0
1419 3    .    .    380                 76  1.2445354             .53125  8 0
1419 4    .   80    392               77.7   .8640692   .510204081632653  7 0
1419 5    . 39.2    398               81.5   .8640692   .510204081632653  7 0
1419 6 40.3   38    404               65.9   .8640692   .510204081632653  7 0
1419 8    .    .      .                  .          .                  .  . 0
1420 1    .    .   1220               57.5 -1.0432006  .5555555555555556  6 1
1420 2    .    .   1273               57.5 -1.0432006  .5555555555555556  6 1
1420 3    .    .   1388               57.5 -1.0432006   .510204081632653  7 1
1420 4    .   59   1484               51.2 -1.0432006   .510204081632653  7 1
1420 5    . 53.6   1607               66.2 -1.0432006   .510204081632653  7 1
1420 6 61.1 62.4   1598               66.2 -1.0432006   .510204081632653  7 1
1420 8    .    .      .                  .          .                  .  . 1
1425 1    .    .    631               36.2   .5430983  .2892561983471074 11 1
1425 2    .    .    599               36.2  -.6648308                .44  5 1
1425 3    .    .    592               36.2   .5276936 .42857142857142855  7 1
1425 4    . 43.9    565               27.5   .5276936 .42857142857142855  7 1
1425 5    . 65.5    598                 43   .5276936 .42857142857142855  7 1
1425 6 64.2 46.7    653               50.2   .5276936 .42857142857142855  7 1
1425 8    .    .      .                  .          .                  .  . 1
1429 2    .    .    357               62.2  -.6260996  .3333333333333333  3 0
1429 3    .    .    337               62.2  -.6260996  .3333333333333333  3 0
1429 4    . 23.9    395               85.4  -.3441155               .375  4 0
1429 5    . 29.6    416               79.6  -.3441155               .375  4 0
1429 6  7.1   21    417              70.32  -.3441155               .375  4 0
1429 8    .    .      .                  .          .                  .  . 0
1435 1    .    .   1542               43.5    1.49474 .45999999999999996 10 1
1435 2    .    .   1539               43.5  1.1917529  .4876033057851239 11 1
1435 3    .    .   1604               43.5  1.1917529  .4876033057851239 11 1
1435 4    . 71.8   1706               48.9  1.1917529  .4876033057851239 11 1
1435 5    . 58.1   1698               58.1  1.1917529  .4876033057851239 11 1
1435 6 65.6 66.1   1634               62.2  1.1917529  .4876033057851239 11 1
1435 8    .    .      .                  .          .                  .  . 1
1439 1    .    .    389               74.3  -.9437383  .3333333333333333  3 0
1439 3    .    .    433               74.3  2.2387109  .3609467455621301 13 0
1439 4    . 47.5    314               63.2  2.1418884 .45833333333333337 12 0
1439 5    . 76.1    326               65.6  2.1418884 .45833333333333337 12 0
1439 6 68.3 59.7    345               64.8  2.1418884 .45833333333333337 12 0
1439 8    .    .      .                  .          .                  .  . 0
1440 1    .    .   1939               69.4   -.366128                .25  8 1
1440 2    .    .   2082               69.4   .7700846  .3491124260355029 13 1
1440 3    .    .   2087               69.4   .7700846  .3491124260355029 13 1
1440 4    . 42.8   2303               54.1  1.3830118  .3688888888888888 15 1
1440 5    . 45.3   2151               73.6  1.3830118  .3688888888888888 15 1
1440 6  2.3 39.2   2131               64.2  1.3830118  .3688888888888888 15 1
end