Announcement

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

  • treating continuous time variable

    Dear all

    I have a time variable (DateHour) in my panel data and I am seeking suggestions on how to properly include this variable in the regression.

    Regression one:
    I treat time variable as continuous and add c. before my time variable:

    reg depvar var c.DateHour

    Regression two:
    I generate four separate variables for Year, Month, Day, Hour, and include the interactions of these four variables in the regression as below:

    reg depvar var Year#Month#Day#Hour

    My goal is to control for unobserved price which changes over each hour and affects my dependent variable.

    Thank you for suggestions.

    CHT



  • #2
    Well, it all depends on what you think the underlying process is. But my best guess is that neither of these approaches is appropriate.

    The c.time approach is used when the underlying process is a linear trend in the outcome variable over time. This is the way we often do it in epidemiology, my field. In finance and economics, linear trends over extended periods of time are unusual, so this approach is seldom used there. Anyway, question 1 to ask yourself is whether you should expect a linear trend over time.

    The Year#Month#Day#Hour approach is the opposite extreme of a simple linear trend. This assumes that there will be a distinct shock to the outcome in every combination of year, month, day, and hour. That may, in fact, be reasonable in rapidly changing situations. But if that is what you want, there is really no reason I can see to attempt to parse that out into a year effect that is moderated by the month, which is in turn moderated by the day, which is in turn moderated by the hour. Unless you really have a specific interest in those effects of the different scales of time and how they modify each other (which would be rather unusual--I've never seen a research project with that goal), you probably can get this "separate shock every hour" more simply with
    Code:
    regress depvar var i.DateHour
    I suspect this is what you really want.

    Comment


    • #3
      Somewhat like Clyde my reaction is that this looks like a shotgun when a scalpel may be in order.

      If there is a time of day effect, wouldn't it be simpler to think of a few sinusoids? Time of month effect is hard to disentangle from time of year, but what are the expectations substantively?

      We can't give good answers in abstraction. If it's socio-economic data special events like vacations and public holidays could be crucial; if it's environmental a good first approximation is that the rivers and rocks don't know the calendar.

      Comment


      • #4
        @ Clyde and Nick

        I do not expect the unobserved price is a linear trend over time, therefore I would rule out c.DateHour.

        However I already know that the unobserved price is settled by day, therefore I would take the second approach, but only change the code to:

        Code:
        regress depvar var i.Date
        In addition, I may also try
        Code:
        regress depvar var Year#Month
        and compare my results.

        Thank you again for your time and suggestion.

        Comment

        Working...
        X