Announcement

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

  • Hausman Test for testing differences between two estimation methods.

    In my thesis study I am trying to estimate 11 different ARDL models. However when I checked correlations between residulas I saw some statistically significant correlations. Consequently I did SUR estimation for 11 models. Now I want to see if SUR estimation coefficients and OLS estimation coefficients are significiantly diffferent or not. I am able to store OLS estimates as objects. But I couldn't figure how can I subset individual models in SUR system. I just try to express my need using python description. Thank you very much.

    estimates store SUR['individual_model']

  • #2
    Omer:
    this old Stata thread (and Eric de Souza 's interesting explanation) may be helpful https://www.stata.com/statalist/arch.../msg01198.html.
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Infact my individual reg models are ARDL models and all of them ara in different orders. That's why my 11 models both have different dependent variables and independent variables. My problem is to compare results of SUR system with individual OLS estimates.

      Comment


      • #4
        Omer:
        as a second thought, if residuals are correlated, wouldn't it be unuseful to carry out 11 separate OLS?
        Can't you simply focus on -sureg- sample estimate of your coefficients?
        Kind regards,
        Carlo
        (Stata 18.0 SE)

        Comment


        • #5
          I need to some post estimation commands related with ARDL function. If I chose to use SUR model I am not able to use these commands. So I want to be sure that there is statistically signficiant difference between SUR and OLS estimations.

          Comment


          • #6
            You do not show your commands, so it is difficult to know what you mean by a SUR model as these can be estimated in a number of ways. See FAQ Advice #12 on how to post effectively. Here, I assume that the command you refer to is sureg. I do not endorse the soundness of the following procedure as the fact that suest does not support sureg may signal that you should not do this, but you can use matrix extraction -see help matrix extraction- and erepost (from SSC, by Ben Jann) to replace estimates from glm and store these. Due to my schedule, I won't be available for follow-ups if your case differs from my description. However, providing more information may induce better replies from other members.


            Code:
            sysuse auto
            sureg (price foreign weight length) (mpg foreign weight) (displ foreign weight)
            mat l e(b)
            mat l e(V)
            mat b= e(b)[1, 1..4]
            mat V= e(V)[1..4, 1..4]
            glm price foreign weight length
            *ssc install erepost
            erepost b=b
            erepost V=V
            est sto m2
            regress price foreign weight length
            est sto m1
            suest m1 m2
            Res.:

            Code:
            . regress price foreign weight length
            
                  Source |       SS           df       MS      Number of obs   =        74
            -------------+----------------------------------   F(3, 70)        =     28.39
                   Model |   348565467         3   116188489   Prob > F        =    0.0000
                Residual |   286499930        70  4092856.14   R-squared       =    0.5489
            -------------+----------------------------------   Adj R-squared   =    0.5295
                   Total |   635065396        73  8699525.97   Root MSE        =    2023.1
            
            ------------------------------------------------------------------------------
                   price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                 foreign |   3573.092    639.328     5.59   0.000     2297.992    4848.191
                  weight |   5.774712   .9594168     6.02   0.000     3.861215    7.688208
                  length |  -91.37083   32.82833    -2.78   0.007    -156.8449   -25.89679
                   _cons |   4838.021    3742.01     1.29   0.200    -2625.183    12301.22
            ------------------------------------------------------------------------------
            
            . sureg (price foreign weight length) (mpg foreign weight) (displ foreign weight)
            
            Seemingly unrelated regression
            --------------------------------------------------------------------------
            Equation             Obs   Parms        RMSE    "R-sq"       chi2        P
            --------------------------------------------------------------------------
            price                 74       3    1967.769    0.5488      89.74   0.0000
            mpg                   74       2    3.337283    0.6627     145.39   0.0000
            displacement          74       2    39.60002    0.8115     318.62   0.0000
            --------------------------------------------------------------------------
            
            ------------------------------------------------------------------------------
                         |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
            price        |
                 foreign |    3575.26   621.7961     5.75   0.000     2356.562    4793.958
                  weight |   5.691462   .9205043     6.18   0.000     3.887307    7.495618
                  length |  -88.27114    31.4167    -2.81   0.005    -149.8467   -26.69554
                   _cons |   4506.212   3588.044     1.26   0.209    -2526.225    11538.65
            -------------+----------------------------------------------------------------
            mpg          |
                 foreign |  -1.650029   1.053958    -1.57   0.117    -3.715748    .4156902
                  weight |  -.0065879   .0006241   -10.56   0.000     -.007811   -.0053647
                   _cons |    41.6797   2.121197    19.65   0.000     37.52223    45.83717
            -------------+----------------------------------------------------------------
            displacement |
                 foreign |   -25.6127   12.50621    -2.05   0.041    -50.12441   -1.100984
                  weight |   .0967549   .0074051    13.07   0.000     .0822411    .1112686
                   _cons |  -87.23548   25.17001    -3.47   0.001    -136.5678   -37.90317
            ------------------------------------------------------------------------------
            
            . suest m1 m2
            
            Simultaneous results for m1, m2
            
                                                            Number of obs     =         74
            
            ------------------------------------------------------------------------------
                         |               Robust
                         |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
            m1_mean      |
                 foreign |   3573.092    634.121     5.63   0.000     2330.238    4815.946
                  weight |   5.774712   1.470473     3.93   0.000     2.892638    8.656785
                  length |  -91.37083   47.17706    -1.94   0.053    -183.8362    1.094517
                   _cons |   4838.021   4938.492     0.98   0.327    -4841.245    14517.29
            -------------+----------------------------------------------------------------
            m1_lnvar     |
                   _cons |   15.22475   .1683404    90.44   0.000     14.89481    15.55469
            -------------+----------------------------------------------------------------
            m2_price     |
                 foreign |    3575.26   599.0244     5.97   0.000     2401.194    4749.326
                  weight |   5.691462   1.350013     4.22   0.000     3.045485    8.337439
                  length |  -88.27114     42.911    -2.06   0.040    -172.3752   -4.167123
                   _cons |   4506.212   4485.763     1.00   0.315    -4285.722    13298.15
            ------------------------------------------------------------------------------

            Comment


            • #7
              Thank you very much for your comments. In fact I have about 100 different variables per model, so it would cause significant clutter if I provide the actual code. But I could describe my problem with a more simple code.

              first, I estimated an OLS model and stored it as M1

              reg (y1 x2 x3)

              estimates store M1

              Then I estimated the second model.

              reg( y2 x2 x4 x1 x3)

              estimates store M2

              finally solved both equations with sureg

              sureg (y1 x2 x3) (y2 x2 x4 x1 x3)

              estimates store SUR

              Now, I need to apply a Hausman test to check that the estimated coefficients of the first equation are statistically different from those estimated in the SUR system. But I don't know how can I refer to first equation parameters of SUR while comparing them with M1's coefficients.

              Thanks

              Comment


              • #8
                You have to use matrix extraction as I show in #6. You cannot only store a subset of the sureg estimates (unless the subset are the entire estimates).


                Code:
                sysuse auto
                sureg (price foreign weight length) (mpg foreign weight) (displ foreign weight)
                mat b= e(b)[1, 1..4]
                mat V= e(V)[1..4, 1..4]
                glm price foreign weight length
                erepost b=b
                erepost V=V
                est sto m2
                regress price foreign weight length
                est sto m1
                hausman m1 m2, equations(1:1)
                Res.:

                Code:
                . hausman m1 m2, equations(1:1)
                
                                 ---- Coefficients ----
                             |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
                             |       m1           m2         Difference          S.E.
                -------------+----------------------------------------------------------------
                     foreign |    3573.092      3575.26       -2.168081        148.6941
                      weight |    5.774712     5.691462        .0832494        .2704671
                      length |   -91.37083    -88.27114       -3.099691        9.523141
                ------------------------------------------------------------------------------
                                         b = consistent under Ho and Ha; obtained from regress
                              B = inconsistent under Ha, efficient under Ho; obtained from glm
                
                    Test:  Ho:  difference in coefficients not systematic
                
                                  chi2(3) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                                          =        0.11
                                Prob>chi2 =      0.9911
                Last edited by Andrew Musau; 17 Oct 2021, 14:42.

                Comment


                • #9
                  Thank you very much for the answer, I think I am on the right path.

                  But I have 11 different models have different number of parameters for all of them. There are 217 distinct parameters incl. constant and trend in my SUR model. Now I need to test if SUR models parameters are statistically identical to the parameters estimated for first model, I have 106 variables in model 1. But while creating Var-Cov matrices I am receiving
                  conformability error
                  which is related with invalid rank scheme for matrix operations. I am not sure I am creating the b and V matrixes correctly?

                  sureg M1 M2 M3 M4 ..... M11
                  mat b = e(b)[1,1..217]
                  mat V = e(V)[1..217,1..217]
                  glm M1
                  b = b
                  V =V

                  in last two lines ı am receving the 503 confirmabilty error.

                  Comment


                  • #10
                    I am clueless without a reproducible example (see FAQ Advice #12 on how to provide one). But if you have 11 equations, you need to extract 11 submatrices. See

                    Code:
                    help matrix extraction
                    for some more efficient ways to extract a matrix if you have a distinct equation name (for Stata 16 and above). For example:

                    Code:
                    sysuse auto
                    sureg (price foreign weight length) (mpg foreign weight) (displ foreign weight)
                    mat l e(b)
                    mat price= e(b)[1, "price:"]
                    mat l price
                    Res.:

                    Code:
                    . mat l e(b)
                    
                    e(b)[1,10]
                               price:        price:        price:        price:          mpg:          mpg:          mpg:  displacem~t:  displacem~t:
                             foreign        weight        length         _cons       foreign        weight         _cons       foreign        weight
                    y1       3575.26     5.6914623    -88.271139     4506.2117    -1.6500291    -.00658789     41.679702    -25.612697     .09675485
                    
                         displacem~t:
                               _cons
                    y1    -87.235477
                    
                    . 
                    . mat price= e(b)[1, "price:"]
                    
                    . 
                    . mat l price
                    
                    price[1,4]
                             price:      price:      price:      price:
                           foreign      weight      length       _cons
                    y1     3575.26   5.6914623  -88.271139   4506.2117

                    Comment


                    • #11
                      I have over 392 different parameters in my SUR model, so let me explain the problem using auto data instead of my data.

                      Code:
                      . sysuse auto
                      (1978 automobile data)
                      
                      
                      . sureg (price mpg headroom) (trunk weight length) (gear_ratio turn headroom)
                      
                      Seemingly unrelated regression
                      ------------------------------------------------------------------------------
                      Equation Obs Params RMSE "R-squared" chi2 P>chi2
                      ------------------------------------------------------------------------------
                      price 74 2 2576.37 0.2266 21.24 0.0000
                      trunk 74 2 2.912933 0.5299 82.93 0.0000
                      gear_ratio 74 2 .3307276 0.4674 65.12 0.0000
                      ------------------------------------------------------------------------------
                      
                      ------------------------------------------------------------------------------
                      | Coefficient Std. err. z P>|z| [95% conf. interval]
                      -------------+----------------------------------------------------------------
                      price |
                      mpg | -258.2886 57.06953 -4.53 0.000 -370.1428 -146.4344
                      headroom | -419.4592 390.4048 -1.07 0.283 -1184.639 345.7201
                      _cons | 12921.65 2025.737 6.38 0.000 8951.277 16892.02
                      -------------+----------------------------------------------------------------
                      trunk |
                      weight | -.0010525 .0013499 -0.78 0.436 -.0036983 .0015933
                      length | .1735274 .0471176 3.68 0.000 .0811785 .2658762
                      _cons | -15.6766 5.182878 -3.02 0.002 -25.83485 -5.518345
                      -------------+----------------------------------------------------------------
                      gear_ratio |
                      turn | -.0652416 .0097031 -6.72 0.000 -.0842594 -.0462238
                      headroom | -.0601831 .0505198 -1.19 0.234 -.1592001 .0388339
                      _cons | 5.781748 .3507486 16.48 0.000 5.094293 6.469202
                      ------------------------------------------------------------------------------
                      
                      . glm (price mpg headroom)
                      
                      Iteration 0: log likelihood = -686.17715
                      
                      Generalized linear models Number of obs = 74
                      Optimization : ML Residual df = 71
                      Scale parameter = 6912463
                      Deviance = 490784895.4 (1/df) Deviance = 6912463
                      Pearson = 490784895.4 (1/df) Pearson = 6912463
                      
                      Variance function: V(u) = 1 [Gaussian]
                      Link function : g(u) = u [Identity]
                      
                      AIC = 18.62641
                      Log likelihood = -686.1771533 BIC = 4.91e+08
                      
                      ------------------------------------------------------------------------------
                      | OIM
                      price | Coefficient std. err. z P>|z| [95% conf. interval]
                      -------------+----------------------------------------------------------------
                      mpg | -259.1057 58.42485 -4.43 0.000 -373.6163 -144.5951
                      headroom | -334.0215 399.5499 -0.84 0.403 -1117.125 449.082
                      _cons | 12683.31 2074.497 6.11 0.000 8617.375 16749.25
                      ------------------------------------------------------------------------------
                      as you see for the price model (glm) parameter estimate of mpg coef is -259.10 and parameter for same variable estimated in SUR system is -258.288

                      Now I wanted to test if parameter estimates of GLM and SUR methods are statistically equal or not.
                      Last edited by Omer Zeybek; 24 Oct 2021, 12:54.

                      Comment


                      • #12
                        Please study carefully what I am doing in #8. I am replacing the coefficients and variances matrices from glm with those from sureg. Your code does not replicate what I am doing.

                        Comment


                        • #13
                          Thank you very much Andrew, following your leads I solved the problem.

                          Best.
                          Last edited by Omer Zeybek; 30 Oct 2021, 08:26.

                          Comment

                          Working...
                          X