Announcement

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

  • Cannot run Durbin Watson or Breusch-Godfrey tests

    Hi,

    I am trying to run serial correlation (DW and Breusch-Godfrey) tests for my panel data set.
    I type in the follwing commands:

    HTML Code:
    reg ROA Kortfrist_sku Långfrist_sku Tot_sku ln_storlek Ålder Likviditet Ränta
    bgodfrey
    
    tsset id År
    dwstat
    
    reg ROA Kortfrist_sku Långfrist_sku Tot_sku ln_storlek Ålder Likviditet Ränta
    estat dwatson
    But for all I get the error message "sample may not include multiple panels". How do I solve this?


  • #2
    You have panel data, so look at

    Code:
    search xtserial
    SJ-3-2 st0039 . . Testing for serial correlation in linear panel-data models
    (help xtserial if installed) . . . . . . . . . . . . . D. M. Drukker
    Q2/03 SJ 3(2):168--177
    test for serial correlation in random- or fixed-effects
    one-way models that can be applied under general conditions
    But as I remarked in your earlier thread (https://www.statalist.org/forums/for...tandard-errors), with a wide panel, you just want to cluster on the panel variable and forget about testing for serial correlation.

    Comment


    • #3
      Thank you for your response. I have a wide panel where N>T, where the panel data are for companies so I should write vce( cluster company) then? As per the other thread, I will be using robust standard errors, so how do I go about combining the robust and the clustering?
      This is my code right now (with the robust but without the clustering):

      HTML Code:
      qui reg ROA Kortfrist_sku Ålder Likviditet ln_storlek Ränta, vce(robust)
      qui outreg using Regression1.doc, nocons addrow(FE,Nej) se bdec (3) starlevels(10 5 1) sigsymbols(*,**,***) starloc(1) summstat(r2 \ N) summtitle(R2 \ Observationer) summdec(2 2 0) title(Tabell X. Regression \ Beroende variabel: ROA) ctitle("", "" \ "Förklaringsvariabler" \ "" "(1)") blankrows nolegend varlabels replace
      Kind regards,
      Sophie Starck

      Comment


      • #4
        For panel data estimators in Stata, \(\text{cluster(panelvar)}\equiv \text{vce(robust)}\), where panelvar is the panel identifier. Try it out yourself as below.

        Code:
        webuse nlswork, clear
        xtset idcode year
        xtreg ln_wage tenure hours, fe cluster(idcode)
        xtreg ln_wage tenure hours, fe vce(robust)
        Res.:

        Code:
        . xtreg ln_wage tenure hours, fe cluster(idcode)
        
        Fixed-effects (within) regression               Number of obs     =     28,036
        Group variable: idcode                          Number of groups  =      4,698
        
        R-squared:                                      Obs per group:
             Within  = 0.0975                                         min =          1
             Between = 0.1952                                         avg =        6.0
             Overall = 0.1364                                         max =         15
        
                                                        F(2,4697)         =     613.32
        corr(u_i, Xb) = 0.1376                          Prob > F          =     0.0000
        
                                     (Std. err. adjusted for 4,698 clusters in idcode)
        ------------------------------------------------------------------------------
                     |               Robust
             ln_wage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
              tenure |   .0342778    .000979    35.01   0.000     .0323584    .0361972
               hours |  -.0003775   .0004802    -0.79   0.432    -.0013189    .0005639
               _cons |   1.584114   .0176755    89.62   0.000     1.549462    1.618766
        -------------+----------------------------------------------------------------
             sigma_u |  .39087412
             sigma_e |  .30365406
                 rho |  .62363197   (fraction of variance due to u_i)
        ------------------------------------------------------------------------------
        
        . xtreg ln_wage tenure hours, fe vce(robust)
        
        Fixed-effects (within) regression               Number of obs     =     28,036
        Group variable: idcode                          Number of groups  =      4,698
        
        R-squared:                                      Obs per group:
             Within  = 0.0975                                         min =          1
             Between = 0.1952                                         avg =        6.0
             Overall = 0.1364                                         max =         15
        
                                                        F(2,4697)         =     613.32
        corr(u_i, Xb) = 0.1376                          Prob > F          =     0.0000
        
                                     (Std. err. adjusted for 4,698 clusters in idcode)
        ------------------------------------------------------------------------------
                     |               Robust
             ln_wage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
              tenure |   .0342778    .000979    35.01   0.000     .0323584    .0361972
               hours |  -.0003775   .0004802    -0.79   0.432    -.0013189    .0005639
               _cons |   1.584114   .0176755    89.62   0.000     1.549462    1.618766
        -------------+----------------------------------------------------------------
             sigma_u |  .39087412
             sigma_e |  .30365406
                 rho |  .62363197   (fraction of variance due to u_i)
        ------------------------------------------------------------------------------
        
        .
        This is discussed in

        Code:
        help xtreg
        Last edited by Andrew Musau; 18 Oct 2023, 15:23.

        Comment


        • #5
          Hi. I've tried running the regressions using both vce(robust) and cluster(id). Although the coefficients are the same, the standard errors are different, meaning the significance is lost when using cluster(id). If they are equivalent to each other, what am I doing wrong?

          This is what I am typing:

          HTML Code:
          qui reg ROA Kortfrist_sku Ålder Likviditet ln_storlek Ränta, vce(robust)
          qui outreg using Regression1.doc, nocons addrow(FE,Nej) se bdec (3) starlevels(10 5 1) sigsymbols(*,**,***) starloc(1) summstat(r2 \ N) summtitle(R2 \ Observationer) summdec(2 2 0) title(Tabell X. Regression \ Beroende variabel: ROA) ctitle("", "" \ "Förklaringsvariabler" \ "" "(1)") blankrows nolegend varlabels replace 
          HTML Code:
          qui reg ROA Kortfrist_sku Ålder Likviditet ln_storlek Ränta, cluster(id)
          qui outreg using Clustertest.doc, nocons addrow(FE,Nej) se bdec (3) starlevels(10 5 1) sigsymbols(*,**,***) starloc(1) summstat(r2 \ N) summtitle(R2 \ Observationer) summdec(2 2 0) title(Tabell X. Regression \ Beroende variabel: ROA) ctitle("", "" \ "Förklaringsvariabler" \ "" "(1)") blankrows nolegend varlabels replace 
          Which one should I go with?

          Kind regards,
          Sophie Starck

          Comment


          • #6
            regress is not a panel data estimator in Stata speak. Panel data estimators are those prefixed -xt-, e.g, xtreg, xtpoisson, and xtlogit. If you use regress with panel data, -vce(robust)- is not valid as this calculates White standard errors. You must use -cluster(panelvar)- and include the fixed effects as indicators. Relevant reading is Stock, J. H., and M. W. Watson. 2008. Heteroskedasticity-robust standard errors for fixed effects panel data regression. Econometrica 76: 155–174. https://doi.org/10.1111/j.0012-9682.2008.00821.x

            Code:
            xtset id year
            xtreg ROA Kortfrist_sku Ålder Likviditet ln_storlek Ränta, fe cluster(id)
            or even adding time-effects:

            Code:
            xtset id year
            xtreg ROA Kortfrist_sku Ålder Likviditet ln_storlek Ränta i.year, fe cluster(id)
            Last edited by Andrew Musau; 19 Oct 2023, 07:03.

            Comment


            • #7
              Okay I will read that. At first I did try xtreg but then the R2 would not show, which is why i went with reg instead. Do you know why the R2 did not show?

              Comment


              • #8
                xtreg, fe reports 3 different R2 statistics: see the output in #4. The manual explains the calculations of these R2 statistics. If you want the OLS R2 statistic, run regress or areg with clustering.

                Code:
                regress ROA Kortfrist_sku Ålder Likviditet ln_storlek Ränta, absorb(id) cluster(id)
                or with time-effects:

                Code:
                regress ROA Kortfrist_sku Ålder Likviditet ln_storlek Ränta i.year, absorb(id) cluster(id)

                Comment


                • #9
                  Thank you for your help.
                  I am only planning on including fixed effects in the last regression (I understand how to run this one correctly now), but for the previous ones I am planning on using robust standard errors using vce(robust). If I understand you correctly, you mean that this will lead to the use of White standard errors which is not correct? From what I could tell by the article, I interpret it as it is only combined with fixed effects that I should not use vce(robust) and cluster instead? So do I always have to use fixed effects and cluster when working with panel data then?

                  Comment


                  • #10
                    Pooled OLS (POLS) and Random Effects (RE) in general are not recommendable techniques as they do not control for the individual heterogeneity. So the first priority is to get consistent estimates of the parameters before you go ahead and consider other issues. If you use regress, \(\text{vce(robust)= White standard errors}\), as I stated previously. These are not valid for panel data. You will want to cluster even if you estimate POLS or RE.

                    Comment


                    • #11
                      Thank you for your response. I just want to double check with you. When I write:

                      HTML Code:
                      qui xtreg ROA Kortfrist_sku Ålder Likviditet ln_storlek Ränta, fe cluster(id)
                      qui outreg using RegressionNY.doc, nocons addrow(FE,Ja) se bdec (3) starlevels(10 5 1) sigsymbols(*,**,***) starloc(1) summstat(r2 \ r2_a \ N) summtitle(R2 \ Justerat R2 \ N) summdec(2 2 0) title(Tabell X. Regression \ Beroende variabel: ROA) ctitle("", "" \ "Förklaringsvariabler" \ "" "(1)") blankrows nolegend varlabels replace
                      Does it use POLS together with FE and clustering or is it just FE and clustering?

                      Comment


                      • #12
                        Pooled OLS is just OLS on panel data:

                        Code:
                        regress ROA Kortfrist_sku Ålder Likviditet ln_storlek Ränta, cluster(id)

                        What you have below is the fixed effects model estimated using the within-estimator (or the fixed effects estimator).

                        xtreg ROA Kortfrist_sku Ålder Likviditet ln_storlek Ränta, fe cluster(id)

                        Comment


                        • #13
                          Ok I got it now. Thank you!

                          Comment

                          Working...
                          X