Announcement

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

  • hettest : Different results from regression

    Hi, I have a model with 3 nominal independent variables. Three dummy variables are used for the first nominal variable. Two dummy varaibles are used for the second nominal variable. And two dummy variables are used for the third dummy variables. I test for heteroskedasticiy by 2 methods.
    (1) Use stata command : hettest. The chi(1) = 6.21 and its p-value = 0.0127.
    (2) Use the regular regression: Run resdidual^2 on all dummy variables. The F-statistics = 1.492 and its p-value = 0.2106.
    The two methods give different conclusion about heteroskedasticity.
    Can somebody explain this different results?
    Thank You.

  • #2
    Showing commands and output would give people a better chance at answering your question. Use code tags. See pt 12 of the Statalist FAQ on asking Qs effectively.

    Your procedure does not sound right to me. See

    https://www3.nd.edu/~rwilliam/stats2/l25.pdf

    Specifically, pp. 9-10 show how to manually reproduce the results of hettest,
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Dear Williams,
      Thank you for your help. Here is the commands:
      Method 1:reg pref i.time i.capnew i.price, beta
      estat hettest

      Source | SS df MS Number of obs = 36
      -------------+---------------------------------- F(7, 28) = 90.72
      Model | 3757.22222 7 536.746032 Prob > F = 0.0000
      Residual | 165.666667 28 5.91666667 R-squared = 0.9578
      -------------+---------------------------------- Adj R-squared = 0.9472
      Total | 3922.88889 35 112.08254 Root MSE = 2.4324

      ------------------------------------------------------------------------------
      pref | Coef. Std. Err. t P>|t| Beta
      -------------+----------------------------------------------------------------
      time |
      4 Mins | -1.333333 1.146654 -1.16 0.255 -.055308
      6 Mins | -6.777778 1.146654 -5.91 0.000 -.2811488
      8 Mins | -14.11111 1.146654 -12.31 0.000 -.5853425
      |
      capnew |
      8 cups | 11.75 .9930313 11.83 0.000 .5306154
      10 cups | 19.08333 .9930313 19.22 0.000 .8617796
      |
      price |
      32000 | -2.083333 .9930313 -2.10 0.045 -.0940807
      38000 | -8.083333 .9930313 -8.14 0.000 -.3650333
      |
      _cons | 17.11111 1.146654 14.92 0.000 .
      ------------------------------------------------------------------------------

      Breusch-Pagan / Cook-Weisberg test for heteroskedasticity
      Ho: Constant variance
      Variables: fitted values of pref

      chi2(1) = 6.21
      Prob > chi2 = 0.0127

      Method 2: predict e, residual
      gen e2 = e*e
      reg e2 ib4.time ib3.capnew ib38000.price

      . reg e2 ib4.time ib3.capnew ib38000.price

      Source | SS df MS Number of obs = 36
      -------------+---------------------------------- F(7, 28) = 1.49
      Model | 715.4564 7 102.208057 Prob > F = 0.2106
      Residual | 1917.89019 28 68.4960781 R-squared = 0.2717
      -------------+---------------------------------- Adj R-squared = 0.0896
      Total | 2633.34659 35 75.2384739 Root MSE = 8.2762

      ------------------------------------------------------------------------------
      e2 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      time |
      2 Mins | -4.549383 3.901455 -1.17 0.253 -12.54115 3.442385
      4 Mins | -4.808642 3.901455 -1.23 0.228 -12.80041 3.183126
      6 Mins | -1.76e-07 3.901455 -0.00 1.000 -7.991768 7.991768
      |
      capnew |
      4 cups | 1.280093 3.378759 0.38 0.708 -5.640981 8.201167
      8 cups | 1.12963 3.378759 0.33 0.741 -5.791444 8.050704
      |
      price |
      28000 | -7.881945 3.378759 -2.33 0.027 -14.80302 -.9608705
      32000 | -8.027778 3.378759 -2.38 0.025 -14.94885 -1.106704
      |
      _cons | 11.44136 3.901455 2.93 0.007 3.44959 19.43313
      ------------------------------------------------------------------------------

      Thank You

      Comment


      • #4
        Hi Poomthan. Your posting is very hard to read. You should use code tags. See the faq.

        Your two approaches are not equivalent. Perhaps both are legitimate tests, but they are not the same test.
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        StataNow Version: 19.5 MP (2 processor)

        EMAIL: [email protected]
        WWW: https://www3.nd.edu/~rwilliam

        Comment


        • #5
          If you want hettest and your regression approach to yield the same results, I believe you need the rhs and fstat options on hettest:

          Code:
          webuse nhanes2f, clear
          reg health i.race i.female i.diabetes
          predict e if e(sample), resid
          gen esquare = e^2
          estat hettest, rhs fstat
          reg esquare i.race i.female i.diabetes
          Code:
          . estat hettest, rhs fstat
          
          Breusch-Pagan / Cook-Weisberg test for heteroskedasticity 
                   Ho: Constant variance
                   Variables: 1b.race 2.race 3.race 0b.female 1.female 0b.diabetes 1.diabetes
          
                   F(4 , 10330) =     8.72
                   Prob > F     =   0.0000
          
          . reg esquare i.race i.female i.diabetes
          
                Source |       SS           df       MS      Number of obs   =    10,335
          -------------+----------------------------------   F(4, 10330)     =      8.72
                 Model |  82.2864077         4  20.5716019   Prob > F        =    0.0000
              Residual |  24360.9941    10,330  2.35827629   R-squared       =    0.0034
          -------------+----------------------------------   Adj R-squared   =    0.0030
                 Total |  24443.2805    10,334  2.36532616   Root MSE        =    1.5357
          Also notice how much easier it is to read when you use code tags.
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          StataNow Version: 19.5 MP (2 processor)

          EMAIL: [email protected]
          WWW: https://www3.nd.edu/~rwilliam

          Comment


          • #6
            If you do not list the regressors in the auxiliary regression, Stata defaults to the fitted value of the original regression as regressor. This is why your Chi squared has only one degree of freedom.

            Comment

            Working...
            X