Announcement

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

  • Varying coefficients after re-arranging variable order following xtreg command

    Hi Community,

    I have a weird regression problem that seems to have not occurred before (to the best of my knowledge at least).

    The outputs of two regressions with identical variables, options and of the same type give different regression coefficients.

    I am interested in the effect of different time periods (T) around an event (at T = 6). If I swap quarter and year fixed effects, coefficients change (also that of the focal variable T) as well as corr(u_i, Xb). This happens using both Windows and macOS versions of Stata. The data has been xtset to the identifier that is also the clustering variable (as panel variable) and Date (time variable), which is essentially a combination of Quarters and Years.

    Please see the outputs below:

    Number one:

    Code:
    .                 xtreg ln_ARPU ib6.T i.quarter i.year if Classification <= 1,    fe    vce(cluster    num_ID_TransactionXopera
    > tor)
    note: 2015.year omitted because of collinearity
    
    Fixed-effects (within) regression               Number of obs     =      1,974
    Group variable: num_ID_Tra~r                    Number of groups  =        169
    
    R-sq:                                           Obs per group:
    within  = 0.2073                                         min =          2
    between = 0.0005                                         avg =       11.7
    overall = 0.0014                                         max =         13
    
    F(29,168)         =      14.35
    corr(u_i, Xb)  = -0.0547                        Prob > F          =     0.0000
    
    (Std. Err. adjusted for 169 clusters in num_ID_TransactionXoperator)
    
    Robust
    ln_ARPU       Coef.   Std. Err.      t    P>t     [95% Conf. Interval]
    
    T
    0     .1464512   .0222273     6.59   0.000     .1025704    .1903321
    1     .1104406   .0241675     4.57   0.000     .0627294    .1581518
    2     .0917803   .0210803     4.35   0.000     .0501638    .1333968
    3     .0891851   .0188199     4.74   0.000      .052031    .1263391
    4     .0392178   .0141845     2.76   0.006      .011215    .0672206
    5      .004495   .0175504     0.26   0.798    -.0301528    .0391428
    7    -.0257231   .0097921    -2.63   0.009    -.0450545   -.0063916
    8    -.0262767   .0151852    -1.73   0.085    -.0562551    .0037016
    9    -.0324765   .0168639    -1.93   0.056     -.065769    .0008159
    10    -.0492936   .0192576    -2.56   0.011    -.0873117   -.0112756
    11    -.0555349   .0206217    -2.69   0.008     -.096246   -.0148239
    12      -.10436   .0215756    -4.84   0.000    -.1469541   -.0617659
    
    quarter
    2     .0323722   .0065651     4.93   0.000     .0194115     .045333
    3     .0449597   .0074739     6.02   0.000     .0302048    .0597147
    4     .0341042   .0080369     4.24   0.000      .018238    .0499705
    
    year
    2001    -.0241788   .0208703    -1.16   0.248    -.0653806     .017023
    2002    -.0588143   .0368366    -1.60   0.112    -.1315366     .013908
    2003     -.133443   .0604899    -2.21   0.029    -.2528613   -.0140247
    2004    -.1148378   .0605792    -1.90   0.060    -.2344323    .0047568
    2005    -.0774621   .0631883    -1.23   0.222    -.2022075    .0472834
    2006    -.0303142   .0685139    -0.44   0.659    -.1655733    .1049449
    2007    -.0331721   .0806189    -0.41   0.681    -.1923288    .1259846
    2008      .119141   .0682179     1.75   0.083    -.0155338    .2538158
    2009    -.0426798    .066156    -0.65   0.520    -.1732841    .0879245
    2010    -.0884542   .0532357    -1.66   0.098    -.1935513    .0166428
    2011    -.0255585   .0466674    -0.55   0.585    -.1176886    .0665716
    2012     .0457716    .036172     1.27   0.207    -.0256386    .1171817
    2013     .0259649   .0270016     0.96   0.338    -.0273413    .0792712
    2014      .071395   .0185325     3.85   0.000     .0348085    .1079815
    2015            0  (omitted)
    
    _cons    2.473844   .0318103    77.77   0.000     2.411045    2.536644
    
    sigma_u    1.049576
    sigma_e   .16235026
    rho   .97663265   (fraction of variance due to u_i)
    
    
    .
    end of do-file
    Number two:

    Code:
    . xtreg ln_ARPU ib6.T i.year i.quarter if Classification <= 1, fe vce(cluster num_ID_TransactionXoperator)
    note: 4.quarter omitted because of collinearity
    
    Fixed-effects (within) regression               Number of obs     =      1,974
    Group variable: num_ID_Tra~r                    Number of groups  =        169
    
    R-sq:                                           Obs per group:
         within  = 0.2073                                         min =          2
         between = 0.0872                                         avg =       11.7
         overall = 0.0814                                         max =         13
    
                                                    F(29,168)         =      14.35
    corr(u_i, Xb)  = 0.1252                         Prob > F          =     0.0000
    
              (Std. Err. adjusted for 169 clusters in num_ID_TransactionXoperator)
    ------------------------------------------------------------------------------
                 |               Robust
         ln_ARPU |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
               T |
              0  |   .0782427   .0265134     2.95   0.004     .0259004    .1305851
              1  |   .0536002   .0276805     1.94   0.054    -.0010463    .1082467
              2  |    .046308   .0226806     2.04   0.043     .0015323    .0910836
              3  |   .0550808    .017973     3.06   0.003     .0195989    .0905628
              4  |   .0164817   .0163601     1.01   0.315    -.0158163    .0487796
              5  |  -.0068731   .0169055    -0.41   0.685    -.0402476    .0265014
              7  |   -.014355   .0102733    -1.40   0.164    -.0346363    .0059264
              8  |  -.0035406    .017086    -0.21   0.836    -.0372715    .0301904
              9  |   .0016277   .0197344     0.08   0.934    -.0373316     .040587
             10  |  -.0038213   .0240786    -0.16   0.874    -.0513568    .0437143
             11  |   .0013055   .0269264     0.05   0.961    -.0518523    .0544632
             12  |  -.0361515   .0280236    -1.29   0.199    -.0914753    .0191723
                 |
            year |
           2001  |  -.0696511    .023932    -2.91   0.004    -.1168973   -.0224049
           2002  |   -.149759   .0413828    -3.62   0.000    -.2314562   -.0680617
           2003  |  -.2698599   .0701849    -3.84   0.000    -.4084179    -.131302
           2004  |  -.2967271   .0775532    -3.83   0.000    -.4498315   -.1436226
           2005  |  -.3048237    .087558    -3.48   0.001    -.4776794   -.1319681
           2006  |  -.3031482   .0949074    -3.19   0.002    -.4905131   -.1157833
           2007  |  -.3514784   .1268056    -2.77   0.006    -.6018162   -.1011407
           2008  |  -.2446377   .1089912    -2.24   0.026    -.4598064   -.0294689
           2009  |  -.4519307   .1088836    -4.15   0.000    -.6668871   -.2369744
           2010  |  -.5431775   .1155882    -4.70   0.000    -.7713701    -.314985
           2011  |  -.5257541   .1243861    -4.23   0.000    -.7713153    -.280193
           2012  |  -.4998964    .131967    -3.79   0.000    -.7604237   -.2393691
           2013  |  -.5651754   .1427426    -3.96   0.000    -.8469756   -.2833751
           2014  |  -.5652176   .1517425    -3.72   0.000    -.8647854   -.2656498
           2015  |  -.6820849   .1607377    -4.24   0.000    -.9994108   -.3647591
                 |
         quarter |
              2  |   .0210041   .0057406     3.66   0.000     .0096711    .0323372
              3  |   .0222236   .0068018     3.27   0.001     .0087956    .0356515
              4  |          0  (omitted)
                 |
           _cons |   2.862927   .0925403    30.94   0.000     2.680236    3.045619
    -------------+----------------------------------------------------------------
         sigma_u |  1.0101402
         sigma_e |  .16235026
             rho |  .97481936   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    
    .
    Does someone have an idea what could cause the issue?

    Any help is highly appreciated! Thanks!

    Bests
    Last edited by John Stata; 19 Nov 2018, 15:09. Reason: Panel Data, xtreg, correlation

  • #2
    You have colinearity among T, quarter, and year. With that colinearity, the model is not identified. To identify the model, Stata omits one or more of the colinear variables until the colinearity is resolved. Which variables Stata chooses to omit depends on the order in which the variables are specified in the command. In general, it looks to the last one mentioned to find variables to remove. You will notice that Stata told you in the first case that it omitted 2015.year, and in the second case that it omitted 4.quarter because of colinearity. That causes a reshuffle of things, and changes the coefficients of all the variables involved in the colinear relationship.

    The important thing to understand is that this is not a problem at all. The overall model remains the same: any -predict-ions it makes will be the same in either case. Predicted values and statistics generated by -margins- are the same either way. The overall model F-test is the same. The two models are algebraic transforms of each other; they contain the same information as a whole--they just distribute it differently among the variables.

    You may be wondering which of these you should believe. With regard to outcomes based on the entire model, there is no issue: the results will be the same. With regard to outcomes relying on specific coefficients, the answer is neither--because the model was unidentifiable, no specific constrained model is "correct" at this level of detail.

    Now, I would also point out that you have a weird surname. Or rather, I believe you are using a pseudonym. This is strongly discouraged here. The norm in this community is to use our real given and family names, so as to promote collegiality and professionalism. Unfortunately, the Forum software does not permit you to edit your username once your account has been established. So please click on Contact Us (lower right corner of the window) and send a message to the Forum administrator requesting him to change your username. Thank you.

    Comment


    • #3
      Thanks a lot! That makes absolute sense now - really helpful, Clyde.
      I will take care of the name issue.
      Bests

      Comment

      Working...
      X