Explain time series stationarity and how to achieve it
Tests your grasp of core time series assumptions. Define stationarity (constant mean/variance over time), explain why models need it for stable predictions, and name methods to test and achieve it. A red flag is just saying the data looks 'flat'.
What's really being asked
This question probes your practical understanding of time series modeling beyond just calling a library function. The interviewer wants to see if you understand the mathematical assumptions that make models like ARIMA work. They are testing your ability to diagnose data issues and apply appropriate transformations, which is a key skill for reliable forecasting. It separates someone who uses tools from someone who understands them.
The full answer
A strong answer has three parts. First, define stationarity clearly: it's a property of a stochastic process where its statistical properties, specifically the mean and variance, do not change over time. The joint probability distribution is time-invariant. Second, explain why it's critical. Models like ARIMA are fundamentally based on the idea that the statistical properties of the series are consistent. If the mean is trending upwards, a model assuming a constant mean will consistently under-predict. Stationarity ensures the model's learned parameters are meaningful and stable for forecasting. Third, provide concrete techniques. For testing, mention a statistical test like the Augmented Dickey-Fuller (ADF) test, which tests the null hypothesis that a unit root is present (a cause of non-stationarity). For achieving stationarity, the most common method is differencing, which involves subtracting the previous observation from the current one to remove trends.
The mistakes people make
A major red flag is a purely visual or vague definition, like "the data looks flat" or "it has no trend." This is insufficient. While a trend is a form of non-stationarity, the concept is more rigorous, involving constant variance and autocorrelation as well. Another weak answer is failing to name a specific statistical test, instead suggesting just "plotting the data." While visualization is a good first step, it's not a formal test. Finally, candidates might mix up transformation techniques, suggesting things like log transforms (which stabilize variance but don't remove trends) as the primary method for achieving stationarity.
What usually comes next
Expect questions like: "What is a unit root?", "What are the limitations of differencing?", "What if your series has seasonality? How would you handle that?", or "Describe another type of transformation besides differencing." Be prepared to discuss seasonal differencing or other variance-stabilizing transformations like the Box-Cox transform.
A concrete example
Imagine you're modeling daily active users (DAU). Over a year, the DAU count is clearly trending upwards. This series is non-stationary because its mean is increasing. An ARIMA model trained on this raw data would fail because the "average" DAU it learns is meaningless for future predictions. To fix this, you would apply first-order differencing: create a new series where each point is DAU(today) - DAU(yesterday). This new series represents the daily change in users, which is much more likely to have a stable mean around some value (e.g., an average of +500 users/day), making it stationary and suitable for modeling.
Interview question
A time series of company revenue shows a clear upward trend. To prepare this data for an ARIMA model, what is the most appropriate initial transformation to apply?
- a.Smooth the series using a moving average.
- b.Apply a log transform to the series.
- c.Subtract the overall series mean from each data point.
- d.Perform first-order differencing on the series.Correct
Why? this is the answer
Differencing is the standard method to remove a trend and make a series stationary. While a log transform is a common distractor and can stabilize variance, it does not by itself remove the underlying trend.
Just read this? Test yourself on what you have been reading.
Read the original → en.wikipedia.org
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
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.
We are hiring for this. Open roles that interview on time series — each one lists the topics its interview covers.
See open roles