Announcement

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

  • Diagnostic Tests for unbalanced Panel-Data after using Fixed Effects

    hey,

    i run fe and need to check for Autocorrelation and Heteroscedesticity. Would you recommend to check further assumptions? I found -xttest2- which seems to work for my model? And that I can correct autocorrelation and heteroscedesticity: https://www.statalist.org/forums/for...ts-diagnostics
    It seems that there are several options for different cases and i don't know which tests fit for my model.

    Thank you!

    Code:
    xtreg bezqual_anker i.transition, fe
    estimates store step1
    
    xtreg bezqual_anker i.transition c.depressive c.selfesteem, fe
    estimates store step2
    
    xtreg bezqual_anker i.transition c.depressive c.selfesteem c.fsit_a c.inc28, fe
    estimates store step3
    
    xtreg bezqual_anker i.transition c.depressive c.selfesteem c.fsit_a c.inc28 i.move, fe
    estimates store step4
    
    xtreg bezqual_anker i.transition c.depressive c.selfesteem c.fsit_a c.inc28 i.move c.job7, fe
    estimates store step5
    
    xtreg bezqual_anker i.transition c.depressive c.selfesteem c.fsit_a c.inc28 i.move c.job7 c.warmth_pacs c.monitor_pacs c.negcomm_pacs c.inconsist_pacs c.cwarmth_cao c.cmonitor_cao, fe
    estimates store step6
    
    xtreg bezqual_anker i.transition c.depressive c.selfesteem c.fsit_a c.inc28 i.move c.job7 c.warmth_pacs c.monitor_pacs c.negcomm_pacs c.inconsist_pacs c.cwarmth_cao c.cmonitor_cao c.age c.cagey c.nkidsliv, fe
    estimates store step7
    
    estimates table step1 step2 step3 step4 step5 step6 step7, b(%7.4f) stats(N r2) star varlabel


    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long(id cid) byte(wave age nkidsliv) double job7 byte(inc28 cagey) float(bezqual_anker transition depressive selfesteem cwarmth_cao cmonitor_cao warmth_pacs monitor_pacs negcomm_pacs inconsist_pacs fsit_a move)
      111000   111203 3 39 2    0  3  9 4.6 0   1         5 4.6666665   4 4.6666665 3.75 1.6666666  2.5   5 1
      111000   111203 4 40 2    0  3 10 3.8 1 2.2 4.6666665         5 4.5 4.6666665 4.25  3.666667  3.5   4 0
      111000   111203 5 41 2    0  0 11 3.4 0 2.6         3  3.333333 2.5         4 3.25         2  3.5 4.5 0
      111000   111203 6 42 1    3  5 12 3.8 1 1.1 4.6666665 4.3333335 2.5 4.6666665  3.5 2.3333333  2.5 4.5 0
      111000   111203 7 43 1   40  5 13   4 1 1.5         5 4.6666665 3.5         4 3.75 1.6666666 2.75   5 0
      111000   111203 8 44 1    0  5 14 3.8 0 1.4 4.6666665         5   3         4  3.5 1.6666666 2.75   5 0
     1300000  1300202 3 37 1   40  8 13 4.2 0 1.4 4.6666665         5   5 4.6666665 4.75 2.3333333  1.5   1 0
     1300000  1300202 4 38 1   50  6 14 4.4 0 2.3         4 4.6666665   4 4.6666665 4.75         2    2   2 0
     3902000  3902201 5 42 3   42  3  9   4 0 1.4 4.3333335 4.3333335   4 4.6666665  4.5         2 2.75 3.5 0
     3902000  3902201 6 42 3   38  4  9 4.2 0 1.4 4.3333335         5 3.5 4.6666665  4.5  2.666667  2.5   3 0
     3902000  3902201 7 43 3   43  3 10   4 0 1.2         4 4.3333335 4.5 4.6666665 4.25 2.3333333 2.25   4 0
     3902000  3902201 8 44 3   38  3 11 4.2 0 1.5 4.3333335         5   4 4.6666665 4.25 2.3333333  2.5   4 0
     4835000  4835201 5 41 1   40  5 13   3 0   2 4.6666665  3.666667 1.5         4  3.5 2.3333333 3.25   3 0
     4858000  4858201 5 29 1   25  6  9   5 0   1         5         5   5         5 4.25         1 1.25   3 0
     4858000  4858201 6 30 1   30  9 11 3.6 1 1.5         5         4   5         5 4.25  3.333333  2.5   4 0
     6151000  6151201 5 40 2   25  8  8   4 0 1.2 4.3333335 4.6666665   4 4.3333335    5 2.3333333    2   1 0
     6151000  6151201 6 41 2   20  9  9 3.8 0 1.2 4.3333335 4.3333335   5 4.6666665 4.75 2.3333333    2   1 0
     6151000  6151201 7 42 2   30  9 10 3.8 0 1.3 4.3333335  3.333333   5         5 3.75  3.333333 1.75   1 0
     6151000  6151201 8 43 2   25  8 11 3.6 0 1.1 4.3333335 4.6666665 4.5         5 4.75  2.666667 1.75 1.5 0
     6519000  6519201 4 41 1   40  5 10 3.2 0   2  2.666667         5   3         4  3.5  2.666667 3.25   4 0
     6519000  6519201 5 41 1   35  5 11 3.8 1 1.9         3         5   4         4 3.25  3.333333    3   3 0
     6519000  6519201 6 43 1   42  5 12 3.2 0 2.1  3.666667 4.3333335   4         4 3.75         3  3.5   3 0
     6519000  6519201 7 44 1   40  7 13 3.2 0 2.1         3 4.6666665   3         4    4 2.3333333  3.5   2 0
     6519000  6519201 8 45 1   40  7 14 3.2 0 2.5  3.333333 4.6666665 3.5         4 3.75         3    4 1.5 0
     8948000  8948201 3 38 1 48.5  5  9 3.4 0 1.4         3 4.3333335   3 4.3333335  4.5         2 2.25   4 0
     8948000  8948201 4 39 1   50  5 10 3.6 0 1.8         3 4.6666665   3 4.6666665    4         2 2.25 3.5 0
     8948000  8948201 5 40 1   50  6 11 3.2 0 1.8  3.666667 4.3333335 3.5 4.6666665 3.75         2  2.5 3.5 0
     8948000  8948201 6 41 1   50  6 12   3 0 1.6         3  3.333333   3 4.3333335  3.5         2  2.5 3.5 0
     8948000  8948201 7 42 1   50  6 13 3.4 0 1.6  3.666667         4 3.5         4    3         2 2.25   4 0
     8948000  8948201 8 43 1   50  5 14 3.2 0 1.6 4.3333335  3.666667   3         4 3.25         2 1.75 3.5 0
     9657000  9657201 5 41 3    0  9  8 3.8 0 1.8  3.666667         4   4 4.3333335    5         4  3.5 1.5 0
     9657000  9657201 8 44 3    9 10 11 3.6 0 1.9         4 4.3333335 3.5 4.3333335 4.75         3  3.5   1 0
     9917000  9917201 5 39 2   45  9  8 3.8 0 1.1 4.6666665         5 4.5         4    4         3  2.5   2 0
     9917000  9917201 6 40 2   45  9  9   4 0 1.3 4.3333335 4.6666665 4.5         4    4  2.666667 2.25   2 0
     9917000  9917201 8 42 2   50 10 11 3.4 0 1.2 4.3333335         5   5 4.3333335 4.25  3.333333 2.25   2 0
    10208000 10208201 3 38 2   40  6  8   4 0 1.7  2.666667 4.3333335   5         4    4 2.3333333 2.25 2.5 0
    10208000 10208201 4 39 2   40  6  9 3.6 0 1.6 4.3333335 4.6666665 4.5         4  3.5         2  2.5   3 0
    10208000 10208201 5 40 2   40  7  9 4.4 0 1.6 4.3333335 4.6666665   5         4    4 2.3333333    2   2 0
    10208000 10208201 6 41 2   40  7 11   4 0 1.7         4         4 3.5         4 3.75 2.3333333 2.25 2.5 0
    10208000 10208201 7 42 2   40  7 12 3.8 0 1.7 4.3333335         4 3.5         4 3.75  2.666667  2.5   1 0
    10208000 10208201 8 43 2   40  7 13 3.8 0 1.6         4         4   4         4 4.25  2.666667 2.25   2 0
    10957000 10957202 3 39 2   40  1 13 4.2 0 1.1         5  3.333333   2         4 3.25         2 2.75 3.5 0
    10957000 10957202 4 40 2   40  0 14   4 0 1.1 4.3333335  3.666667 2.5         4 3.75 1.6666666    4 3.5 0
    10957000 10957202 5 41 2   41  3 15 3.8 0 1.3         5 4.6666665   2 4.3333335  3.5 1.6666666  3.5 3.5 0
    11295000 11295201 4 38 2   21  7  8 3.8 0 2.7         4 4.6666665 4.5 4.6666665 4.75         2 2.75 3.5 1
    11295000 11295201 5 39 2   30  7  9 3.8 0 2.1 4.6666665         4 4.5         5  4.5 2.3333333 2.75   4 0
    11295000 11295201 6 40 2   42  4 10 3.8 0 2.7         3 4.3333335 3.5 4.6666665 4.75         2 2.75   4 0
    11295000 11295201 7 41 2   40  8 11 3.6 0 2.4         4         4   4 4.6666665 4.25 1.6666666 2.25   3 0
    11295000 11295201 8 42 2   30  7 12 3.4 0 2.1 4.3333335 4.6666665   5         4 4.75         2 2.75   3 0
    12266000 12266201 3 37 1   50  6 12 3.8 0   2         3  3.666667   5  3.333333 4.25         3 3.25   4 0
    12266000 12266201 6 40 1   48  3 14 3.2 0 2.3  3.333333         4 4.5 4.3333335    4  2.666667 4.75   5 0
    12471000 12471201 6 31 2   34  9  9   3 0 1.8         4 4.3333335 4.5  3.666667 3.75         3    3   3 0
    12490000 12490201 3 38 3    0  6  8 3.6 0 1.7         4 4.3333335 4.5  3.333333    5  3.333333 2.75   3 0
    12490000 12490201 4 39 3    0  7  9 3.4 0 1.8         5         5   5         3 4.75         4  3.5   2 0
    12490000 12490201 5 40 3   27  8 10 3.6 0 1.9 4.3333335 4.6666665   3         3  4.5         4  3.5   3 0
    12490000 12490201 6 41 3   28  7 11   3 0 1.7         4         4   5         4 3.75         3    3   3 0
    12490000 12490201 7 42 3   28  8 12 3.4 0 1.4  3.666667  3.666667   4         5 4.75 2.3333333    3   2 0
    12490000 12490201 8 43 3   18  3 13   3 0 1.3 4.3333335 4.3333335   5         3 3.75         3    3   2 0
    13345000 13345202 3 39 2    0  8 11 4.4 0 1.5  3.666667 4.6666665   5         4  4.5         2 2.75   3 0
    13588000 13588201 6 40 3   35  5  8 4.4 0 1.7         4 4.3333335   4         5  4.5 2.3333333    3   3 0
    13588000 13588201 7 41 3   35  5  9 4.6 0 1.6  2.666667         5   4         5    5 1.3333334    2   3 0
    13937000 13937201 6 41 2   50  8  8 3.8 0 1.2 4.3333335 4.6666665   5         5  4.5         2 2.25   2 0
    13937000 13937201 8 43 2   70  2 10 3.8 0 1.3  3.666667         4   4         5  4.5 1.6666666    2 2.5 0
    14722000 14722201 3 38 2   42  5  9 3.4 0 1.3 4.3333335  3.333333   5  3.666667  3.5         3 2.25   3 0
    14722000 14722201 4 39 2   39  7 10 3.6 0 1.5 4.6666665         5   4         4 3.75  2.666667 2.25   3 0
    14722000 14722201 5 40 2   45  6 11 3.6 0 1.4 4.6666665  3.666667   3         3  3.5         2 1.25   3 0
    14722000 14722201 6 41 2   48  5 12 3.6 0 1.4 4.3333335  3.666667 2.5  3.666667 3.75 2.3333333 1.25 1.5 0
    14722000 14722201 7 42 2   45  7 13 3.6 0 1.4 4.3333335  3.333333   3         4    3 2.3333333  1.5   2 0
    14722000 14722201 8 43 2   45  8 14   3 0 1.5         5  3.666667   3  3.333333 2.75 2.3333333 1.75   2 0
    14898000 14898201 4 40 3   12  7 11 4.2 0 1.4 4.3333335 4.3333335   5 4.3333335 4.25         3    3   2 0
    14898000 14898201 6 42 3   15  7 13   4 0 1.4 4.6666665 4.3333335   4         4    4 2.3333333    2 2.5 0
    14902000 14902201 5 30 1   25  5  8 4.8 0 1.3         5 4.6666665   5         5 4.75 1.3333334 1.75   4 0
    14902000 14902201 6 31 1   25  7  9   5 0 1.3         5         5   5         5    5         1 1.25 3.5 0
    14902000 14902201 8 33 1   25  7 11 4.6 0   1         5 4.6666665   5         5    5  2.666667    3   3 0
    15595000 15595201 4 40 2   40  9  7 4.6 0 1.1         5         5   5 4.6666665 4.75 2.3333333 2.75   2 0
    15595000 15595201 5 41 2   40  9  9 4.6 0   1         5         5   5         5 4.75 2.3333333 2.25   1 0
    15595000 15595201 6 42 2   45 10 10 4.6 0 1.2         5         5   5         5    5         2 2.25   1 0
    15595000 15595201 7 43 2   45  9 11 4.2 0   1         5         4   5 4.6666665    5 2.3333333  2.5   1 0
    15595000 15595201 8 44 2   50  9 12 4.4 0   1         5 4.3333335 4.5 4.6666665 4.75         2 2.75   1 0
    16512000 16512202 4 39 2   38  7 10 3.4 0 1.6 4.3333335         5   5         4    5  2.666667    3   3 0
    16512000 16512202 5 40 2   39  7 11 3.8 0 1.7         4         5   5         4    5 2.3333333    3 2.5 0
    16512000 16512202 6 41 2   39  8 12 3.6 0 1.5  3.666667         5 4.5  3.666667    5         2 2.75   3 0
    16512000 16512202 7 42 2   40  8 13 3.8 0 1.6  3.666667 4.6666665   5  3.666667 4.75  2.666667    3   2 0
    16512000 16512202 8 43 2   42  8 14   3 0 1.6         4 4.3333335 3.5  3.666667    5 2.3333333 3.25 2.5 0
    16671000 16671201 3 39 1   36  8 10 3.6 0 1.5 4.3333335 4.3333335   3         4 3.75         3 3.25   2 0
    16671000 16671201 4 40 1   40  8 11 3.6 0 1.3         4  3.666667   4         4 3.75 2.3333333    3   3 0
    16829000 16829201 3 38 2 19.5  6 12   2 0 2.4         3 4.3333335 4.5  3.666667 3.75         3  2.5   2 0
    16829000 16829201 4 39 2   19  6 13 1.8 0 2.6  3.666667 2.3333333   3         3    3         3 2.25   2 0
    16829000 16829201 5 40 2   19  0 14 2.4 0 2.3  3.333333  3.666667 2.5  3.333333 3.25 2.3333333 2.25   3 0
    17018000 17018203 3 38 5    0 10 10 3.6 0 1.2 4.3333335 4.3333335 4.5 4.3333335 3.75  3.333333 2.25   1 0
    17018000 17018203 4 40 5    3  9 11 3.4 0 1.4 4.3333335         4   4 4.3333335 3.75  2.666667 1.75   1 0
    17018000 17018203 5 41 5    6 10 12 3.8 0 1.3         4         5   4         4  3.5  2.666667 2.25   1 0
    17018000 17018203 6 41 5    0 10 13 3.4 0 1.4 4.3333335 4.3333335   3 4.3333335 3.25  2.666667 2.25   1 1
    17018000 17018203 7 43 5    0 10 14 3.6 0 1.5 4.3333335         5   5 4.3333335  3.5 2.3333333  2.5   1 1
    17018000 17018203 8 43 5    0  8 15 3.4 0 1.3 4.3333335         5   3 4.3333335 3.75         3 2.75   2 0
    17464000 17464202 3 38 3    0  7  9   4 0 1.7  3.666667         5   5         4  4.5         2 2.75 2.5 0
    17464000 17464202 4 40 3    0  8 11 3.8 0 1.9  2.666667         5   5 4.6666665  4.5 2.3333333 2.25   1 0
    17464000 17464202 5 40 3   20  8 11 3.8 0 1.5         4 4.3333335   5         5    5         2 2.25 1.5 0
    17464000 17464202 6 41 3   20 10 12 3.6 0 1.4         4  3.666667   5         4  4.5 2.3333333  2.5   1 0
    18011000 18011201 3 39 1   50  8  8 3.4 0 1.2 4.3333335  3.666667 3.5  3.666667 3.75  3.333333    3   2 0
    end
    label values wave WAVE_prt3
    label def WAVE_prt3 3 "3 2010/11", modify
    label values age age_ac3
    label values nkidsliv nkids_ac3
    label values job7 liste233_ac3
    label def liste233_ac3 0 "0 Keine", modify
    label values inc28 liste4_ac3
    label def liste4_ac3 0 "0 Sehr unzufrieden", modify
    label def liste4_ac3 10 "10 Sehr zufrieden", modify
    label values bezqual_anker bezqual_anker
    label def bezqual_anker 5 "5 hoch", modify
    label values transition transition
    label def transition 0 "0 k. Veränderung", modify
    label def transition 1 "1 Veränderung", modify
    label values depressive depressive
    label def depressive 1 "1 niedrig", modify
    label values selfesteem selfesteem
    label def selfesteem 5 "5 hoch", modify
    label values cwarmth_cao cwarmth_cao
    label def cwarmth_cao 5 "5 hoch", modify
    label values cmonitor_cao cmonitor_cao
    label def cmonitor_cao 5 "5 hoch", modify
    label values warmth_pacs warmth_pacs
    label def warmth_pacs 5 "5 hoch", modify
    label values monitor_pacs monitor_pacs
    label def monitor_pacs 5 "5 hoch", modify
    label values negcomm_pacs negcomm_pacs
    label def negcomm_pacs 1 "1 niedrig", modify
    label values inconsist_pacs inconsist_pacs
    label values fsit_a fsit_a
    label def fsit_a 1 "1 gut", modify
    label def fsit_a 5 "5 weniger gut", modify
    label values move move
    label def move 0 "kein Umzug", modify
    label def move 1 "Umzug", modify

  • #2
    Guest:
    the user-written programmes -xttest2- (heteroskedasticity) an -xttest3- (serial correlation) should work for -xtreg, fe-.
    If heteroskedasticity and/or autocorrelation were detected, you shpuld -cluster-/-robust- your standard errors.
    Last edited by sladmin; 28 Jan 2019, 09:13. Reason: anonymize original poster
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Originally posted by Carlo Lazzaro View Post
      Guest:
      the user-written programmes -xttest2- (heteroskedasticity) an -xttest3- (serial correlation) should work for -xtreg, fe-.
      If heteroskedasticity and/or autocorrelation were detected, you shpuld -cluster-/-robust- your standard errors.
      sorry to disturb, I have same problem. I have use -xttest3-, and found heteroskedasticity in my model. I try to use -cluster-/-robust-, but it is not working. Do you know what's wrong? The F in fixed effect is F(7,23). Don't know why it is F(4,4) in this case.
      Click image for larger version

Name:	Screen Shot 2017-09-18 at 3.22.53 pm.png
Views:	1
Size:	140.1 KB
ID:	1410889

      Last edited by sladmin; 28 Jan 2019, 09:14. Reason: anonymize original poster

      Comment


      • #4
        Note that you can also use xtserial (industry standard) and xtqptest (new, but more flexible and more powerful) to test for serial correlation.

        PS: In xtreg, robust is the same cluster(panelvar).

        Comment


        • #5
          Julie:
          you should add the -clustvar- after -cluster- between brackets:
          Code:
          . xtreg ln_wage tenure, vce(cluster)
          invalid vce(cluster) option
          r(198);
          
          . xtreg ln_wage tenure, vce(cluster idcode)
          
          Random-effects GLS regression                   Number of obs     =     28,101
          Group variable: idcode                          Number of groups  =      4,699
          
          R-sq:                                           Obs per group:
               within  = 0.0972                                         min =          1
               between = 0.1966                                         avg =        6.0
               overall = 0.1373                                         max =         15
          
                                                          Wald chi2(1)      =    1602.78
          corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
          
                                       (Std. Err. adjusted for 4,699 clusters in idcode)
          ------------------------------------------------------------------------------
                       |               Robust
               ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                tenure |   .0375197   .0009372    40.03   0.000     .0356828    .0393565
                 _cons |   1.556414   .0057731   269.60   0.000     1.545099    1.567729
          -------------+----------------------------------------------------------------
               sigma_u |  .34186762
               sigma_e |  .30357621
                   rho |  .55911764   (fraction of variance due to u_i)
          ------------------------------------------------------------------------------
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            julie stuarly In the example shared in #3, we have just 5 observations followed by 7 periods of time, hence the unsurprisingly nonsignificant p-values for all coefficients, but for the lagged variable.

            It seems to be a rather tiny sample, particularly if we decide to add "robust" (or clusterized) estimations.

            Indeeed, in the Stata Manual, where, by the way, the examples present a much bigger sample size, we read

            The cluster–robust VCE estimator requires that there are many clusters and the disturbances are uncorrelated across the clusters
            Best regards,

            Marcos

            Comment


            • #7
              Originally posted by Carlo Lazzaro View Post
              Guest:
              the user-written programmes -xttest2- (heteroskedasticity) an -xttest3- (serial correlation) should work for -xtreg, fe-.
              If heteroskedasticity and/or autocorrelation were detected, you shpuld -cluster-/-robust- your standard errors.
              This is the Output of the FE Model:
              Code:
              Fixed-effects (within) regression               Number of obs     =      4,117
              Group variable: id                              Number of groups  =      1,245
              
              R-sq:                                           Obs per group:
                   within  = 0.2461                                         min =          1
                   between = 0.4657                                         avg =        3.3
                   overall = 0.4185                                         max =          6
              
                                                              F(16,2856)        =      58.27
              corr(u_i, Xb)  = 0.1656                         Prob > F          =     0.0000
              
              --------------------------------------------------------------------------------
               bezqual_anker |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
              ---------------+----------------------------------------------------------------
                  transition |
              1 Veränderung  |  -.0188378    .025741    -0.73   0.464    -.0693105     .031635
                  depressive |  -.0369163   .0191094    -1.93   0.053    -.0743859    .0005533
                  selfesteem |   .0035448   .0102482     0.35   0.729    -.0165497    .0236394
                      fsit_a |  -.0021314   .0088747    -0.24   0.810    -.0195329    .0152701
                       inc28 |    .008816   .0037417     2.36   0.019     .0014793    .0161527
                             |
                        move |
                      Umzug  |   .0970418   .0384526     2.52   0.012      .021644    .1724395
                        job7 |  -.0005088   .0006211    -0.82   0.413    -.0017267    .0007091
                 warmth_pacs |   .1916763   .0168424    11.38   0.000     .1586519    .2247008
                monitor_pacs |   .1567524   .0159609     9.82   0.000     .1254564    .1880484
                negcomm_pacs |  -.1361931   .0145525    -9.36   0.000    -.1647276   -.1076586
              inconsist_pacs |   -.049548   .0145423    -3.41   0.001    -.0780624   -.0210336
                 cwarmth_cao |   .0640917   .0131153     4.89   0.000     .0383753    .0898082
                cmonitor_cao |   .0257971   .0085085     3.03   0.002     .0091137    .0424804
                         age |  -.0169459   .0202932    -0.84   0.404    -.0567367    .0228448
                       cagey |  -.0127455   .0202859    -0.63   0.530    -.0525221    .0270311
                    nkidsliv |   .0319127   .0214114     1.49   0.136    -.0100707    .0738961
                       _cons |   3.119389   .5895675     5.29   0.000     1.963368     4.27541
              ---------------+----------------------------------------------------------------
                     sigma_u |  .32417286
                     sigma_e |  .27819861
                         rho |  .57588008   (fraction of variance due to u_i)
              --------------------------------------------------------------------------------
              F test that all u_i=0: F(1244, 2856) = 3.25                  Prob > F = 0.0000


              For xttest2 this happens (What's wrong?)

              Code:
               xtreg bezqual_anker i.transition c.depressive c.selfesteem c.fsit_a c.inc28 i.move c.job7 c.warmth_pacs c.monitor_pacs c.negcomm_pacs c.inconsist_pacs c.cwarmth_cao c.cmonitor_cao c.age c.cagey c.nkidsliv, fe
              
              xttest2
              Code:
              . xttest2
              
              Error: too few common observations across panel.
              no observations
              r(2000);
              And xttest3 this:
              Code:
              Modified Wald test for groupwise heteroskedasticity
              in fixed effect regression model
              
              H0: sigma(i)^2 = sigma^2 for all i
              
              chi2 (1245)  =  4.8e+34
              Prob>chi2 =      0.0000
              Does this mean that there is heteroskedasticity because it's highly significant?
              Last edited by sladmin; 28 Jan 2019, 09:14. Reason: anonymize original poster

              Comment


              • #8
                Guest:
                -xttest3- outcome says that you do have heteroskedasticity;
                - consider Jese's advice about serial correlation testing.
                Last edited by sladmin; 28 Jan 2019, 09:14. Reason: anonymize original poster
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment


                • #9
                  Originally posted by Carlo Lazzaro View Post
                  Guest:
                  -xttest3- outcome says that you do have heteroskedasticity;
                  - consider Jese's advice about serial correlation testing.
                  Okay i checked it out but it won't work for my model.
                  -xtqptest- is only valid for fixed effect models without gaps and i do have gaps
                  - xtserial- is for First different

                  to correct the heteroskedasticity I can change it like this?

                  Code:
                  xtreg bezqual_anker i.transition, fe robust
                  estimates store step1
                  
                  xtreg bezqual_anker i.transition c.depressive c.selfesteem, fe robust
                  estimates store step2
                  
                  xtreg bezqual_anker i.transition c.depressive c.selfesteem c.fsit_a c.inc28, fe robust
                  estimates store step3
                  
                  xtreg bezqual_anker i.transition c.depressive c.selfesteem c.fsit_a c.inc28 i.move, fe robust
                  estimates store step4
                  
                  xtreg bezqual_anker i.transition c.depressive c.selfesteem c.fsit_a c.inc28 i.move c.job7, fe robust
                  estimates store step5
                  
                  xtreg bezqual_anker i.transition c.depressive c.selfesteem c.fsit_a c.inc28 i.move c.job7 c.warmth_pacs c.monitor_pacs c.negcomm_pacs c.inconsist_pacs c.cwarmth_cao c.cmonitor_cao, fe robust
                  estimates store step6
                  
                  xtreg bezqual_anker i.transition c.depressive c.selfesteem c.fsit_a c.inc28 i.move c.job7 c.warmth_pacs c.monitor_pacs c.negcomm_pacs c.inconsist_pacs c.cwarmth_cao c.cmonitor_cao c.age c.cagey c.nkidsliv, fe robust
                  estimates store step7
                  
                  estimates table step1 step2 step3 step4 step5 step6 step7, b(%7.4f) stats(N r2) star varlabel
                  Last edited by sladmin; 28 Jan 2019, 09:14. Reason: anonymize original poster

                  Comment


                  • #10
                    Code:
                    xtserial bezqual_anker transition depressive selfesteem fsit_a inc28 move job7 warmth_pacs monitor_pacs negcomm_pacs inconsist_pacs cwarmth_cao  cmonitor_cao age cagey nkidsliv, output
                    
                            *H0: no first-order autocorrelation
                            *F(  1,     700) = 3.688
                            *Prob > F =      0.0552
                    This means that there is also correlation, right?

                    Is it better to - xtreg y x x x x, fe robust - or -xtreg y x x x x, fe cluster (id) ?

                    Do I have to run further tests? Like I have to do for OLS?

                    Thank you all for being so helpful

                    Comment


                    • #11
                      Guest:
                      - no: the null of no-first order autocorrelation is not rejected;
                      - both codes for -xtreg- do the very same job;
                      - I woud not do other tests.
                      Kind regards,
                      Carlo
                      (Stata 19.0)

                      Comment


                      • #12
                        Originally posted by Carlo Lazzaro View Post
                        Guest:
                        - no: the null of no-first order autocorrelation is not rejected;
                        - both codes for -xtreg- do the very same job;
                        - I woud not do other tests.
                        Thank you so much !Now I can finally start to interpret the results! I guess this is my last question concerning this topic. Do you or someone else know how I can adapt this for the fe output? I'd like to show the robust standard errors and the other stuff which is important for the interpretation. i checked the help -help estimates table- but if I try to add se id doesn't work.

                        Code:
                        estimates table step1 step2 step3 step4 step5 step6 step7, b(%7.4f) stats(N r2) star varlabel
                        Last edited by sladmin; 28 Jan 2019, 09:15. Reason: anonymize original poster

                        Comment


                        • #13
                          Guest:
                          do you mean something along the following toy-example?
                          Code:
                          . use "http://www.stata-press.com/data/r14/nlswork.dta", clear
                          (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
                          
                          . xtreg ln_wage i.race grade
                          
                          Random-effects GLS regression                   Number of obs     =     28,532
                          Group variable: idcode                          Number of groups  =      4,709
                          
                          R-sq:                                           Obs per group:
                               within  = 0.0000                                         min =          1
                               between = 0.3170                                         avg =        6.1
                               overall = 0.1970                                         max =         15
                          
                                                                          Wald chi2(3)      =    2188.49
                          corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
                          
                          ------------------------------------------------------------------------------
                               ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                          -------------+----------------------------------------------------------------
                                  race |
                                black  |  -.0459478   .0113042    -4.06   0.000    -.0681036   -.0237919
                                other  |   .1039604   .0467629     2.22   0.026     .0123068     .195614
                                       |
                                 grade |   .0909639   .0020131    45.19   0.000     .0870184    .0949094
                                 _cons |   .5143082   .0267741    19.21   0.000     .4618319    .5667845
                          -------------+----------------------------------------------------------------
                               sigma_u |  .30393641
                               sigma_e |  .32028665
                                   rho |    .473825   (fraction of variance due to u_i)
                          ------------------------------------------------------------------------------
                          
                          . estimates store RE
                          
                          . xtreg ln_wage i.race grade, fe
                          note: 2.race omitted because of collinearity
                          note: 3.race omitted because of collinearity
                          note: grade omitted because of collinearity
                          
                          Fixed-effects (within) regression               Number of obs     =     28,532
                          Group variable: idcode                          Number of groups  =      4,709
                          
                          R-sq:                                           Obs per group:
                               within  = 0.0000                                         min =          1
                               between = 0.0032                                         avg =        6.1
                               overall =      .                                         max =         15
                          
                                                                          F(0,23823)        =       0.00
                          corr(u_i, Xb)  =      .                         Prob > F          =          .
                          
                          ------------------------------------------------------------------------------
                               ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                          -------------+----------------------------------------------------------------
                                  race |
                                black  |          0  (omitted)
                                other  |          0  (omitted)
                                       |
                                 grade |          0  (omitted)
                                 _cons |   1.674906   .0018962   883.32   0.000      1.67119    1.678623
                          -------------+----------------------------------------------------------------
                               sigma_u |  .42462341
                               sigma_e |  .32028665
                                   rho |  .63737122   (fraction of variance due to u_i)
                          ------------------------------------------------------------------------------
                          F test that all u_i=0: F(4708, 23823) = 8.44                 Prob > F = 0.0000
                          
                          . estimates table FE RE, b(%7.3f) stats(N r2) se
                          
                          --------------------------------------
                              Variable |    FE          RE    
                          -------------+------------------------
                                  race |
                                black  | (omitted)      -0.046
                                       |                 0.011
                                other  | (omitted)       0.104
                                       |                 0.047
                                       |
                                 grade | (omitted)       0.091
                                       |                 0.002
                                 _cons |     1.675       0.514
                                       |     0.002       0.027
                          -------------+------------------------
                                     N |     28532       28532
                                    r2 |     0.000            
                          --------------------------------------
                                                    legend: b/se
                          Kind regards,
                          Carlo
                          (Stata 19.0)

                          Comment


                          • #14
                            Originally posted by Guest View Post

                            Okay i checked it out but it won't work for my model.
                            -xtqptest- is only valid for fixed effect models without gaps and i do have gaps
                            - xtserial- is for First different
                            Hi, you can try using xtistest instead then, it allows for gaps. E.g. xtistest varlist, lags(2)
                            Last edited by sladmin; 28 Jan 2019, 09:16. Reason: anonymize original poster

                            Comment


                            • #15
                              Originally posted by Jesse Wursten View Post

                              Hi, you can try using xtistest instead then, it allows for gaps. E.g. xtistest varlist, lags(2)
                              Thank you! but this doesn't work too. I'm a bit desperate now but decided to cluster my se anyway - vce (cluster). Of course I'd prefer to show if there is correlation.

                              Code:
                              Inoue and Solo (2006) LM-test as postestimation
                              Panelvar: id
                              Timevar: wave
                              p (lags): 2
                              --------------------------------------------------------------------------------------+
                                         Variable           |  IS-stat    p-value   |      N    maxT |   balance?   |
                              ------------------------------+-----------------------+----------------+--------------|
                              is_statistic_bb_unbalanced():  3499  vech_lower() not found
                                               <istmt>:     -  function returned error
                              r(3499);

                              Comment

                              Working...
                              X