Announcement

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

  • Fixed effect regression: trouble with definition

    Hello,

    I am running a regression on panel data across 20 years, several thousand panels. I need to regress a model on a year-by-year basis. I'm wondering if that would be equivalent to a fixed effects regression. I've read up on fixed effects regressions but am still unsure if fe is equivalent to regressing year-by-year. The paper that I'm reproducing collects the mean, sd, 1st and 3rd quartiles on a regression performed year-by-year for 20 years. I'm not sure if I should just do fe regression or some sort of ad hoc regression,

    Thank you in advance,

    John Michael Perdue

  • #2
    Not my strongest area, but if you run separate regressions for each year then you aren't treating it like panel data anymore. i.e. you need at least 2 time periods for it to be a panel, and with year by year regressions you only have one (assuming only one record for year). For example, this code just gives me repeated messages about insufficient observations when I try to run an fe model by year. It will work if I just ask for a regular regression.

    Code:
    webuse nlswork, clear
    xtreg tenure i.nev_mar, fe
    bysort year: xtreg tenure i.nev_mar, fe
    bysort year: reg tenure i.nev_mar
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    Stata Version: 17.0 MP (2 processor)

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

    Comment


    • #3
      Also, when you run separate regressions for each year, the effects of the independent variables can be different in each year. This wouldn't be true in an FE model unless you allowed every variable to interact with year.
      -------------------------------------------
      Richard Williams, Notre Dame Dept of Sociology
      Stata Version: 17.0 MP (2 processor)

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

      Comment


      • #4
        I'll just weigh in and agree with Richard. Running separate regressions for each year is not what xtreg with the fe is doing, and it is not especially attractive. For one, it does not allow for heterogeneity correlated with the covariates. In estimating an equation by FE, one should allow for separate year dummies, and maybe allowing some interactions with variables and year dummies is warranted.

        Comment


        • #5
          I suppose you could do something like this, expanding it to all your independent variables:

          Code:
          xtreg tenure i.nev_mar i.year i.year#i.nev_mar, fe
          One problem I see is that you are assuming the independent variables you have measured have different effects across time, but the variables you didn't measure have effects that do not vary across time. That may be a dubious assumption.
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          Stata Version: 17.0 MP (2 processor)

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

          Comment


          • #6
            Thank you, gentlemen, for your suggestions.
            I'm working right now, but will take a closer look when I am finished.

            Best regards

            Comment


            • #7
              Thank you, I was able to take a closer look at your suggestions. Now that I know that it is not a fe that is being asked for, the problem has taken on a new dimension. I need to perform multiple regressions and store the coefficient and z-statistics for each regression. I'm going to do some research to see if I can find anything on how to do this with a foreach command. If I turn up empty I will probably open another thread under a different post title. If anyone has suggestions in this regard they are most welcome.

              Best regards

              Comment


              • #8
                While writing a loop to store the coefficients and z-statistics is fine, it may be easier for you to use the -statsby- prefix. While you can't directly get the z-statistics with -statsby-, you can get the coefficients and their standard errors, and then you just have to divide to calculate z.

                Comment


                • #9
                  Check out -statsby-. "Collect statistics for a command across a by list," An example from the help file:

                  Code:
                  sysuse auto
                  statsby, by(foreign): regress mpg gear turn
                  -------------------------------------------
                  Richard Williams, Notre Dame Dept of Sociology
                  Stata Version: 17.0 MP (2 processor)

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

                  Comment


                  • #10
                    Richard,

                    Thank you for your timely response.

                    Best regards,
                    Michael

                    Comment


                    • #11
                      This worked very well, fortunately I was using a practice data file to try it out on. After I calculated _b with statsby, I tried to calculate _se. An error appeared saying that if I proceeded I would lose what was in memory. So I saved it, unfortunately all that was saved was the data created from the statsby command and I lost the the rest of the data in the file. Again, it was a practice file, but would you know if there is a way to save the data onto my existing dataset?

                      Thank you in advance,

                      Michael

                      Comment


                      • #12
                        Please do not mind my last question, I'm just going to save it to an external file.

                        Best regards,
                        Michael

                        Comment


                        • #13
                          First off, you don't need to calculate se. You can specify it as an option:

                          Code:
                          sysuse auto, clear
                          statsby _b _se N = e(N), by(foreign) : reg price mpg headroom
                          list
                          I am not totally sure why you would want to merge with your existing data. Remember, 1000s of cases may have been used to create a single set of regression results. But, you could probably use an m:1 or 1:m merge. Extending my current example,

                          Code:
                          sysuse auto, clear
                          statsby _b _se N = e(N), by(foreign) : reg price mpg headroom
                          list
                          merge 1:m foreign using auto
                          -------------------------------------------
                          Richard Williams, Notre Dame Dept of Sociology
                          Stata Version: 17.0 MP (2 processor)

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

                          Comment


                          • #14
                            Thank you Richard and Clyde, both for your timely responses. I didn't notice your comment earlier, Clyde: else, I would have acknowledged.

                            Best regards,
                            Michael
                            Last edited by jperdue1; 28 Jul 2014, 11:13.

                            Comment


                            • #15
                              This may be closer to what you want to do:

                              Code:
                              use "http://www.stata-press.com/data/r13/nlswork", clear
                              statsby _b _se N=e(N), by(year): reg ln_wage tenure south union
                              list
                              merge 1:m year using "http://www.stata-press.com/data/r13/nlswork"
                              sort idcode year
                              If you want t/z and p values, they are stored in r(table) after running regress. It may take a little creativity to extract them and add to the statsby results. Otherwise you can compute them yourself. See http://www.stata-journal.com/sjpdf.h...iclenum=st0137. I would do this before the merge.
                              -------------------------------------------
                              Richard Williams, Notre Dame Dept of Sociology
                              Stata Version: 17.0 MP (2 processor)

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

                              Comment

                              Working...
                              X