Announcement

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

  • How to incorporate Week, Weekday, Holiday, and Hour Fixed Effects in Regression

    Hey everyone, thank you for taking the time to read and help!

    I currently have data from 2017-2020 July and with the variables date, hour (1-24), and amount in dollars. I want to incorporate Week, Weekday, Holiday, and Hour Fixed Effects in my regression and I was wondering how I would be able to do this? Do I need to create a new dummy for each week, weekday, holiday, and hour? If so, how would I be able to do this the fastest given that I have 30000 observations. Thank you so much!

  • #2
    Welcome to the Stata Forum / Statalist,

    Please read the FAQ. There you’ll find how to share data/command/output.

    Dealing with date and time may be challenging at first try. By typing- help datetime - you’ll get a good grasp of the matter.

    If you wish a specific reply, the best approach is sharing the specificities of the data. A short example within code delimiters is a great strategy.
    Best regards,

    Marcos

    Comment


    • #3
      You do not need to create dummies, but you need to create all those ( Week, Weekday, Holiday, and Hour) as variables first.

      Say if you have the Week variable which runs from 1 to 52, to expand it into a set of dummies you just write i.Week., to expand Hour you just write i.Hour

      Check -help fvvarlist-.

      All of those are trivial to generate, check -[FN] Date and time functions -
      except possibly for the Holiday variable.

      Comment

      Working...
      X