0
$\begingroup$

I'm new to time series forecasting and I'm currently reading a book about it. As I'm learning about the SARIMAX model it mentions the external variables being time-series as well. Do the external variables have to be time-series? For example, can they be the day of week, holiday, special event indicator etc.? Data I'm trying to predict is affected by tourist activity which happens during certain weeks of the year (think week long events). Also we believe holidays and specific days have an impact too.

Thanks in advance!

$\endgroup$

1 Answer 1

1
$\begingroup$

can [external variables] be the day of week, holiday, special event indicator etc.?

Yes, of course.

Define a boolean indicator variable which is 1 on Saturdays and Sundays. Define a similar one for holidays and for special events. And so we have a time-series of {weekday, weekend}, and so on.

Crucially, the indicator variable is available both during training and at inference time. So it's a very sensible feature to add to your dataset.

$\endgroup$
4
  • $\begingroup$ This got me thinking a bit... Is it good to one-hot encode time-series variables like these or does that not really matter with SARIMAX models? $\endgroup$
    – avb0101
    Commented May 7 at 16:21
  • $\begingroup$ The reason we one-hot encode things like $gender \in \{male, female\}$, $city \in \{LA, Chicago, NYC\}$, or $color \in \{R, G, B\}$ is so a linear model won't try to infer some magnitude or ranking among the set elements. I think you were asking if we should one-hot encode day-of-week, with seven indicator features. Yes, sure we could do that. But if Monday behavior isn't all that different from Tuesday behavior, then we're going to need more data to squish the variance down. It's more efficient to just model weekday vs weekend, if that's as much structure in the setup as matters to us. $\endgroup$
    – J_H
    Commented May 7 at 17:06
  • $\begingroup$ It depends on the context, day of week effect can be captured with seasonality (S) if it follows a repetative pattern. For special days it is good to have a flag, but keep in mind if you have several different kinds of special days or same special day at different times of the year it calculates the general uplift across all of them not specific to the period unless you explicitly create each one a sepatate flag. $\endgroup$
    – miroslaavi
    Commented May 7 at 17:08
  • $\begingroup$ @miroslaavi and J_H appreciate the follow-up! I thought the seasonality might pickup the day/month behavior so I was more referring to the other variables. I do have separate columns for each (Event 1, Event 2, Holiday, Weekend, Weekday etc.) $\endgroup$
    – avb0101
    Commented May 7 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.