Announcement

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

  • Time trend in fixed effects model

    Dear Stata listers

    I am doing a panel data regression using the xtreg (with fe) command on Stata 13. I have 5 years of monthly data and I would like to include time trend in the regression. I have already included the following command in my regression

    gen date = ym(year,month)
    format date %tm

    I have both year and month variables in my data. Will using i.month and i.year in my xtreg, fe be sufficient in accounting for time trend i.e. xtreg dependentvar (explanatory variables) i.month i.year, fe? Or should I be using i.date instead (I understand that c.date will assume a linear trend and I would prefer not to assume so)? Is there something else I have to do to account for time trend in Stata?

    On a related note, what's the difference between using i.month i.year, and specifying the date using - xtreg panelvar timevar - ? Do these two methods account for time trend in the same way?

    Can someone help me on this? Thank you.

  • #2
    Paul:
    how did you -xtset- your data?
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thanks for the reply Carlo.

      I have used the name of the firm as my panel variable. I did not include a time variable.

      Hence, I did -xtset firm-

      Hope you can help me with this.

      Comment


      • #4
        If you use i.month and i.year in your model you will be looking at a series of "shocks" from year to year as well as repeating "seasonal" variation (actually month by month) within year. This is not what would ordinarily be referred to as a "time trend," at least not in my discipline. But it may be what you want. Only you can decide that based on the research question you are working on and what is known about how the outcome variable changes over time, all else equal.

        If what you are looking to model does not include seasonal (monthly) variation within years, then you can't specify month and year separately but must use date. Specifying c.date alone will, as you note, model a linear time trend--which you state is not appropriate. So you need to decide what form of trend is appropriate. It might be quadratic: c.date##c.date. Or some other polynomial: work it out with powers of c.date (and think about centering them). Or if you think it is a linear spline, see -help mkspline-. If a series of "shocks" at certain dates is appropriate, creating a categorical variable by applying cut-points to the date variable at the time of each shock and then using that categorical variable (with i. prefix for factor variable handling) would do that. The possibilities are almost endless...

        Comment


        • #5
          Thanks for your reply Clyde.

          My research question is similar to what you've helped answered before: http://www.statalist.org/forums/foru...-time-variable. (this is the context of my question in this thread)

          For the airlines industry, I certainly think that there will be seasonal variation. I also do think that there will be yearly variation. How would you account for time trend in your discipline? I have a feeling it's the same the same as what I am trying to do here, but I may be doing it wrongly by simply adding yearly and seasonal variation here.

          Also, in order to account for time trend, is there a need to include an interaction term between i.month and i.year i.e. should I use i.year and i.month or should I use i.year##i.month in order to include the interaction term? What's the difference in the interpretation or the results whether I include the interaction term?

          Comment


          • #6
            Also, is there a need to "detrend" my series first before applying the seasonal effects to it? Or does including i.year##i.month automatically account for both the time trend and seasonal effects? I have read similar research papers which account for both time trend and seasonality but I cannot tell how the researchers did that in their papers...

            Comment


            • #7
              Using i.month#i.trend is probably inadvisable. That would, in effect, be modeling a new shock every month, with no seasonal pattern and no particular time trend. That is unlikely to be a reasonable model of anything.

              In chronic disease epidemiology, which is my discipline, we usually think about linear, or linear spline models over time, unless there is something to suggest otherwise.

              For five years of airline industry data, I would imagine it depends on which 5 years we're talking about. If it's 2000-2005, then there was, I believe, a huge negative shock in 2001 followed by a recovery. That would call for something like c.date plus separate indicators for 2000.year and 2001.year. If you're talking about some other five year period, I wouldn't know how to advise you. If it was a time when there was simple linear growth, then c.date by itself will do fine. If the growth was accelerating, then maybe a model in c.date##c..date makes sense. If it was really accelerating rapidly, you might have to introduce a variable representing exp(date - baseline_year) or something like that. It really depends on the substance, about which I have no knowledge. It isn't a statistical question I can answer.

              Regardless of how you handle the longer term growth, I do agree that for airline travel it makes sense to include seasonal effects, and i.month will do that for you quite nicely.

              Bottom line: you're probably looking at using i.month and either c.date or some transform of c.date.

              Comment


              • #8
                Thanks for the advice about time trend Clyde. I will choose my time trend accordingly.

                On a separate note, how do I choose not to display factor variables, e.g. i.month and other dummies which I generated automatically with the i. function, using -outreg2- in Stata?

                I have found many threads online where people want to display the factor variables and interaction terms but outreg2 does not display them. My problem is the exact opposite. I do not want outreg2 to display those variables. I have used -outreg2 (list of variables which I want it to display) using (filename)- Somehow all the i.variables e.g. i.month, in addition to the variables which I listed, are displayed.

                Thank you.

                Comment


                • #9
                  Afraid I can't help you with this one as I haven't ever used it.

                  Comment


                  • #10
                    No problem Clyde, you've helped a lot. Thank you!

                    Comment

                    Working...
                    X