Announcement

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

  • Panel Data with heteroskedastic - How to procede?

    Hello!

    I have a unbalanced panel data with 123 cross sections and 247,904 observations . The observations are daily.

    After running a Hausman test, I found that a FE is better to used than RE. Next I tested for heteroskedasticity with the Modifiel Wald test and the result indicates that i have to reject H0. So I have heteroskedasticity.

    Modified Wald test for groupwise heteroskedasticity
    in fixed effect regression model

    H0: sigma(i)^2 = sigma^2 for all i

    chi2 (123) = 2.3e+10
    Prob>chi2 = 0.0000


    After I tested autocorrelation with the Wooldridge test. The result indicates that i can not reject H0. So I don't have autocorrelation.

    H0: no first-order autocorrelation
    F( 1, 122) = 3.294
    Prob > F = 0.0720


    So, I want to know if I can correct the heteroskedasticity with the command xtgls?
    The other question is if I use the xtgls I have to use igls too?

    In other words I have to use the command 1 or 2 above:

    1- xtgls dep indep, igls panels (heteroskedastic) force
    2- xtgls dep indep, panels (heteroskedastic) force


    Sorry my bad English.

    Thanks a lot for the help!!!

  • #2
    I read the examples (1 and 3 in the xtgls manual) and the Greene (2012). I understand that the igls is for estimations with MLE and that MLE has no advantages over FGLS in its asymptotic properties. So I think that I don't need to use the igls. I am right?

    Thanks a lot for the help!!!

    Comment


    • #3
      Jessica:
      thanks for reposting on the General Forum.
      Yes, you are right.
      Kind regards,
      Carlo
      (Stata 18.0 SE)

      Comment


      • #4
        Once again Thanks a lot!

        One thing that worry myselft, is that my Std. Err. are high (the Std. Err. are high in all estimations mentioned below) . Did I do the right steps for the etimation in panel data? The steps that I did:

        1- Estimation pooled
        2- Chow Test in the estimation FE - With this test I verified that EF is better than pooled
        3- Estimation with RE
        4- Breusch Pagan Test - With this test I verified that RE is better than pooled
        5- Hausman Test - With this test I verified that FE is better than RE
        6- Wooldrigde Test for autocorrelation in panel data - The result indicates that i can not reject H0. So I don't have autocorrelation.
        7- Modified Wald test for groupwise heteroskedasticity - The result indicates that i have to reject H0. So I have heteroskedasticity.
        8 – The last step was the estimation with xtgls with the option panels (heteroskedastic) force. Like below

        . xtgls CaptaçãoLíquida Retornomensal Retornoanual TaxaAdministração logIdadedofundo log
        > PL, panels (heteroskedastic) force

        Cross-sectional time-series FGLS regression

        Coefficients: generalized least squares
        Panels: heteroskedastic
        Correlation: no autocorrelation

        Estimated covariances = 123 Number of obs = 246,667
        Estimated autocorrelations = 0 Number of groups = 123
        Estimated coefficients = 6 Obs per group:
        min = 37
        avg = 2,005.42
        max = 3,012
        Wald chi2(5) = 535.99
        Prob > chi2 = 0.0000

        ----------------------------------------------------------------------------------------
        CaptaçãoLíquida | Coef. Std. Err. z P>|z| [95% Conf. Interval]
        -----------------------+----------------------------------------------------------------
        Retornomensal | 5772.33 2600.166 2.22 0.026 676.0996 10868.56
        Retornoanual12meses | 5733.595 680.268 8.43 0.000 4400.294 7066.896
        TaxaAdministraçãomáx~a | 70741.21 20093.77 3.52 0.000 31358.14 110124.3
        logIdadedofundoemdias | -153.7323 472.171 -0.33 0.745 -1079.171 771.7059
        logPL | -6487.57 305.3667 -21.25 0.000 -7086.078 -5889.063
        _cons | 38147.88 2082.14 18.32 0.000 34066.96 42228.8
        ----------------------------------------------------------------------------------------



        I think that is importante to talk about my data....
        My data is about 126 brasilian’s open end funds in the period of 01/02/2005 until 31/12/2017.
        With this data I want to understand the relation between net funding (application - redemption) and profitability.

        Comment


        • #5
          Jessica:
          please use CODE delimiters to post what you typed and what Stays gave you back. Thanks.
          The unit you used to express your data is not clear and may well explain your seemingly high standard errors.
          Kind regards,
          Carlo
          (Stata 18.0 SE)

          Comment


          • #6
            Ok Carlo.

            Thanks a lot!!

            Comment


            • #7
              Hello!

              I have more one doubt. In my regressions (pooled, fixed effects and random effects) the coefficient of two variables was negative. But in the estimation with xtgls with the option panels (heteroskedastic) force the coefficient of this two variables are positive. But it makes more sense the coefficient to be negative
              What could be wrong?

              Thanks

              Comment


              • #8
                Jessica:
                if you have T>N panel dataset (as it seems from your previous posts), I would stick with -xtgls-.
                As an aside, it's virtually impossible to give specific advice without seeing what you typed and what Stata gave you back .
                Kind regards,
                Carlo
                (Stata 18.0 SE)

                Comment


                • #9
                  Hello Carlo!
                  I used xtgls. May I put here the code? I think that will be large...

                  Comment


                  • #10
                    Jessica:
                    yes, please. Just use CODE delimiters.
                    Kind regards,
                    Carlo
                    (Stata 18.0 SE)

                    Comment


                    • #11
                      Dear Carlo,

                      The Code is:

                      Pooled Regress (the coefficients TaxaAdministraçãomáxima and logIdadedofundoemdias are negative)

                      Code:
                      . regress CaptaçãoLíquida Retornomensal Retornoanual TaxaAdministração logIdadedofundo logPL
                      
                            Source |       SS           df       MS      Number of obs   =   247,904
                      -------------+----------------------------------   F(5, 247898)    =     93.06
                             Model |  4.4753e+14         5  8.9506e+13   Prob > F        =    0.0000
                          Residual |  2.3842e+17   247,898  9.6178e+11   R-squared       =    0.0019
                      -------------+----------------------------------   Adj R-squared   =    0.0019
                             Total |  2.3887e+17   247,903  9.6357e+11   Root MSE        =    9.8e+05
                      
                      -----------------------------------------------------------------------------------------
                              CaptaçãoLíquida |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      ------------------------+----------------------------------------------------------------
                                Retornomensal |   71276.54   27456.69     2.60   0.009     17462.16    125090.9
                          Retornoanual12meses |   126826.7   6974.834    18.18   0.000     113156.2    140497.2
                      TaxaAdministraçãomáxima |   -24815.9   164152.9    -0.15   0.880    -346551.3    296919.5
                        logIdadedofundoemdias |  -37818.45   5405.091    -7.00   0.000    -48412.28   -27224.61
                                        logPL |  -10270.21   2905.327    -3.53   0.000    -15964.57   -4575.841
                                        _cons |   183613.6    24376.3     7.53   0.000     135836.7    231390.5
                      -----------------------------------------------------------------------------------------

                      Chow Test and Fixed Effects (the coefficients TaxaAdministraçãomáxima and logIdadedofundoemdias are negative)

                      Code:
                      . xtreg CaptaçãoLíquida Retornomensal Retornoanual TaxaAdministração logIdadedofundo logPL, fe
                      
                      Fixed-effects (within) regression               Number of obs     =    247,904
                      Group variable: ID                              Number of groups  =        123
                      
                      R-sq:                                           Obs per group:
                           within  = 0.0019                                         min =         37
                           between = 0.0396                                         avg =    2,015.5
                           overall = 0.0014                                         max =      3,012
                      
                                                                      F(5,247776)       =      95.93
                      corr(u_i, Xb)  = -0.5359                        Prob > F          =     0.0000
                      
                      -----------------------------------------------------------------------------------------
                              CaptaçãoLíquida |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      ------------------------+----------------------------------------------------------------
                                Retornomensal |    76228.4   27468.03     2.78   0.006     22391.79      130065
                          Retornoanual12meses |   118814.1   7246.879    16.40   0.000     104610.4    133017.7
                      TaxaAdministraçãomáxima |   -1093949   442198.4    -2.47   0.013     -1960646   -227251.4
                        logIdadedofundoemdias |  -111621.2   11936.55    -9.35   0.000    -135016.5   -88225.89
                                        logPL |  -13624.51       7005    -1.94   0.052    -27354.12    105.1099
                                        _cons |   488539.9   75837.43     6.44   0.000     339900.6    637179.3
                      ------------------------+----------------------------------------------------------------
                                      sigma_u |  54069.087
                                      sigma_e |  980261.69
                                          rho |  .00303316   (fraction of variance due to u_i)
                      -----------------------------------------------------------------------------------------
                      F test that all u_i=0: F(122, 247776) = 2.84                 Prob > F = 0.0000

                      Random Effects (the coefficients TaxaAdministraçãomáxima and logIdadedofundoemdias are negative)

                      Code:
                      . xtreg CaptaçãoLíquida Retornomensal Retornoanual TaxaAdministração logIdadedofundo logPL,re
                      
                      Random-effects GLS regression                   Number of obs     =    247,904
                      Group variable: ID                              Number of groups  =        123
                      
                      R-sq:                                           Obs per group:
                           within  = 0.0018                                         min =         37
                           between = 0.0874                                         avg =    2,015.5
                           overall = 0.0019                                         max =      3,012
                      
                                                                      Wald chi2(5)      =     465.31
                      corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
                      
                      -----------------------------------------------------------------------------------------
                              CaptaçãoLíquida |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                      ------------------------+----------------------------------------------------------------
                                Retornomensal |   71276.54   27456.69     2.60   0.009     17462.42    125090.7
                          Retornoanual12meses |   126826.7   6974.834    18.18   0.000     113156.3    140497.2
                      TaxaAdministraçãomáxima |   -24815.9   164152.9    -0.15   0.880    -346549.7    296917.9
                        logIdadedofundoemdias |  -37818.45   5405.091    -7.00   0.000    -48412.23   -27224.66
                                        logPL |  -10270.21   2905.327    -3.53   0.000    -15964.54   -4575.869
                                        _cons |   183613.6    24376.3     7.53   0.000       135837    231390.3
                      ------------------------+----------------------------------------------------------------
                                      sigma_u |          0
                                      sigma_e |  980261.69
                                          rho |          0   (fraction of variance due to u_i)
                      -----------------------------------------------------------------------------------------

                      Hausman Test (Fixed Effects better than Random Effects)

                      Code:
                          Test:  Ho:  difference in coefficients not systematic
                      
                                        chi2(5) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                                                =       75.72
                                      Prob>chi2 =      0.0000

                      Wooldridge Test for autocorrelation (Don't reject the null hypothesis, so I don't have autocorrelation)

                      Code:
                      Wooldridge test for autocorrelation in panel data
                      H0: no first-order autocorrelation
                          F(  1,     122) =      3.294
                                 Prob > F =      0.0720

                      Modified Wald test for groupwise heteroskedasticity (There is heteroskedasticity)

                      Code:
                      H0: sigma(i)^2 = sigma^2 for all i
                      
                      chi2 (123)  =   1.6e+10
                      Prob>chi2 =      0.0000

                      And then xtgls with the correction for heteroskedasticity (the coefficients TaxaAdministraçãomáxima and logIdadedofundoemdias become positive - It's the question, why? The coefficients was negative in the others estimations)


                      Code:
                      . xtgls CaptaçãoLíquida Retornomensal Retornoanual TaxaAdministração logIdadedofundo logPL, panels (heteroskedastic) force
                      
                      Cross-sectional time-series FGLS regression
                      
                      Coefficients:  generalized least squares
                      Panels:        heteroskedastic
                      Correlation:   no autocorrelation
                      
                      Estimated covariances      =       123          Number of obs     =    247,904
                      Estimated autocorrelations =         0          Number of groups  =        123
                      Estimated coefficients     =         6          Obs per group:
                                                                                    min =         37
                                                                                    avg =   2,015.48
                                                                                    max =      3,012
                                                                      Wald chi2(5)      =     587.51
                                                                      Prob > chi2       =     0.0000
                      
                      -----------------------------------------------------------------------------------------
                              CaptaçãoLíquida |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                      ------------------------+----------------------------------------------------------------
                                Retornomensal |   5823.643   2616.724     2.23   0.026     694.9589    10952.33
                          Retornoanual12meses |   5473.559   682.1071     8.02   0.000     4136.654    6810.465
                      TaxaAdministraçãomáxima |   70031.95   14105.97     4.96   0.000     42384.75    97679.15
                        logIdadedofundoemdias |   1065.651   435.9954     2.44   0.015     211.1153    1920.186
                                        logPL |  -7155.085   310.4778   -23.05   0.000     -7763.61    -6546.56
                                        _cons |   38363.57   2050.466    18.71   0.000     34344.73    42382.41
                      -----------------------------------------------------------------------------------------

                      Thanks so much for the help!!
                      Last edited by Jessica Sardinha; 19 Sep 2018, 18:47.

                      Comment


                      • #12
                        Jessica:
                        thanks for providing your resulst via CODE delimiters.
                        It's actually strange that you do not have autocorrrelation in a T>N panel dataset.
                        Anyway, as per your panel data structure, I would trust -xtgls- resulst.
                        Kind regards,
                        Carlo
                        (Stata 18.0 SE)

                        Comment


                        • #13
                          Thank you so much!!

                          Comment


                          • #14
                            Hello again!!

                            I have other doubt...
                            If my Chow Test indicates pooled and my Breusch Pagan Test indicates pooled too, and my T>N. Can I use xtgls? I think yes... But Can I use the command "xtserial dep var indep var, output" for test the autocorrelation? And How can I test the heteroskedasticity? Can I use command "hettest" - Breusch-Pagan / Cook-Weisberg test for heteroskedasticity?

                            For example: Chow Test indicates pooled

                            Code:
                            . xtreg CaptaçãoLíquida Retornomensal Retornoanual logPL, fe
                            
                            Fixed-effects (within) regression               Number of obs     =    132,501
                            Group variable: ID                              Number of groups  =         79
                            
                            R-sq:                                           Obs per group:
                                 within  = 0.0004                                         min =         37
                                 between = 0.0126                                         avg =    1,677.2
                                 overall = 0.0001                                         max =      3,012
                            
                                                                            F(3,132419)       =      15.65
                            corr(u_i, Xb)  = -0.6965                        Prob > F          =     0.0000
                            
                            -------------------------------------------------------------------------------------
                                CaptaçãoLíquida |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                            --------------------+----------------------------------------------------------------
                                  Retornomensal |  -.0000837   .0001607    -0.52   0.602    -.0003986    .0002312
                            Retornoanual12meses |   .0002127   .0000424     5.02   0.000     .0001297    .0002957
                                          logPL |  -.0002023   .0000368    -5.50   0.000    -.0002745   -.0001302
                                          _cons |   .0014363   .0002631     5.46   0.000     .0009206     .001952
                            --------------------+----------------------------------------------------------------
                                        sigma_u |  .00016144
                                        sigma_e |  .00434129
                                            rho |   .0013809   (fraction of variance due to u_i)
                            -------------------------------------------------------------------------------------
                            F test that all u_i=0: F(78, 132419) = 1.10                  Prob > F = 0.2568
                            Breusch Pagan indicates pooled too:
                            Code:
                            . xttest0
                            
                            Breusch and Pagan Lagrangian multiplier test for random effects
                            
                                    CaptaçãoLíquida[ID,t] = Xb + u[ID] + e[ID,t]
                            
                                    Estimated results:
                                                     |       Var     sd = sqrt(Var)
                                            ---------+-----------------------------
                                           Captaç~da |   .0000189       .0043417
                                                   e |   .0000188       .0043413
                                                   u |          0              0
                            
                                    Test:   Var(u) = 0
                                                         chibar2(01) =     0.00
                                                      Prob > chibar2 =   1.0000
                            This autocorrelation test is right?

                            Code:
                             quietly regress CaptaçãoLíquida Retornomensal Retornoanual logPL
                            
                            . xtserial CaptaçãoLíquida Retornomensal Retornoanual logPL,output
                            
                            Linear regression                               Number of obs     =    102,655
                                                                            F(3, 78)          =       0.80
                                                                            Prob > F          =     0.4951
                                                                            R-squared         =     0.2403
                                                                            Root MSE          =     .00435
                            
                                                                       (Std. Err. adjusted for 79 clusters in ID)
                            -------------------------------------------------------------------------------------
                                                |               Robust
                              D.CaptaçãoLíquida |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                            --------------------+----------------------------------------------------------------
                                  Retornomensal |
                                            D1. |   -.000602    .000745    -0.81   0.422    -.0020853    .0008813
                                                |
                            Retornoanual12meses |
                                            D1. |   .0000427   .0002607     0.16   0.870    -.0004764    .0005617
                                                |
                                          logPL |
                                            D1. |  -.1724137   .1130696    -1.52   0.131    -.3975179    .0526905
                            -------------------------------------------------------------------------------------
                            
                            Wooldridge test for autocorrelation in panel data
                            H0: no first-order autocorrelation
                                F(  1,      78) =    786.251
                                       Prob > F =      0.0000
                            can I use the test below for heteroskedasticity ?

                            Code:
                            . quietly regress CaptaçãoLíquida Retornomensal Retornoanual logPL
                            
                            . hettest
                            
                            Breusch-Pagan / Cook-Weisberg test for heteroskedasticity 
                                     Ho: Constant variance
                                     Variables: fitted values of CaptaçãoLíquida
                            
                                     chi2(1)      =111673.15
                                     Prob > chi2  =   0.0000
                            The last, May I estimate with xtgls like below?

                            Code:
                            . xtgls CaptaçãoLíquida Retornomensal Retornoanual logPL, panels (heteroskedastic) corr(
                            > ar1) force
                            
                            Cross-sectional time-series FGLS regression
                            
                            Coefficients:  generalized least squares
                            Panels:        heteroskedastic
                            Correlation:   common AR(1) coefficient for all panels  (0.1107)
                            
                            Estimated covariances      =        79          Number of obs     =    132,501
                            Estimated autocorrelations =         1          Number of groups  =         79
                            Estimated coefficients     =         4          Obs per group:
                                                                                          min =         37
                                                                                          avg =   1,677.23
                                                                                          max =      3,012
                                                                            Wald chi2(3)      =     145.25
                                                                            Prob > chi2       =     0.0000
                            
                            -------------------------------------------------------------------------------------
                                CaptaçãoLíquida |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                            --------------------+----------------------------------------------------------------
                                  Retornomensal |   5.95e-06   7.63e-06     0.78   0.436    -9.01e-06    .0000209
                            Retornoanual12meses |   .0000247   2.29e-06    10.80   0.000     .0000202    .0000292
                                          logPL |  -7.68e-08   8.55e-07    -0.09   0.928    -1.75e-06    1.60e-06
                                          _cons |  -8.04e-06   5.97e-06    -1.35   0.178    -.0000197    3.65e-06
                            -------------------------------------------------------------------------------------
                            Once again so many thanks!!

                            Comment


                            • #15
                              Jessica:
                              since you have a T>N panel dataset, -xtreg- is not the way to go, wheras -xtgls- is what you need.
                              See also: https://www.stata.com/support/faqs/s...tocorrelation/
                              Kind regards,
                              Carlo
                              (Stata 18.0 SE)

                              Comment

                              Working...
                              X