Announcement

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

  • Order of variables in reg command

    Hello everyone,

    I am presenting an interesting problem here, at least interesting and at the same time weird to me. I am running an OLS regression using reg command. I have three continuous variables and one binary treatment variable. In addition, I want to include year fixed effects, district fixed effects, and unit fixed effects using the factor variable notation in Stata (i.varname). However, my coefficients are sensitive to the ordering of factor variables. For example when I run:

    Code:
    global xlist classsize teacher_perstudent higheduc_teacher_perstudent i.districteng i.schoolid i.progyear 
    reg avgscore_male_nonretaker t $xlist, cluster(schoolid) allbaselevels
    I am getting this

    PHP Code:
    Linear regression                               Number of obs     =         43
                                                    F
    (529)          =          .
                                                    
    Prob F          =          .
                                                    
    R-squared         =     0.9698
                                                    Root MSE          
    =      12.95

                                                 
    (StdErradjusted for 30 clusters in schoolid)
    ---------------------------------------------------------------------------------------------
                                |               
    Robust
       avgscore_male_nonretaker 
    |      Coef.   StdErr.      t    P>|t|     [95ConfInterval]
    ----------------------------+----------------------------------------------------------------
                              
    |   18.75526   42.49063     0.44   0.662    -68.14784    105.6583
                      classsize 
    |  -.1132929   1.046558    -0.11   0.915    -2.253744    2.027158
             teacher_perstudent 
    |   16.13461   19.98505     0.81   0.426    -24.73941    57.00864
    higheduc_teacher_perstudent 
    |  -28.82376    58.8787    -0.49   0.628    -149.2442    91.59671
                                
    |
                    
    districteng |
                    
    Dai Mirdad  |          0  (base)
               
    Dara i Suf Bala  |   122.3196   33.65303     3.63   0.001     53.49143    191.1478
                         Gizab  
    |   49.01942   101.9663     0.48   0.634     -159.525    257.5639
                       Jalreez  
    |   104.6114   438.0338     0.24   0.813    -791.2684    1000.491
                  Khas Uruzgan  
    |   71.54592   58.80817     1.22   0.234     -48.7303    191.8221
                          Kiti  
    |   48.78746   22.03812     2.21   0.035     3.714444    93.86049
              Lal o Sar Jangal  
    |  -26.31099   107.3473    -0.25   0.808    -245.8608    193.2388
                      Malistan  
    |   88.19973   46.43968     1.90   0.068    -6.780067    183.1795
                 Markaz Behsud  
    |   1.466345    54.6986     0.03   0.979    -110.4049    113.3375
                      Miramoor  
    |   50.78536   61.51352     0.83   0.416    -75.02392    176.5946
                         Nahor  
    |   92.51837     29.796     3.11   0.004     31.57871     153.458
                        Panjab  
    |   21.75951   26.68676     0.82   0.422    -32.82105    76.34007
                     Roy 
    do Ab  |   54.42585   42.86992     1.27   0.214    -33.25297    142.1047
                    Shahristan  
    |   63.03825   19.94752     3.16   0.004     22.24099    103.8355
                     Shikh Ali  
    |  -22.67487   49.27363    -0.46   0.649    -123.4508    78.10102
                         Waras  
    |   60.66022   30.47429     1.99   0.056     -1.66669    122.9871
                     Yakawlang  
    |    42.0939   31.28532     1.35   0.189    -21.89176    106.0796
                                
    |
                       
    progyear |
                          
    2014  |          0  (base)
                          
    2015  |  -37.10014   47.96113    -0.77   0.445    -135.1917    60.99138
                          2016  
    |  -51.78048   97.60409    -0.53   0.600    -251.4033    147.8423
                          2017  
    |  -83.51801   140.8801    -0.59   0.558    -371.6502    204.6142
                                
    |
                       
    schoolid |
                     
    150300010  |          0  (base)
                     
    150300019  |  -58.26665   97.24575    -0.60   0.554    -257.1565    140.6232
                     150300026  
    |  -78.04578   53.70461    -1.45   0.157     -187.884    31.79248
                     150500016  
    |          0  (omitted)
                     
    260300005  |          0  (omitted)
                     
    260400001  |  -11.29118   39.35719    -0.29   0.776    -91.78568    69.20332
                     260400002  
    |          0  (omitted)
                     
    270700022  |   122.8894   103.3797     1.19   0.244    -88.54591    334.3247
                     270700048  
    |          0  (omitted)
                     
    280400012  |  -55.59268   40.07616    -1.39   0.176    -137.5576    26.37227
                     280400018  
    |          0  (omitted)
                     
    280500003  |   18.90369   49.73354     0.38   0.707    -82.81283    120.6202
                     280500036  
    |          0  (omitted)
                     
    280600047  |          0  (omitted)
                     
    306000018  |          0  (omitted)
                     
    340600022  |          0  (omitted)
                     
    340700013  |  -32.15847    66.5693    -0.48   0.633     -168.308     103.991
                     340700028  
    |          0  (omitted)
                     
    340900024  |          0  (omitted)
                     
    402000012  |  -97.33107   421.7379    -0.23   0.819     -959.882    765.2199
                     402000019  
    |          0  (omitted)
                     
    404000010  |   53.02595   32.69272     1.62   0.116    -13.83818    119.8901
                     404000033  
    |  -39.52184   47.86309    -0.83   0.416    -137.4128    58.36917
                     404000035  
    |  -85.81084   72.24248    -1.19   0.245    -233.5633    61.94163
                     404000043  
    |   24.28322   102.5233     0.24   0.814    -185.4005    233.9669
                     404000073  
    |          0  (omitted)
                     
    405000008  |          0  (omitted)
                     
    604000098  |          0  (omitted)
                     
    604000103  |          0  (omitted)
                     
    606000070  |          0  (omitted)
                                |
                          
    _cons |   167.3151   45.65664     3.66   0.001     73.93678    260.6934
    --------------------------------------------------------------------------------------------- 
    But when I change the order of just two factor variables as follows:

    Code:
    global xlist classsize teacher_perstudent higheduc_teacher_perstudent i.districteng i.schoolid i.progyear 
    reg avgscore_male_nonretaker t $xlist, cluster(schoolid) allbaselevels
    I am getting the following result:

    PHP Code:
    Linear regression                               Number of obs     =         43
                                                    F
    (529)          =          .
                                                    
    Prob F          =          .
                                                    
    R-squared         =     0.9698
                                                    Root MSE          
    =      12.95

                                                 
    (StdErradjusted for 30 clusters in schoolid)
    ---------------------------------------------------------------------------------------------
                                |               
    Robust
       avgscore_male_nonretaker 
    |      Coef.   StdErr.      t    P>|t|     [95ConfInterval]
    ----------------------------+----------------------------------------------------------------
                              
    |   -9.08408   12.34954    -0.74   0.468    -34.34173    16.17356
                      classsize 
    |  -.1132929   1.046558    -0.11   0.915    -2.253744    2.027158
             teacher_perstudent 
    |   16.13461   19.98505     0.81   0.426    -24.73941    57.00864
    higheduc_teacher_perstudent 
    |  -28.82376    58.8787    -0.49   0.628    -149.2442    91.59671
                                
    |
                    
    districteng |
                    
    Dai Mirdad  |          0  (base)
               
    Dara i Suf Bala  |   94.48027    32.3545     2.92   0.007     28.30789    160.6527
                         Gizab  
    |   104.6981   18.04242     5.80   0.000     67.79721     141.599
                       Jalreez  
    |   48.93273   516.7161     0.09   0.925     -1007.87    1105.736
                  Khas Uruzgan  
    |   99.38525   31.14976     3.19   0.003     35.67684    163.0937
                          Kiti  
    |   48.78746   22.03812     2.21   0.035     3.714444    93.86049
              Lal o Sar Jangal  
    |   29.36768   21.85836     1.34   0.190     -15.3377    74.07305
                      Malistan  
    |   88.19973   46.43968     1.90   0.068    -6.780067    183.1795
                 Markaz Behsud  
    |   29.30568   13.08261     2.24   0.033     2.548731    56.06263
                      Miramoor  
    |    78.6247   18.00107     4.37   0.000     41.80838     115.441
                         Nahor  
    |   92.51837     29.796     3.11   0.004     31.57871     153.458
                        Panjab  
    |   21.75951   26.68676     0.82   0.422    -32.82105    76.34007
                     Roy 
    do Ab  |   54.42585   42.86992     1.27   0.214    -33.25297    142.1047
                    Shahristan  
    |   63.03825   19.94752     3.16   0.004     22.24099    103.8355
                     Shikh Ali  
    |  -22.67487   49.27363    -0.46   0.649    -123.4508    78.10102
                         Waras  
    |   32.82089   74.72315     0.44   0.664    -120.0051    185.6469
                     Yakawlang  
    |    42.0939   31.28532     1.35   0.189    -21.89176    106.0796
                                
    |
                       
    schoolid |
                     
    150300010  |          0  (base)
                     
    150300019  |  -2.587977   9.719837    -0.27   0.792    -22.46727    17.29132
                     150300026  
    |  -50.20644   16.52537    -3.04   0.005    -84.00462   -16.40826
                     150500016  
    |          0  (omitted)
                     
    260300005  |          0  (omitted)
                     
    260400001  |  -39.13052   12.62379    -3.10   0.004    -64.94907   -13.31196
                     260400002  
    |          0  (omitted)
                     
    270700022  |   39.37137   49.03798     0.80   0.429    -60.92255    139.6653
                     270700048  
    |          0  (omitted)
                     
    280400012  |  -27.75334   25.84329    -1.07   0.292     -80.6088    25.10212
                     280400018  
    |          0  (omitted)
                     
    280500003  |  -8.935647    20.8451    -0.43   0.671    -51.56866    33.69736
                     280500036  
    |          0  (omitted)
                     
    280600047  |          0  (omitted)
                     
    306000018  |          0  (omitted)
                     
    340600022  |          0  (omitted)
                     
    340700013  |  -59.99781    28.1416    -2.13   0.042    -117.5538   -2.441779
                     340700028  
    |          0  (omitted)
                     
    340900024  |          0  (omitted)
                     
    402000012  |   -41.6524   500.2204    -0.08   0.934    -1064.718    981.4132
                     402000019  
    |          0  (omitted)
                     
    404000010  |   25.18661   32.97342     0.76   0.451     -42.2516    92.62483
                     404000033  
    |   -11.6825   25.76335    -0.45   0.654    -64.37447    41.00947
                     404000035  
    |  -57.97151   64.91141    -0.89   0.379    -190.7302    74.78724
                     404000043  
    |  -59.23479   55.16953    -1.07   0.292    -172.0692    53.59958
                     404000073  
    |          0  (omitted)
                     
    405000008  |          0  (omitted)
                     
    604000098  |  -27.83934   46.96004    -0.59   0.558    -123.8834    68.20473
                     604000103  
    |          0  (omitted)
                     
    606000070  |          0  (omitted)
                                |
                       
    progyear |
                          
    2014  |          0  (base)
                          
    2015  |  -9.260804   14.20829    -0.65   0.520    -38.32003    19.79842
                          2016  
    |   3.898195   16.14454     0.24   0.811    -29.12109    36.91748
                          2017  
    |          0  (omitted)
                                |
                          
    _cons |   139.4757   43.84943     3.18   0.003     49.79359    229.1579
    --------------------------------------------------------------------------------------------- 

    Please take a look at the coefficient on t (the treatment indicator), why would changing the order of factor variables change the results. Is it not supposed to satisfy the additive property? Or am I missing something?

  • #2
    Ahmed:
    I guess that non-default standard errors cause your problem:
    Code:
    . sysuse auto.dta
    (1978 Automobile Data)
    
    . reg price i.foreign i.rep78, cluster(foreign)
    
    Linear regression                               Number of obs     =         69
                                                    F(1, 1)           =          .
                                                    Prob > F          =          .
                                                    R-squared         =     0.0145
                                                    Root MSE          =     3003.8
    
                                    (Std. Err. adjusted for 2 clusters in foreign)
    ------------------------------------------------------------------------------
                 |               Robust
           price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         foreign |
        Foreign  |    36.7572   712.1368     0.05   0.967    -9011.799    9085.313
                 |
           rep78 |
              2  |   1403.125          .        .       .            .           .
              3  |   1861.058   268.2339     6.94   0.091    -1547.177    5269.292
              4  |   1488.621   534.3125     2.79   0.219    -5300.462    8277.705
              5  |   1318.426   1216.751     1.08   0.474    -14141.87    16778.72
                 |
           _cons |     4564.5   .0000432  1.1e+08   0.000     4564.499    4564.501
    ------------------------------------------------------------------------------
    
    . reg price i.rep78 i.foreign , cluster(foreign)
    
    Linear regression                               Number of obs     =         69
                                                    F(1, 1)           =          .
                                                    Prob > F          =          .
                                                    R-squared         =     0.0145
                                                    Root MSE          =     3003.8
    
                                    (Std. Err. adjusted for 2 clusters in foreign)
    ------------------------------------------------------------------------------
                 |               Robust
           price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           rep78 |
              2  |   1403.125   2.67e-11  5.3e+13   0.000     1403.125    1403.125
              3  |   1861.058   268.2339     6.94   0.091    -1547.177    5269.292
              4  |   1488.621   534.3125     2.79   0.219    -5300.462    8277.705
              5  |   1318.426   1216.751     1.08   0.474    -14141.87    16778.72
                 |
         foreign |
        Foreign  |    36.7572   712.1368     0.05   0.967    -9011.799    9085.313
           _cons |     4564.5   .0000682  6.7e+07   0.000     4564.499    4564.501
    ------------------------------------------------------------------------------
    
    .
    Conversely, when I go back to default standard errors, the order of the predictors plays no role at all:
    Code:
    . sysuse auto.dta
    (1978 Automobile Data)
    
    . reg price i.foreign i.rep78
    
          Source |       SS           df       MS      Number of obs   =        69
    -------------+----------------------------------   F(5, 63)        =      0.19
           Model |  8372481.37         5  1674496.27   Prob > F        =    0.9670
        Residual |   568424478        63  9022610.75   R-squared       =    0.0145
    -------------+----------------------------------   Adj R-squared   =   -0.0637
           Total |   576796959        68  8482308.22   Root MSE        =    3003.8
    
    ------------------------------------------------------------------------------
           price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         foreign |
        Foreign  |    36.7572   1010.484     0.04   0.971    -1982.533    2056.048
                 |
           rep78 |
              2  |   1403.125   2374.686     0.59   0.557    -3342.306    6148.556
              3  |   1861.058   2195.967     0.85   0.400    -2527.232    6249.347
              4  |   1488.621   2295.176     0.65   0.519    -3097.921    6075.164
              5  |   1318.426   2452.565     0.54   0.593    -3582.634    6219.485
                 |
           _cons |     4564.5   2123.983     2.15   0.035     320.0579    8808.942
    ------------------------------------------------------------------------------
    
    . reg price i.rep78 i.foreign
    
          Source |       SS           df       MS      Number of obs   =        69
    -------------+----------------------------------   F(5, 63)        =      0.19
           Model |  8372481.37         5  1674496.27   Prob > F        =    0.9670
        Residual |   568424478        63  9022610.75   R-squared       =    0.0145
    -------------+----------------------------------   Adj R-squared   =   -0.0637
           Total |   576796959        68  8482308.22   Root MSE        =    3003.8
    
    ------------------------------------------------------------------------------
           price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           rep78 |
              2  |   1403.125   2374.686     0.59   0.557    -3342.306    6148.556
              3  |   1861.058   2195.967     0.85   0.400    -2527.232    6249.347
              4  |   1488.621   2295.176     0.65   0.519    -3097.921    6075.164
              5  |   1318.426   2452.565     0.54   0.593    -3582.634    6219.485
                 |
         foreign |
        Foreign  |    36.7572   1010.484     0.04   0.971    -1982.533    2056.048
           _cons |     4564.5   2123.983     2.15   0.035     320.0579    8808.942
    ------------------------------------------------------------------------------
    
    .
    That said, with such a small sample size and too many predictors, your sky-rocketing R2 highlights overfitting: try a more parsimonious model.
    Last edited by Carlo Lazzaro; 10 Nov 2019, 12:23.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Carlo Lazzaro , thanks for your reply. But in your output, the highlighted coefficient has not changed. Based on your suggestion I run the same regressions without clustering for standard error. I have the same issue.

      Code:
      global xlist classsize teacher_perstudent higheduc_teacher_perstudent i.districteng  i.progyear i.schoolid
      reg avgscore_male_nonretaker t $xlist
      PHP Code:
      Source        SS    df       MS      Number of obs   =    43
          F
      (357)        =    6.43
      Model   37751.6678    35  1078.61908   Prob 
      F        =    0.0079
      Residual   1173.90345    7  167.700492   R
      -squared       =    0.9698
          Adj R
      -squared   =    0.8191
      Total   38925.5712    42  926.799315   Root MSE        
      =    12.95

                  
      avgscore_male_nonretaker    Coef
      .   StdErr.      t    P>t    [95Conf.    Interval]
                  
      t    18.75526   28.02003     0.67   0.525    -47.50159    85.0121
      classsize    
      -.1132929   .5999737    -0.19   0.856    -1.532005    1.305419
      teacher_perstudent    16.13461   10.03035     1.61   0.152    
      -7.583404    39.85263
      higheduc_teacher_perstudent    
      -28.82376   31.31892    -0.92   0.388    -102.8812    45.23372
          
      districteng    
      Dara i Suf Bala    122.3196   29.57225     4.14   0.004    52.39234    192.2469
      Gizab    49.01942   66.43865     0.74   0.485    
      -108.083    206.1219
      Jalreez    104.6114   253.1853     0.41   0.692    
      -494.0768    703.2996
      Khas Uruzgan    71.54592   41.08791     1.74   0.125    
      -25.61154    168.7034
      Kiti    48.78746   21.53475     2.27   0.058    
      -2.134122    99.70905
      Lal o Sar Jangal    
      -26.31099   68.94498    -0.38   0.714    -189.34    136.718
      Malistan    88.19973   27.40311     3.22   0.015    23.40167    152.9978
      Markaz Behsud    1.466345   36.57463     0.04   0.969    
      -85.01891    87.9516
      Miramoor    50.78536   39.88708     1.27   0.244    
      -43.53259    145.1033
      Nahor    92.51837   20.89735     4.43   0.003    43.10399    141.9327
      Panjab    21.75951   23.89466     0.91   0.393    
      -34.74239    78.26141
      Roy 
      do Ab    54.42585   26.33955     2.07   0.078    -7.857282    116.709
      Shahristan    63.03825   20.20724     3.12   0.017    15.25571    110.8208
      Shikh Ali    
      -22.67487   31.28685    -0.72   0.492    -96.65651    51.30677
      Waras    60.66022   26.64633     2.28   0.057    
      -2.348325    123.6688
      Yakawlang    42.0939   22.73538     1.85   0.107    
      -11.66672    95.85453
          
      progyear    
      2015    
      -37.10014   32.23524    -1.15   0.288    -113.3244    39.12409
      2016    
      -51.78048   61.31943    -0.84   0.426    -196.7779    93.21695
      2017    
      -83.51801    89.0489    -0.94   0.380    -294.0852    127.0492
          
      schoolid    
      150300019    
      -58.26665   63.70278    -0.91   0.391    -208.8998    92.3665
      150300026    
      -78.04578   36.44617    -2.14   0.069    -164.2273    8.135712
      150500016    0  
      (omitted)
      260300005    0  (omitted)
      260400001    -11.29118   32.17823    -0.35   0.736    -87.3806    64.79824
      260400002    0  
      (omitted)
      270700022    122.8894   72.95437     1.68   0.136    -49.62029    295.399
      270700048    0  
      (omitted)
      280400012    -55.59268    33.5746    -1.66   0.142    -134.984    23.79864
      280400018    0  
      (omitted)
      280500003    18.90369   32.68778     0.58   0.581    -58.39063    96.198
      280500036    0  
      (omitted)
      280600047    0  (omitted)
      306000018    0  (omitted)
      340600022    0  (omitted)
      340700013    -32.15847   42.20931    -0.76   0.471    -131.9676    67.65069
      340700028    0  
      (omitted)
      340900024    0  (omitted)
      402000012    -97.33107   244.7824    -0.40   0.703    -676.1496    481.4874
      402000019    0  
      (omitted)
      404000010    53.02595   27.29264     1.94   0.093    -11.5109    117.5628
      404000033    
      -39.52184   34.28528    -1.15   0.287    -120.5936    41.54997
      404000035    
      -85.81084   43.13487    -1.99   0.087    -187.8086    16.18693
      404000043    24.28322   71.86423     0.34   0.745    
      -145.6487    194.2151
      404000073    0  
      (omitted)
      405000008    0  (omitted)
      604000098    0  (omitted)
      604000103    0  (omitted)
      606000070    0  (omitted)
          
      _cons    167.3151   30.41026     5.50   0.001    95.40624    239.2239 
      Code:
      global xlist classsize teacher_perstudent higheduc_teacher_perstudent i.districteng  i.schoolid i.progyear
      reg avgscore_male_nonretaker t $xlist
      PHP Code:
      Source        SS    df       MS      Number of obs   =    43
          F
      (357)        =    6.43
      Model   37751.6678    35  1078.61908   Prob 
      F        =    0.0079
      Residual   1173.90345    7  167.700492   R
      -squared       =    0.9698
          Adj R
      -squared   =    0.8191
      Total   38925.5712    42  926.799315   Root MSE        
      =    12.95

                  
      avgscore_male_nonretaker    Coef
      .   StdErr.      t    P>t    [95Conf.    Interval]
                  
      t    -9.08408   8.321684    -1.09   0.311    -28.76174    10.59358
      classsize    
      -.1132929   .5999737    -0.19   0.856    -1.532005    1.305419
      teacher_perstudent    16.13461   10.03035     1.61   0.152    
      -7.583404    39.85263
      higheduc_teacher_perstudent    
      -28.82376   31.31892    -0.92   0.388    -102.8812    45.23372
          
      districteng    
      Dara i Suf Bala    94.48027   25.38146     3.72   0.007    34.46265    154.4979
      Gizab    104.6981   21.53799     4.86   0.002    53.76883    155.6274
      Jalreez    48.93273   295.3918     0.17   0.873    
      -649.5578    747.4233
      Khas Uruzgan    99.38525   26.24234     3.79   0.007    37.33198    161.4385
      Kiti    48.78746   21.53475     2.27   0.058    
      -2.134122    99.70905
      Lal o Sar Jangal    29.36768   22.65771     1.30   0.236    
      -24.20929    82.94464
      Malistan    88.19973   27.40311     3.22   0.015    23.40167    152.9978
      Markaz Behsud    29.30568   17.47353     1.68   0.137    
      -12.01266    70.62403
      Miramoor    78.6247   18.76306     4.19   0.004    34.25712    122.9923
      Nahor    92.51837   20.89735     4.43   0.003    43.10399    141.9327
      Panjab    21.75951   23.89466     0.91   0.393    
      -34.74239    78.26141
      Roy 
      do Ab    54.42585   26.33955     2.07   0.078    -7.857282    116.709
      Shahristan    63.03825   20.20724     3.12   0.017    15.25571    110.8208
      Shikh Ali    
      -22.67487   31.28685    -0.72   0.492    -96.65651    51.30677
      Waras    32.82089   44.42013     0.74   0.484    
      -72.21603    137.8578
      Yakawlang    42.0939   22.73538     1.85   0.107    
      -11.66672    95.85453
          
      schoolid    
      150300019    
      -2.587977   19.44475    -0.13   0.898    -48.56751    43.39156
      150300026    
      -50.20644   18.71694    -2.68   0.031    -94.46496    -5.947917
      150500016    0  
      (omitted)
      260300005    0  (omitted)
      260400001    -39.13052   19.74022    -1.98   0.088    -85.80873    7.547693
      260400002    0  
      (omitted)
      270700022    39.37137   30.89009     1.27   0.243    -33.67209    112.4148
      270700048    0  
      (omitted)
      280400012    -27.75334   23.15287    -1.20   0.270    -82.50119    26.99451
      280400018    0  
      (omitted)
      280500003    -8.935647   18.88193    -0.47   0.650    -53.58431    35.71301
      280500036    0  
      (omitted)
      280600047    0  (omitted)
      306000018    0  (omitted)
      340600022    0  (omitted)
      340700013    -59.99781   20.25336    -2.96   0.021    -107.8894    -12.10623
      340700028    0  
      (omitted)
      340900024    0  (omitted)
      402000012    -41.6524   286.8491    -0.15   0.889    -719.9427    636.6379
      402000019    0  
      (omitted)
      404000010    25.18661   23.40471     1.08   0.318    -30.15674    80.52996
      404000033    
      -11.6825    19.8003    -0.59   0.574    -58.50277    35.13777
      404000035    
      -57.97151   34.87955    -1.66   0.140    -140.4485    24.50553
      404000043    
      -59.23479   35.79887    -1.65   0.142    -143.8857    25.41608
      404000073    0  
      (omitted)
      405000008    0  (omitted)
      604000098    -27.83934   29.68297    -0.94   0.380    -98.0284    42.34973
      604000103    0  
      (omitted)
      606000070    0  (omitted)
          
      progyear    
      2015    
      -9.260804   9.967773    -0.93   0.384    -32.83084    14.30923
      2016    3.898195   9.960903     0.39   0.707    
      -19.6556    27.45199
      2017    0  
      (omitted)
          
      _cons    139.4757   27.52011     5.07   0.001    74.40102    204.5505 
      Please look at the highlighted coefficient
      Last edited by Ahmad Mobariz; 10 Nov 2019, 12:48.

      Comment


      • #4
        Dear Ahmad Mobariz,

        Try running the models with t at the end; my guess is that it is collinear with the fixed effects and will be dropped. Alternatively, try
        Code:
        global xlist classsize teacher_perstudent higheduc_teacher_perstudent i.districteng i.schoolid i.progyear
        reg t $xlist, cluster(schoolid) allbaselevels
        and show us the results. Best wishes,

        Joao

        Comment


        • #5
          Ahmad:
          your output is hardly readable: for your future posts, please use CODE delimiters (# button) instead of PHP toggle. Thanks.
          Reading your codes again, it seems to me that Stata omitted different levels of the categorical variables in your regression models due to extreme multicollinearity.
          Can you check it with your full Stata output?.
          Kind regards,
          Carlo
          (StataNow 18.5)

          Comment


          • #6
            Originally posted by Joao Santos Silva View Post
            Dear Ahmad Mobariz,

            Try running the models with t at the end; my guess is that it is collinear with the fixed effects and will be dropped. Alternatively, try
            Code:
            global xlist classsize teacher_perstudent higheduc_teacher_perstudent i.districteng i.schoolid i.progyear
            reg t $xlist, cluster(schoolid) allbaselevels
            and show us the results. Best wishes,

            Joao
            Joao Santos Silva Thanks. I tried your code and indeed t gets omitted. So there is multicollinearity. But my question is if there is multicollinearity why is it that the order of variables in the Stata reg command changes the results.

            Carlo Lazzaro sorry wrapping with PHP instead of code wrapper. I will consider your suggestion in the future. Indeed there is multicollinearity. But my question is why should order of variables matter for multicollinearity. If a variable gets omitted it should be omitted regardless of the order variables.

            Comment


            • #7
              Dear Ahmad Mobariz,

              The problem is not that there collinearity, the problem is that there is perfect collinearity. In that case, Stata drops one of the perfectly collinear variables and that depends on the order of the variables in the model. The upshot is, in your model the effect of t is not identified because this variable is perfectly collinear with the fixed effects.

              Best wishes,

              Joao

              Comment


              • #8
                Ahmad:
                I 've nothing to add to Joao Santos Silva 's (as usual) perfect explanation of what Stata machinery does when it comes to deal perfect multicollinearity.
                Kind regards,
                Carlo
                (StataNow 18.5)

                Comment


                • #9
                  Carlo Lazzaro and thanks a lot. That was helpful

                  Comment

                  Working...
                  X