Announcement

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

  • Testing for heteroskedasticity

    I am conducting a regression model in stata to determine the impact of paternity leave on several labour market outcomes.

    The regression looks like: y = dummy + linear + linear + squared

    I would like to test for heteroskedasticity but I am unsure whether a Breusch-Pagan test or a White test would be appropriate in this case. Further, I wish to run regressions without using the squared variable. In that case, would would I switch to the Breusch-Pagan test (if White test is previously appropriate)?
    Thank you.

  • #2
    Saiming:
    - try -estat hettest- post regression. In general, which one of the two tests you choose doesn't make any substantive difference.(with or without squared terms).
    Besides, visual inspection of residual distribution is recommended as well.
    As an aside, creating squared terms (as well as categorical variables and interactions is very easy with -fvvarlist-);
    - check for omitted variables bias (which is more dangerous than heteroskedasticity) as well, via -estat ovtest-.

    Eventually your chance of getting helpful replies is conditional on posting what you typed and what Stata gave you back (as reminded by FAQ #12). Thanks.

    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Thank you for the advice, Carlo.

      I ran the regression below:

      Code:
       regress Genwagegap patleave matparleave c.patleave#c.matparleave c.patleave#c.patleave c.matparleave#c.matparleave
      The result was:
      Code:
      hettest
      
      Breusch-Pagan / Cook-Weisberg test for heteroskedasticity 
               Ho: Constant variance
               Variables: fitted values of Genwagegap
      
               chi2(1)      =     5.05
               Prob > chi2  =   0.0246
      Could you please explain how the Breusch-Pagan test works in this case where there are squared variables? From my understanding, the Breusch-Pagan test works for linear relationships.

      Thank you.

      Comment


      • #4
        Saiming:
        which kind of lnearity do you mean?
        Among variables or among regression coefficients?
        In OLS the linearity refers to coefficients only.
        -estat hettest- checks for violation in the normality of residuals distribution , no matter if you plug in a squared (or higher) term in your equation, as you can see from the following toy-example, where, in both cases, the null is rejected, as evidence of heteroskedasticity:
        Code:
        . sysuse auto.dta
        (1978 Automobile Data)
        . reg price mpg
              Source |       SS           df       MS      Number of obs   =        74
        -------------+----------------------------------   F(1, 72)        =     20.26
               Model |   139449474         1   139449474   Prob > F        =    0.0000
            Residual |   495615923        72  6883554.48   R-squared       =    0.2196
        -------------+----------------------------------   Adj R-squared   =    0.2087
               Total |   635065396        73  8699525.97   Root MSE        =    2623.7
        ------------------------------------------------------------------------------
               price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
                 mpg |  -238.8943   53.07669    -4.50   0.000    -344.7008   -133.0879
               _cons |   11253.06   1170.813     9.61   0.000     8919.088    13587.03
        ------------------------------------------------------------------------------
        . estat hettest
        Breusch-Pagan / Cook-Weisberg test for heteroskedasticity
                 Ho: Constant variance
                 Variables: fitted values of price
                 chi2(1)      =     7.14
                 Prob > chi2  =   0.0075
          
        . reg price c.mpg##c.mpg
              Source |       SS           df       MS      Number of obs   =        74
        -------------+----------------------------------   F(2, 71)        =     18.28
               Model |   215835615         2   107917807   Prob > F        =    0.0000
            Residual |   419229781        71  5904644.81   R-squared       =    0.3399
        -------------+----------------------------------   Adj R-squared   =    0.3213
               Total |   635065396        73  8699525.97   Root MSE        =    2429.9
        ------------------------------------------------------------------------------
               price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
                 mpg |  -1265.194   289.5443    -4.37   0.000    -1842.529   -687.8593
                     |
         c.mpg#c.mpg |   21.36069   5.938885     3.60   0.001     9.518891    33.20249
                     |
               _cons |   22716.48   3366.577     6.75   0.000     16003.71    29429.24
        ------------------------------------------------------------------------------
        . estat hettest
        Breusch-Pagan / Cook-Weisberg test for heteroskedasticity
                 Ho: Constant variance
                 Variables: fitted values of price
                 chi2(1)      =     5.04
                 Prob > chi2  =   0.0248
        Last edited by Carlo Lazzaro; 17 Apr 2016, 08:22.
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          I had interpreted the linearity of Breusch-Pagan tests to be among variables (rather than coefficients) but from what you have said then this is not true. From my understanding, the White test allows for nonlinear relationship between the squared error and the independent variables and so I assumed that this was preferred over the BP test given my model specification.

          In that case, can I just check that Breusch-Pagan test (rather than the White test) is suitable for the specification I have chosen?

          Thank you.

          Comment


          • #6
            Saiming:
            - you may want to compare the results of both -estat hettest- and -estat imtest, White- on your data; otherwise, you can impose -vce(robust)- standard errors.
            However, I would also consider different test apart those focused on heteroskedasticity, like in the elaboration of the following toy-example:
            Code:
            . sysuse auto.dta
            (1978 Automobile Data)
            
            . reg price mpg
            
                  Source |       SS           df       MS      Number of obs   =        74
            -------------+----------------------------------   F(1, 72)        =     20.26
                   Model |   139449474         1   139449474   Prob > F        =    0.0000
                Residual |   495615923        72  6883554.48   R-squared       =    0.2196
            -------------+----------------------------------   Adj R-squared   =    0.2087
                   Total |   635065396        73  8699525.97   Root MSE        =    2623.7
            
            ------------------------------------------------------------------------------
                   price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                     mpg |  -238.8943   53.07669    -4.50   0.000    -344.7008   -133.0879
                   _cons |   11253.06   1170.813     9.61   0.000     8919.088    13587.03
            ------------------------------------------------------------------------------
            
            . estat hettest
            
            Breusch-Pagan / Cook-Weisberg test for heteroskedasticity
                     Ho: Constant variance
                     Variables: fitted values of price
            
                     chi2(1)      =     7.14
                     Prob > chi2  =   0.0075
            
            . estat imtest, white
            
            White's test for Ho: homoskedasticity
                     against Ha: unrestricted heteroskedasticity
            
                     chi2(2)      =      7.31
                     Prob > chi2  =    0.0259
            
            Cameron & Trivedi's decomposition of IM-test
            
            ---------------------------------------------------
                          Source |       chi2     df      p
            ---------------------+-----------------------------
              Heteroskedasticity |       7.31      2    0.0259
                        Skewness |       6.51      1    0.0107
                        Kurtosis |       1.10      1    0.2935
            ---------------------+-----------------------------
                           Total |      14.92      4    0.0049
            ---------------------------------------------------
            
            . reg price c.mpg##c.mpg
            
                  Source |       SS           df       MS      Number of obs   =        74
            -------------+----------------------------------   F(2, 71)        =     18.28
                   Model |   215835615         2   107917807   Prob > F        =    0.0000
                Residual |   419229781        71  5904644.81   R-squared       =    0.3399
            -------------+----------------------------------   Adj R-squared   =    0.3213
                   Total |   635065396        73  8699525.97   Root MSE        =    2429.9
            
            ------------------------------------------------------------------------------
                   price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                     mpg |  -1265.194   289.5443    -4.37   0.000    -1842.529   -687.8593
                         |
             c.mpg#c.mpg |   21.36069   5.938885     3.60   0.001     9.518891    33.20249
                         |
                   _cons |   22716.48   3366.577     6.75   0.000     16003.71    29429.24
            ------------------------------------------------------------------------------
            
            . estat hettest
            
            Breusch-Pagan / Cook-Weisberg test for heteroskedasticity
                     Ho: Constant variance
                     Variables: fitted values of price
            
                     chi2(1)      =     5.04
                     Prob > chi2  =   0.0248
            
            . estat imtest, white
            
            White's test for Ho: homoskedasticity
                     against Ha: unrestricted heteroskedasticity
            
                     chi2(4)      =      2.73
                     Prob > chi2  =    0.6038
            
            Cameron & Trivedi's decomposition of IM-test
            
            ---------------------------------------------------
                          Source |       chi2     df      p
            ---------------------+-----------------------------
              Heteroskedasticity |       2.73      4    0.6038
                        Skewness |       2.93      2    0.2316
                        Kurtosis |       1.05      1    0.3053
            ---------------------+-----------------------------
                           Total |       6.71      7    0.4599
            ---------------------------------------------------
            
            . estat vif
            
                Variable |       VIF       1/VIF 
            -------------+----------------------
                     mpg |     34.69    0.028824
             c.mpg#c.mpg |     34.69    0.028824
            -------------+----------------------
                Mean VIF |     34.69
            As you can see, when a squared term was added, heteroskedasticity is still highlighted by -estat hettest-, whereas the null is not rejected by -estat imtest,white-.
            However, the regression outcome is not reliable, due to a quite impressive mean VIF, that makes me think that the model is basically misspecified (as it is), also due to omitted variable bias:
            Code:
             Ramsey RESET test using powers of the fitted values of price
                   Ho:  model has no omitted variables
                              F(3, 68) =      3.98
                              Prob > F =      0.0113
            Kind regards,
            Carlo
            (StataNow 18.5)

            Comment


            • #7
              Hi Carlo,

              Thank you for your great explanation. I have been looking for this explanation for so long and you nail it.

              Appreciate it

              Regards,

              Annur

              Comment


              • #8
                Hi everyone hope you are all well,

                xtreg DiffMeanHourlyPercent Year2019 Year2020, fe - I am trying to test the heteroskedasticity assumption before running this fixed regression model, but I am not sure which test I should use as my independent variables are year dummies.

                Kind regards,

                Uyi Erhabor
                (Stata 16.1 SE)

                Comment

                Working...
                X