tezvyn:

How would you incorporate external events into a time-series forecast?

AI-drafted, machine-checkedSource: facebook.github.iointermediate
How would you incorporate external events into a time-series forecast?

This tests exogenous regressor design. A strong answer proposes binary or continuous regressors for holidays and campaigns in Prophet or ARIMA, then validates lift via backtesting. A red flag is dropping outlier days or applying post-hoc manual adjustments.

WHAT THIS TESTS: The interviewer wants to know if you treat a time-series model as a living system that can absorb external signal, or if you see it as a black box that only looks at its own history. Specifically, they are probing for familiarity with exogenous regressors, the difference between additive and multiplicative effects, and how you validate that an external variable actually improves forecast accuracy rather than just overfitting the past.

A GOOD ANSWER COVERS: A good answer hits four things in order. First, it names the right tool for the model. In Prophet, you pass a holidays dataframe with holiday, ds, and optionally lower_window and upper_window to spread the effect across adjacent days; you can also add prior_scale per event. In ARIMA or SARIMAX, you supply an exog matrix of binary indicators or continuous variables like marketing spend. Second, it discusses effect shape. Campaigns may have ramp-up and ramp-down, so a simple one-day binary flag is often wrong; you might use a decay function or a window. Third, it addresses interaction. If a holiday effect scales with baseline volume, you need multiplicative seasonality, not purely additive. Fourth, it closes with validation. You backtest by withholding recent events, compare MAPE or RMSE with and without the regressor, and ideally run a counterfactual or synthetic control to confirm the lift is causal, not spurious.

COMMON WRONG ANSWERS: The biggest red flag is suggesting you remove event days as outliers or replace them with interpolated values. That destroys information and ignores the repeatable nature of holidays. Another weak pattern is proposing a manual post-hoc adjustment where you forecast naively and then subtract a guessed uplift after the fact; this breaks confidence intervals and makes the model unscalable. A third mistake is dumping every possible event into the model without regularization, which invites overfitting especially when historical occurrences are sparse.

LIKELY FOLLOW-UPS: Expect the interviewer to ask how you would handle an event that has never happened before, such as a new product launch. They may also ask what you do when marketing spend is endogenous because the team spends more when organic growth is already slowing. Finally, they might probe whether you would use a Bayesian structural time-series model or causal impact method instead of Prophet for a one-off experiment.

ONE CONCRETE EXAMPLE: Suppose you are forecasting daily active users and you know Black Friday drives a spike. In Prophet, you build a dataframe with holiday equal to black_friday, ds as the historical and future dates, lower_window set to zero and upper_window set to one to capture Thanksgiving evening bleed, and pass it into the holidays argument. You inspect the forecast component to see the estimated lift, say plus twelve percent, and you validate by running a cross-validation routine that omits the most recent Black Friday and checks whether the model with the holiday regressor reduces RMSE versus the baseline.

Source: facebook.github.io

Read the original → facebook.github.io

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.