Skip to content
tezvyn:

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

Source: facebook.github.ioMediumHow cards are made

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's really being asked

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.

The full answer

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.

The mistakes people make

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.

What usually comes next

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.

A 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.

Interview question

When forecasting daily sales, how should you model a recurring campaign that gradually ramps up and fades down around its start date?

  • a.Use a windowed or decay-function regressor covering the ramp-up and fade periodsCorrect
  • b.Remove the campaign days as outliers and let the model interpolate them
  • c.Apply a manual post-hoc uplift to the forecast after the model runs
  • d.Add a single binary indicator only on the campaign's official start date
Why?

A windowed regressor captures the campaign's gradual effect shape, while a single-day binary flag misses the ramp-up and fade. Removing days destroys repeatable signal, and post-hoc adjustments break confidence intervals and scalability.

Just read this? Test yourself on what you have been reading.

Read the original → facebook.github.io

You just looked this up. Could you explain it out loud?

That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles