Announcement

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

  • Breusch-Pagan LM Test for Random Effect Model

    Hi everyone,

    I'm confused by xttest0 result and wondering about this result inference. My data consist of 74 observation for 3 years (2016-2018).
    Before i explain my confusion let me show my result of F test (chow) over my time dummies (time effect) in my FE model.

    Code:
    . xtreg Y X1 X2 i.year, vce(robust)
    
    Random-effects GLS regression                   Number of obs     =        222
    Group variable: id                           Number of groups  =         74
    
    R-sq:                                           Obs per group:
         within  = 0.5808                                         min =          3
         between = 0.7509                                         avg =        3.0
         overall = 0.6921                                         max =          3
    
                                                    Wald chi2(4)      =     224.45
    corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
    
                                      (Std. Err. adjusted for 74 clusters in id)
    ------------------------------------------------------------------------------
                 |               Robust
               Y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
              X1 |   .7108377   .1066756     6.66   0.000     .5017573    .9199181
              X2 |   28.54182   3.993661     7.15   0.000     20.71438    36.36925
                 |
           id |
           2017  |  -.6259327   .3506201    -1.79   0.074    -1.313136    .0612702
           2018  |  -2.147511   .5524324    -3.89   0.000    -3.230259   -1.064763
                 |
           _cons |  -.8966768   .5696678    -1.57   0.115    -2.013205    .2198515
    -------------+----------------------------------------------------------------
         sigma_u |  1.8382725
         sigma_e |  2.7763652
             rho |  .30478115   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    
    . testparm i.year
    
     ( 1)  2017.year = 0
     ( 2)  2018.year = 0
    
               chi2(  2) =   15.13
             Prob > chi2 =    0.0005
    Based on that result i conclude that i should include time dummies in my model.
    But the question came when i'm trying to test Breusch-Pagan LM for my re model.
    Because i include time dummies in my model,
    1. how to test variance for my dummies using xttest0?
    2. because i assumed that breusch pagan only test H0; σ2μi = 0 (individual effect variance), how about time dummies that i include in model? does it mean that i also test H0; σ2δt = 0 (time effect variance)?

    and this is how i do xttest0, feel free to correct:

    Code:
    . xtreg Y X1 X2 i.year, re vce (robust)
    
    Random-effects GLS regression                   Number of obs     =        222
    Group variable: id                            Number of groups  =         74
    
    R-sq:                                           Obs per group:
         within  = 0.5808                                         min =          3
         between = 0.7509                                         avg =        3.0
         overall = 0.6921                                         max =          3
    
                                                    Wald chi2(4)      =     224.45
    corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
    
                                      (Std. Err. adjusted for 74 clusters in Kode)
    ------------------------------------------------------------------------------
                 |               Robust
               Y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
              X1 |   .7108377   .1066756     6.66   0.000     .5017573    .9199181
              X2 |   28.54182   3.993661     7.15   0.000     20.71438    36.36925
                 |
           year |
           2017  |  -.6259327   .3506201    -1.79   0.074    -1.313136    .0612702
           2018  |  -2.147511   .5524324    -3.89   0.000    -3.230259   -1.064763
                 |
           _cons |  -.8966768   .5696678    -1.57   0.115    -2.013205    .2198515
    -------------+----------------------------------------------------------------
         sigma_u |  1.8382725
         sigma_e |  2.7763652
             rho |  .30478115   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    
    . xttest0
    
    Breusch and Pagan Lagrangian multiplier test for random effects
    
            Y[Kode,t] = Xb + u[Kode] + e[Kode,t]
    
            Estimated results:
                             |       Var     sd = sqrt(Var)
                    ---------+-----------------------------
                           Y |   35.59679       5.966304
                           e |   7.708204       2.776365
                           u |   3.379246       1.838272
    
            Test:   Var(u) = 0
                                 chibar2(01) =    18.54
                              Prob > chibar2 =   0.0000
    *i'm sorry, maybe i made a wrong assumption or conclude the wrong conclusions, please help me to understand this information, Thank you.
    Last edited by Samuel Renhoar; 26 May 2020, 23:30.

  • #2
    Samuel:
    -xttest0- dose not take -i.time- into account.
    You can re-run -xtreg- without -i.time- and see whether -xttest0- outcome differs.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Samuel:
      in my previous reply I should have been clearer.
      -xttest0- tests whether the variance of the group-wise fixed effect=0.
      Hence, its outcome can (usually) slightly change with and without -i.year- but its variation are not substantive:
      Code:
      use "https://www.stata-press.com/data/r16/nlswork.dta"
      . xtreg ln_wage age , re
      
      Random-effects GLS regression                   Number of obs     =     28,510
      Group variable: idcode                          Number of groups  =      4,710
      
      R-sq:                                           Obs per group:
           within  = 0.1026                                         min =          1
           between = 0.0877                                         avg =        6.1
           overall = 0.0774                                         max =         15
      
                                                      Wald chi2(1)      =    3140.35
      corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
      
      ------------------------------------------------------------------------------
           ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
               age |   .0185667   .0003313    56.04   0.000     .0179174    .0192161
             _cons |   1.120439   .0112038   100.01   0.000      1.09848    1.142398
      -------------+----------------------------------------------------------------
           sigma_u |  .36972456
           sigma_e |  .30349389
               rho |  .59743613   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      
      . xttest0
      
      Breusch and Pagan Lagrangian multiplier test for random effects
      
              ln_wage[idcode,t] = Xb + u[idcode] + e[idcode,t]
      
              Estimated results:
                               |       Var     sd = sqrt(Var)
                      ---------+-----------------------------
                       ln_wage |   .2285836       .4781042
                             e |   .0921085       .3034939
                             u |   .1366963       .3697246
      
              Test:   Var(u) = 0
                                   chibar2(01) = 28235.40
                                Prob > chibar2 =   0.0000
      
      .
      . xtreg ln_wage age i.year, re
      
      Random-effects GLS regression                   Number of obs     =     28,510
      Group variable: idcode                          Number of groups  =      4,710
      
      R-sq:                                           Obs per group:
           within  = 0.1060                                         min =          1
           between = 0.0918                                         avg =        6.1
           overall = 0.0807                                         max =         15
      
                                                      Wald chi2(15)     =    3253.70
      corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
      
      ------------------------------------------------------------------------------
           ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
               age |   .0137208   .0018898     7.26   0.000     .0100169    .0174247
                   |
              year |
               69  |   .0744312    .012506     5.95   0.000     .0499199    .0989425
               70  |   .0453659   .0120494     3.77   0.000     .0217496    .0689822
               71  |   .0819949   .0125373     6.54   0.000     .0574222    .1065676
               72  |   .0827461   .0136074     6.08   0.000      .056076    .1094162
               73  |   .0840751   .0143598     5.85   0.000     .0559304    .1122198
               75  |   .0707387   .0167492     4.22   0.000     .0379108    .1035665
               77  |   .1032639   .0197156     5.24   0.000      .064622    .1419059
               78  |   .1279039   .0214888     5.95   0.000     .0857866    .1700211
               80  |    .108871   .0247933     4.39   0.000      .060277     .157465
               82  |    .098831   .0280824     3.52   0.000     .0437906    .1538714
               83  |   .1127655   .0298539     3.78   0.000     .0542529    .1712781
               85  |   .1380611   .0333412     4.14   0.000     .0727135    .2034087
               87  |   .1264818   .0369222     3.43   0.001     .0541156     .198848
               88  |   .1640382   .0393563     4.17   0.000     .0869012    .2411752
                   |
             _cons |   1.162473     .03784    30.72   0.000     1.088308    1.236638
      -------------+----------------------------------------------------------------
           sigma_u |  .36664367
           sigma_e |  .30300411
               rho |  .59418375   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      
      . xttest0
      
      Breusch and Pagan Lagrangian multiplier test for random effects
      
              ln_wage[idcode,t] = Xb + u[idcode] + e[idcode,t]
      
              Estimated results:
                               |       Var     sd = sqrt(Var)
                      ---------+-----------------------------
                       ln_wage |   .2285836       .4781042
                             e |   .0918115       .3030041
                             u |   .1344276       .3666437
      
              Test:   Var(u) = 0
                                   chibar2(01) = 28255.98
                                Prob > chibar2 =   0.0000
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        Carlo:

        Yes, i assume the same thought that xttest0 doesn't take i.time into account, but i wanted to know the reason, why xtreg, re doesn't take i.time into account?
        Does it mean time effect (i.time) is not included as a composite error term?

        I read in some references said that composite error term is consist of only vit = ai + uit (ai as i considered as "group-wise fixed effect" as you said) , but why dt doesn't not take into account?

        Comment


        • #5
          Samuel:
          in the composite error term you have a group-wise effect (ui, as you stated) that varies between units but is time-invariant and the idiosyncratic error (whic is the usual residual that you obtain from -regress-), that varies between units and is also time-varying, as you can see from the following tiy-example:
          Code:
          . use "https://www.stata-press.com/data/r16/nlswork.dta"
          (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
          
          . xtreg ln_wage age i.year, re vce(cluster idcode)
          
          Random-effects GLS regression                   Number of obs     =     28,510
          Group variable: idcode                          Number of groups  =      4,710
          
          R-sq:                                           Obs per group:
               within  = 0.1060                                         min =          1
               between = 0.0918                                         avg =        6.1
               overall = 0.0807                                         max =         15
          
                                                          Wald chi2(15)     =    1244.11
          corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
          
                                       (Std. Err. adjusted for 4,710 clusters in idcode)
          ------------------------------------------------------------------------------
                       |               Robust
               ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                   age |   .0137208   .0019471     7.05   0.000     .0099046     .017537
                       |
                  year |
                   69  |   .0744312   .0102944     7.23   0.000     .0542545    .0946078
                   70  |   .0453659   .0106757     4.25   0.000     .0244419    .0662899
                   71  |   .0819949   .0116296     7.05   0.000     .0592013    .1047885
                   72  |   .0827461   .0129338     6.40   0.000     .0573963    .1080959
                   73  |   .0840751   .0138388     6.08   0.000     .0569516    .1111986
                   75  |   .0707387   .0162295     4.36   0.000     .0389295    .1025479
                   77  |   .1032639   .0193333     5.34   0.000     .0653713    .1411565
                   78  |   .1279039   .0210903     6.06   0.000     .0865676    .1692401
                   80  |    .108871   .0247186     4.40   0.000     .0604235    .1573185
                   82  |    .098831    .027873     3.55   0.000      .044201    .1534611
                   83  |   .1127655   .0301942     3.73   0.000      .053586     .171945
                   85  |   .1380611   .0335078     4.12   0.000     .0723871    .2037351
                   87  |   .1264818   .0373374     3.39   0.001     .0533019    .1996617
                   88  |   .1640382   .0402879     4.07   0.000     .0850755    .2430009
                       |
                 _cons |   1.162473   .0397287    29.26   0.000     1.084606     1.24034
          -------------+----------------------------------------------------------------
               sigma_u |  .36664367
               sigma_e |  .30300411
                   rho |  .59418375   (fraction of variance due to u_i)
          ------------------------------------------------------------------------------
          
          . testparm(i.year)
          
           ( 1)  69.year = 0
           ( 2)  70.year = 0
           ( 3)  71.year = 0
           ( 4)  72.year = 0
           ( 5)  73.year = 0
           ( 6)  75.year = 0
           ( 7)  77.year = 0
           ( 8)  78.year = 0
           ( 9)  80.year = 0
           (10)  82.year = 0
           (11)  83.year = 0
           (12)  85.year = 0
           (13)  87.year = 0
           (14)  88.year = 0
          
                     chi2( 14) =  131.04
                   Prob > chi2 =    0.0000
          
          
          . predict random, u
          (24 missing values generated)
          
          . predict idiosyncratic, e
          (24 missing values generated)
          
          . list idcode random idiosyncratic if idcode==10
          
                 +--------------------------------+
                 | idcode      random   idiosyn~c |
                 |--------------------------------|
             98. |     10   -.2214957    .1129395 |
             99. |     10   -.2214957    .2281664 |
            100. |     10   -.2214957    .3279955 |
            101. |     10   -.2214957    .0033683 |
            102. |     10   -.2214957    .0640546 |
                 |--------------------------------|
            103. |     10   -.2214957    -.066005 |
            104. |     10   -.2214957   -.0090556 |
            105. |     10   -.2214957   -.1587584 |
            106. |     10   -.2214957   -.6539827 |
                 +--------------------------------+
          
          .
          Hence, -xtreg- takes -i.time- into account.

          xttest0- tests whether the variance of the group-wise fixed effect=0.
          Hence, its outcome can (usually) slightly change with and without -i.year- but its variation are not substantive.
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment

          Working...
          X