Announcement

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

  • Panel Data - Random effect model vs Pooled OLS

    Hi Statalist

    This is my first post, so bear with me if I make some mistakes.

    I am conducting a Panel Data regression by looking at factors which may have impacted the U.S. Stock market during the first wave of COVID-19 (02.01.2020 - 12.06.2020).

    Click image for larger version

Name:	Random effect Stata .png
Views:	1
Size:	57.7 KB
ID:	1665637


    First of all, I ran a Hausman test in order to choose between Fixed and Random effect model, which gave a value of 1 indicating a Random effect model.
    After the Hausman test, then was a xttest0 (Breusch-Pagan Lagrange multiplier) test in order to choose between Random Effect and OLS, which indicated a pooled OLS model.

    However, I have a hard time to understand why my dataset isn't appropriate for a random effect model? My data is both changing across time and across firms (Cross section and Time-series data).
    I will here below, show a short screenshot of my excel file which I am uploading to Stata.

    Click image for larger version

Name:	Data - Stata.png
Views:	1
Size:	126.2 KB
ID:	1665638


    I hope my question make sense.

    Best regards Victor




  • #2
    Victor:
    welcome to this forum.
    -sigma_u-=0 supports both the absence of evidence of a panel-wise effect and the striking (but possible) result of -xttest0- .
    You should go -pooled OLS- with -vce(cluster paneild)- standard errors.
    As an aside, as per FAQ please do not post screenshots; use -CODE delimiters to share what you typed and what Stata gave you back and -dataex- to post an exmaple/excerpt of your dataset. Thanks.
    Last edited by Carlo Lazzaro; 21 May 2022, 08:41.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi Carlo

      Thanks for your answer!
      I will then go with the Pooled OLS!

      I have a quick question about your recommendation of vce(cluster panelid) - standard errors tip.

      How do I perform this command in specific terms?
      Instead of typing "xtreg returns x1 x2 ...... xk, re" - I should then type regress "returns x1 x2 ...... xk, cluster(ID)" Or should it be done In a different way?

      Best regards
      Victor

      Comment


      • #4
        Victor:
        the idea is:
        Code:
        . use "https://www.stata-press.com/data/r17/nlswork.dta"
        (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
        
        . regress ln_wage c.age##c.age, vce(cluster idcode)
        
        Linear regression                               Number of obs     =     28,510
                                                        F(2, 4709)        =     701.39
                                                        Prob > F          =     0.0000
                                                        R-squared         =     0.0882
                                                        Root MSE          =     .45654
        
                                     (Std. err. adjusted for 4,710 clusters in idcode)
        ------------------------------------------------------------------------------
                     |               Robust
             ln_wage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
                 age |   .0855891   .0046943    18.23   0.000     .0763861    .0947922
                     |
         c.age#c.age |  -.0010982   .0000798   -13.76   0.000    -.0012547   -.0009417
                     |
               _cons |   .1647917   .0655679     2.51   0.012      .036248    .2933354
        ------------------------------------------------------------------------------
        
        .
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Carlo thank you so much! I really appreciate it!
          Best regards
          Victor

          Comment


          • #6
            Hi Carlo

            After running Pooled OLS as you suggest, I would like to hear your advice once again in the sense of I am performing the regression correctly and how to interpret the outcome from the regression.
            For instance, leverage has a coefficient -0.0014816 while c.leverage##c.leverage change to 0.0007272, what does that actually mean? (I would expect the coefficient to be negative).

            Furthermore, we have tested for autocorrelation by the Wooldridge test and Breusch-Godfrey LM test, and found evidence of no autocorrelation, which to my knowledge is what clustering is concerned about.

            A test for heteroskedasticity has also been performed, and I found that we have the "problem" of heteroskedasticity. So therefore we should use the command Robust, in order to deal with this issue.

            I hope my question make sense for you.


            . regress Return c.Leverage##c.Leverage c.ROA##c.ROA c.VIX##c.VIX c.CovidCases##c.CovidCases c.Restrictions##c.Restrictions c.FiscalDeficit##c.FiscalDeficit c.Monetary##c.Monetary c.Fiscal##c.Fiscal
            > c.ComServ##c.ComServ c.ConDis##c.ConDis c.ConStap##c.ConStap c.Energy##c.Energy c.Financials##c.Financials c.Industrials##c.Industrials c.InfoTech##c.InfoTech c.Materials##c.Materials c.RealEstate#
            > #c.RealEstate c.Utilites##c.Utilites c.SP600##c.SP600 c.SP400##c.SP400, vce(cluster ID)
            note: c.Restrictions#c.Restrictions omitted because of collinearity.
            note: c.Monetary#c.Monetary omitted because of collinearity.
            note: c.Fiscal#c.Fiscal omitted because of collinearity.
            note: c.ComServ#c.ComServ omitted because of collinearity.
            note: c.ConDis#c.ConDis omitted because of collinearity.
            note: c.ConStap#c.ConStap omitted because of collinearity.
            note: c.Energy#c.Energy omitted because of collinearity.
            note: c.Financials#c.Financials omitted because of collinearity.
            note: c.Industrials#c.Industrials omitted because of collinearity.
            note: c.InfoTech#c.InfoTech omitted because of collinearity.
            note: c.Materials#c.Materials omitted because of collinearity.
            note: c.RealEstate#c.RealEstate omitted because of collinearity.
            note: c.Utilites#c.Utilites omitted because of collinearity.
            note: c.SP600#c.SP600 omitted because of collinearity.
            note: c.SP400#c.SP400 omitted because of collinearity.

            Linear regression Number of obs = 159,556
            F(25, 1411) = 1000.23
            Prob > F = 0.0000
            R-squared = 0.2740
            Root MSE = .04703

            (Std. err. adjusted for 1,412 clusters in ID)
            -------------------------------------------------------------------------------------------------
            | Robust
            Return | Coefficient std. err. t P>|t| [95% conf. interval]
            --------------------------------+----------------------------------------------------------------
            Leverage | -.0014816 .0005036 -2.94 0.003 -.0024694 -.0004938
            |
            c.Leverage#c.Leverage | .0007272 .0002488 2.92 0.004 .0002391 .0012153
            |
            ROA | -.0000571 .0014632 -0.04 0.969 -.0029274 .0028131
            |
            c.ROA#c.ROA | .0069443 .0049881 1.39 0.164 -.0028405 .0167292
            |
            VIX | -.1722403 .0014451 -119.19 0.000 -.1750751 -.1694054
            |
            c.VIX#c.VIX | -.1583776 .0013582 -116.61 0.000 -.1610419 -.1557132
            |
            CovidCases | .0994484 .0014809 67.16 0.000 .0965434 .1023533
            |
            c.CovidCases#c.CovidCases | -.1480091 .0027817 -53.21 0.000 -.1534658 -.1425524
            |
            Restrictions | -.0449612 .0006503 -69.14 0.000 -.0462368 -.0436857
            |
            c.Restrictions#c.Restrictions | 0 (omitted)
            |
            FiscalDeficit | .0049512 .0002047 24.18 0.000 .0045496 .0053528
            |
            c.FiscalDeficit#c.FiscalDeficit | -.0043462 .000133 -32.69 0.000 -.0046071 -.0040854
            |
            Monetary | .011686 .0005222 22.38 0.000 .0106617 .0127103
            |
            c.Monetary#c.Monetary | 0 (omitted)
            |
            Fiscal | -.0127334 .0004613 -27.61 0.000 -.0136382 -.0118285
            |
            c.Fiscal#c.Fiscal | 0 (omitted)
            |
            ComServ | -.0002257 .0003805 -0.59 0.553 -.000972 .0005207
            |
            c.ComServ#c.ComServ | 0 (omitted)
            |
            ConDis | -.0002524 .0002563 -0.98 0.325 -.0007552 .0002503
            |
            c.ConDis#c.ConDis | 0 (omitted)
            |
            ConStap | -.0002562 .0003184 -0.80 0.421 -.0008808 .0003683
            |
            c.ConStap#c.ConStap | 0 (omitted)
            |
            Energy | -.0012875 .0003909 -3.29 0.001 -.0020543 -.0005208
            |
            c.Energy#c.Energy | 0 (omitted)
            |
            Financials | -.0012867 .0002328 -5.53 0.000 -.0017434 -.00083
            |
            c.Financials#c.Financials | 0 (omitted)
            |
            Industrials | -.0008308 .0002139 -3.88 0.000 -.0012505 -.0004111
            |
            c.Industrials#c.Industrials | 0 (omitted)
            |
            InfoTech | -.0000309 .000229 -0.13 0.893 -.00048 .0004183
            |
            c.InfoTech#c.InfoTech | 0 (omitted)
            |
            Materials | -.00082 .0002636 -3.11 0.002 -.001337 -.000303
            |
            c.Materials#c.Materials | 0 (omitted)
            |
            RealEstate | -.0007971 .0002513 -3.17 0.002 -.00129 -.0003042
            |
            c.RealEstate#c.RealEstate | 0 (omitted)
            |
            Utilites | -.0008558 .0002301 -3.72 0.000 -.0013072 -.0004044
            |
            c.Utilites#c.Utilites | 0 (omitted)
            |
            SP600 | -.0004829 .0001477 -3.27 0.001 -.0007726 -.0001932
            |
            c.SP600#c.SP600 | 0 (omitted)
            |
            SP400 | -.0003041 .0001398 -2.18 0.030 -.0005783 -.0000299
            |
            c.SP400#c.SP400 | 0 (omitted)
            |
            _cons | .0058529 .0003494 16.75 0.000 .0051675 .0065384


            Best regards
            Victor

            Comment


            • #7
              Victor:
              1) you're right with going -robust- to take heteroskedasticity into account and neglect -vce(cluster clusterid)- as you do not detect any evidence of serial correlation of the epsilon error.
              2) I find too many interactions in your -regress- code. I would consider a more parsimomious model, as the more complex the code, the higher the difficulty to disseminate its results.
              3) Please use CODE delimiters to share what you typed and what Stata gave you back. Thanks.
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment


              • #8
                I apologize, but can't figure out how to use Code delimters to share my state.
                I have tried to make my best guess on how to share the stata results.

                The model have now been reduced to 5 independent variables, to give a better indication of my regression.

                Code:
                regress Return c.Leverage##c.Leverage c.ROA##c.ROA c.VIX##c.VIX c.CovidCases##c.CovidCases c.FiscalDeficit##c.FiscalDeficit, vce(robust)
                
                Linear regression                               Number of obs     =    159,556
                                                                F(10, 159545)     =    3506.10
                                                                Prob > F          =     0.0000
                                                                R-squared         =     0.2278
                                                                Root MSE          =      .0485
                
                -------------------------------------------------------------------------------------------------
                                                |               Robust
                                         Return | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
                --------------------------------+----------------------------------------------------------------
                                       Leverage |  -.0020277   .0008961    -2.26   0.024     -.003784   -.0002713
                                                |
                          c.Leverage#c.Leverage |   .0009045    .000443     2.04   0.041     .0000363    .0017727
                                                |
                                            ROA |   .0011791   .0019659     0.60   0.549    -.0026741    .0050323
                                                |
                                    c.ROA#c.ROA |   .0083025   .0055205     1.50   0.133    -.0025176    .0191226
                                                |
                                            VIX |  -.1760961   .0010087  -174.57   0.000    -.1780732    -.174119
                                                |
                                    c.VIX#c.VIX |  -.1609645    .001079  -149.18   0.000    -.1630793   -.1588496
                                                |
                                     CovidCases |   .0799954   .0021132    37.85   0.000     .0758535    .0841373
                                                |
                      c.CovidCases#c.CovidCases |  -.1447866   .0033309   -43.47   0.000    -.1513151   -.1382581
                                                |
                                  FiscalDeficit |   .0074532   .0002681    27.80   0.000     .0069276    .0079787
                                                |
                c.FiscalDeficit#c.FiscalDeficit |   -.004955   .0001631   -30.37   0.000    -.0052748   -.0046353
                                                |
                                          _cons |   .0045019   .0004419    10.19   0.000     .0036357     .005368
                -------------------------------------------------------------------------------------------------

                Comment


                • #9
                  Victor_
                  thanks for abiding by CODE delimiters rule.
                  1) you can safely remove sq_ROA;
                  2) I recommend you to run -linktest- to check the correctnness of the functional form of the regressand (thatm under some conditions, tests whether the model as a whole is correctly specifiied).
                  Kind regards,
                  Carlo
                  (Stata 19.0)

                  Comment


                  • #10
                    After making the -linktest- we get a clear indication of the model not being correctly specified.
                    Code:
                     regress Return c.Leverage##c.Leverage c.ROA##c.ROA c.VIX##c.VIX c.CovidCases##c.CovidCases c.FiscalDeficit##c.FiscalDeficit, vce(robust)
                    
                    Linear regression                               Number of obs     =    159,556
                                                                    F(10, 159545)     =    3506.10
                                                                    Prob > F          =     0.0000
                                                                    R-squared         =     0.2278
                                                                    Root MSE          =      .0485
                    
                    -------------------------------------------------------------------------------------------------
                                                    |               Robust
                                             Return | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
                    --------------------------------+----------------------------------------------------------------
                                           Leverage |  -.0020277   .0008961    -2.26   0.024     -.003784   -.0002713
                                                    |
                              c.Leverage#c.Leverage |   .0009045    .000443     2.04   0.041     .0000363    .0017727
                                                    |
                                                ROA |   .0011791   .0019659     0.60   0.549    -.0026741    .0050323
                                                    |
                                        c.ROA#c.ROA |   .0083025   .0055205     1.50   0.133    -.0025176    .0191226
                                                    |
                                                VIX |  -.1760961   .0010087  -174.57   0.000    -.1780732    -.174119
                                                    |
                                        c.VIX#c.VIX |  -.1609645    .001079  -149.18   0.000    -.1630793   -.1588496
                                                    |
                                         CovidCases |   .0799954   .0021132    37.85   0.000     .0758535    .0841373
                                                    |
                          c.CovidCases#c.CovidCases |  -.1447866   .0033309   -43.47   0.000    -.1513151   -.1382581
                                                    |
                                      FiscalDeficit |   .0074532   .0002681    27.80   0.000     .0069276    .0079787
                                                    |
                    c.FiscalDeficit#c.FiscalDeficit |   -.004955   .0001631   -30.37   0.000    -.0052748   -.0046353
                                                    |
                                              _cons |   .0045019   .0004419    10.19   0.000     .0036357     .005368
                    -------------------------------------------------------------------------------------------------
                    Code:
                     linktest
                    
                          Source |       SS           df       MS      Number of obs   =   159,556
                    -------------+----------------------------------   F(2, 159553)    =  23833.10
                           Model |  111.800893         2  55.9004463   Prob > F        =    0.0000
                        Residual |  374.231023   159,553  .002345497   R-squared       =    0.2300
                    -------------+----------------------------------   Adj R-squared   =    0.2300
                           Total |  486.031915   159,555  .003046172   Root MSE        =    .04843
                    
                    ------------------------------------------------------------------------------
                          Return | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
                    -------------+----------------------------------------------------------------
                            _hat |   1.126313   .0074579   151.02   0.000     1.111695     1.14093
                          _hatsq |   2.108945   .0979764    21.53   0.000     1.916913    2.300976
                           _cons |  -.0014218   .0001381   -10.30   0.000    -.0016924   -.0011512
                    ------------------------------------------------------------------------------
                    However, I think it has something to with our dependent variable "Return", because when a made a test where I generated a new variable, which was "1/Return", which I know makes no sense, but just to see if the problem is caused here. (I did also remove the "Leverage" and "ROA").

                    Code:
                    . regress Return1 c.VIX##c.VIX c.CovidCases##c.CovidCases c.FiscalDeficit##c.FiscalDeficit, vce(robust)
                    
                    Linear regression                               Number of obs     =    158,781
                                                                    F(6, 158774)      =       1.16
                                                                    Prob > F          =     0.3232
                                                                    R-squared         =     0.0001
                                                                    Root MSE          =     5.4e+05
                    
                    -------------------------------------------------------------------------------------------------
                                                    |               Robust
                                            Return1 | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
                    --------------------------------+----------------------------------------------------------------
                                                VIX |  -13828.17    10290.5    -1.34   0.179    -33997.33     6340.99
                                                    |
                                        c.VIX#c.VIX |  -9344.449   7597.081    -1.23   0.219    -24234.57     5545.67
                                                    |
                                         CovidCases |   33744.31   24229.69     1.39   0.164    -13745.38       81234
                                                    |
                          c.CovidCases#c.CovidCases |  -36783.72   27031.99    -1.36   0.174    -89765.84    16198.41
                                                    |
                                      FiscalDeficit |  -671.3289   1662.473    -0.40   0.686    -3929.741    2587.084
                                                    |
                    c.FiscalDeficit#c.FiscalDeficit |   1590.913   813.6748     1.96   0.051    -3.872815    3185.698
                                                    |
                                              _cons |  -1769.989   1013.055    -1.75   0.081    -3755.555    215.5762
                    -------------------------------------------------------------------------------------------------
                    Code:
                     linktest
                    
                          Source |       SS           df       MS      Number of obs   =   158,781
                    -------------+----------------------------------   F(2, 158778)    =      4.65
                           Model |  2.7057e+12         2  1.3528e+12   Prob > F        =    0.0096
                        Residual |  4.6241e+16   158,778  2.9123e+11   R-squared       =    0.0001
                    -------------+----------------------------------   Adj R-squared   =    0.0000
                           Total |  4.6244e+16   158,780  2.9124e+11   Root MSE        =    5.4e+05
                    
                    ------------------------------------------------------------------------------
                         Return1 | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
                    -------------+----------------------------------------------------------------
                            _hat |    .554347    .537281     1.03   0.302    -.4987125    1.607406
                          _hatsq |   .0000811   .0000739     1.10   0.273    -.0000638     .000226
                           _cons |  -596.7924     1699.8    -0.35   0.726    -3928.365     2734.78
                    ------------------------------------------------------------------------------
                    As you can see, now is the model correctly specified, however, I can't understand why Return should be the problem.
                    Do you have any advice?

                    Comment


                    • #11
                      Victor:
                      what if you go -ln_Return1-?
                      Kind regards,
                      Carlo
                      (Stata 19.0)

                      Comment

                      Working...
                      X