Announcement

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

  • i.year command for OLS and fixed effects comparison

    Does it make sense to control for year dummies by using the i.year command for OLS and fixed effects estimation, to compare the two models?

    For example

    reg a b c i.year, robust

    xtreg a b c i.year, robust fe

    And compare the two models, or is it unnecessary to use the i.year command in one of them?

    In the fixed effects estimation, I want to make sure the effects are fixed for years and individuals. Does the fe command automatically do that or would I use i.year too?
    Last edited by Ella Ki; 04 May 2017, 11:11.

  • #2
    Ella:
    it's usually difficult to compare those models this way.
    The best approach is investigating whether the fixed effects under -xtreg, fe- are jointly different from zero. If this were not the case, you can go pooled OLS, but clustering the standar errors on -panelid-, as you're dealing with non-independent observations.
    That said, you can plug in -i.year- in both models. It may happen that some of them is omitted due to collinearity.
    Eventually, you can test if -i.year- via -testparm-.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      To add to Carlo's answer, you'll increase your chances of a a useful answer if you follow the FAQ on asking questions - provide Stata code in code delimiters, Stata output, and sample data.

      xtreg,fe puts in fixed effects for panels, not time. You need to add i.year to have time fixed effects as well.

      reg a b c i.year, and
      xtreg a b c i.year i.panel, fe

      Should give you identical parameters on a, b, c, and the year variable. You should also get the same on panel, but you'll have to do a little work to see them in xtreg.

      xtreg ,fe tests whether the panel fixed effects are zero automatically, or you can do it directly as Carlo says in reg.

      Comment


      • #4
        Hello Carlo, even though the initial question is 4 years old, may I please refer to your reply again:

        you say that " [if] the fixed effects under -xtreg, fe- are jointly different from zero. If this were not the case, you can go pooled OLS.."

        Am I right that you talk about the insignificance of the p-value of each year?

        Meaning if the year values are all (or mostly) insignificant under the -xtreg,fe- command, that I can conduct the same regression as pooled OLS (with i.year variables as well?).

        I am facing this issue, since my unbalanced panel (n=102, t=12) provides very insignificant results using fixed/random effects, but very significant values when I go for Pooled OLS with Driscoll-Kraay estimators (- xtscc, lag(..) - )

        Thank you in advance!

        Comment


        • #5
          Kevin:
          not quite.
          I referred to the F-test comparing as a footnote of the -xtreg,fe- outcome table (if you stick with default standard errors):
          Code:
          . use "https://www.stata-press.com/data/r16/nlswork.dta"
          (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
          
          . xtreg ln_wage c.age##c.age, fe
          
          Fixed-effects (within) regression               Number of obs     =     28,510
          Group variable: idcode                          Number of groups  =      4,710
          
          R-sq:                                           Obs per group:
               within  = 0.1087                                         min =          1
               between = 0.1006                                         avg =        6.1
               overall = 0.0865                                         max =         15
          
                                                          F(2,23798)        =    1451.88
          corr(u_i, Xb)  = 0.0440                         Prob > F          =     0.0000
          
          ------------------------------------------------------------------------------
               ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                   age |   .0539076   .0028078    19.20   0.000     .0484041    .0594112
                       |
           c.age#c.age |  -.0005973   .0000465   -12.84   0.000    -.0006885   -.0005061
                       |
                 _cons |    .639913   .0408906    15.65   0.000     .5597649    .7200611
          -------------+----------------------------------------------------------------
               sigma_u |   .4039153
               sigma_e |  .30245467
                   rho |  .64073314   (fraction of variance due to u_i)
          ------------------------------------------------------------------------------
          F test that all u_i=0: F(4709, 23798) = 8.74                 Prob > F = 0.0000
          
          .
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            Thank you for replying Carlo. So speaking of the F-test, the results in my following regression indicate no significance of the F-Value (see F =0.0663).

            Q1: Does this now mean that I can use pooled OLS, as you said?
            Q2: If yes, can you explain or forward me to any explanation so I can better understand why


            Click image for larger version

Name:	xtreg FE.PNG
Views:	1
Size:	154.0 KB
ID:	1628567



            Thank you in advance, apreciate the help.

            Comment


            • #7
              Kevin:
              1) yes. That said, in your model almost all coefficients seem to lack statistical significance (and this is weird). I would try with a more parsimonious model;
              2) if there's no evidence of panel-wise effect (and -xtest0- after -re- specification confirms it), the only remaining option is a pooled OLS (with standard errors clustered on -panelid-).
              This point is covered in the excellent
              https://www.stata.com/bookstore/environmental-econometrics-using-stata, (page 267, point 2., lines 1 and 2 from the bottom).
              Last edited by Carlo Lazzaro; 22 Sep 2021, 09:50.
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment


              • #8
                Originally posted by Carlo Lazzaro View Post
                Kevin:
                1) yes. That said, in your model almost all coefficients seem to lack statistical significance (and this is weird). I would try with a more parsimonious model;
                2) if there's no evidence of panel-wise effect (and -xtest0- after -re- specification confirms it), the only remaining option is a pooled OLS (with standard errors clustered on -panelid-).
                Carlo - thank you thus far. I slowly understand the essential points I tried to get.

                to 1) As I focus my whole analysis on the application of all explanatory variables, I see big trouble in ommitting even one of these. Therefore I'd prefer to keep all of them

                to 2) see below: Contrary to fixed effect, the random effect regression is significant (Picture 1). But conducting the Hausman-test, I receive indication that I should rather use FE due to the significance (Picture 2). Does this already give me indication that neither FE/RE is suitable in my case?

                Click image for larger version

Name:	RE_sign.PNG
Views:	1
Size:	150.4 KB
ID:	1628584
                Click image for larger version

Name:	Hausman.PNG
Views:	1
Size:	114.4 KB
ID:	1628585

                Comment


                • #9
                  Kevin:
                  1) there's no evidence of panel-wise effect in your -re- specification (the sigma_u is 0) either. You should run -xttest0- after -xtreg,re- to double-check this result.
                  2) your -hausman- result is not reliable as the matrix of the difference of the estimator VCE is not positive definite;
                  3) I would switch to pooled OLS (with standard errors clustered on -panelid-).
                  Kind regards,
                  Carlo
                  (Stata 19.0)

                  Comment


                  • #10
                    Originally posted by Carlo Lazzaro View Post
                    Kevin:
                    1) there's no evidence of panel-wise effect in your -re- specification (the sigma_u is 0) either. You should run -xttest0- after -xtreg,re- to double-check this result.
                    2) your -hausman- result is not reliable as the matrix of the difference of the estimator VCE is not positive definite;
                    3) I would switch to pooled OLS (with standard errors clustered on -panelid-).
                    to 1) the result is insignificant, therefore I assume pooled OLS is best (see picture below)


                    my hopefully last two questions:

                    Q: If I switch to pooled OLS as you recommend in 3), would you suggest on Driscoll-Kraay standard errors? I tested with fixed effects and identified Heteroskedascity, Autocorrelation and assume cross-sectional dependence (my code fails, but my benchmark paper using the same dataset faces the same issue). Therefore I would use Driscoll-Kraay errors as they seem practical under these circumstances

                    Q: I was always interested: are you specialists paid for this exceptional help? I hope so. I can imagine that you have great passion for Stata and would do it for free, but the quality and speed of replies is amazing. So I hope youre well compensated!
                    Click image for larger version

Name:	xttest0.PNG
Views:	1
Size:	28.8 KB
ID:	1628595

                    Comment


                    • #11
                      Kevin:
                      1) I'm only interested in this stuff. Like all the members on this forum, contributions are for free.
                      2) The -xtrest0- outcome confirms what was already clear from -xtreg,re- outcome table: there's no evidence of panel-wise effect.
                      3) going -xtscc- can be a good idea.
                      Kind regards,
                      Carlo
                      (Stata 19.0)

                      Comment


                      • #12
                        Originally posted by Carlo Lazzaro View Post
                        Kevin:
                        1) I'm only interested in this stuff. Like all the members on this forum, contributions are for free.
                        2) The -xtrest0- outcome confirms what was already clear from -xtreg,re- outcome table: there's no evidence of panel-wise effect.
                        3) going -xtscc- can be a good idea.
                        Sorry I misunderstood. If there is a chance to contribute something monetarily (symbolic thankful amount), please let me know (e.g. Paypal)
                        Last edited by Kevin Musoni; 22 Sep 2021, 10:50.

                        Comment


                        • #13
                          Not at all, thanks.
                          Kind regards,
                          Carlo
                          (Stata 19.0)

                          Comment


                          • #14
                            Originally posted by Carlo Lazzaro View Post
                            Kevin:
                            1) I'm only interested in this stuff. Like all the members on this forum, contributions are for free.
                            2) The -xtrest0- outcome confirms what was already clear from -xtreg,re- outcome table: there's no evidence of panel-wise effect.
                            3) going -xtscc- can be a good idea.
                            Sorry to open up this thread AGAIN. If I could come up with a better solution myself, I wouldnt bother you.

                            Could you forward me to a good source / free paper which can briefly explain to me in a formal way, why the occurence of "sigma_u=0" from -re- specification indicates a missing panel structure? I just need some input, to formally explain it in my thesis. Like this it is easier to me, to argue why I prefer using POLS over Fixed Effects model in this case.

                            Thank you in advance!

                            Comment


                            • #15
                              Kevin:
                              as per -xtest0- helpfile: Breusch, T. S., and A. R. Pagan. 1980. The Lagrange multiplier test and its applications to model specification in econometrics. Review of Economic Studies 47: 239-253.
                              As an aside, please note that -xttest0- relates to -xtreg,re- only.
                              Kind regards,
                              Carlo
                              (Stata 19.0)

                              Comment

                              Working...
                              X