tezvyn:

Explain stationarity in a time series

AI-drafted, machine-checkedSource: Wikipedia: Stationary processintermediate

This tests your grasp of core time series modeling assumptions. A strong answer defines stationarity (constant mean/variance), explains its importance for ARIMA (stable patterns), and names a test (ADF) and a fix (differencing).

WHAT THIS TESTS: This question tests your foundational knowledge of time series analysis. The interviewer wants to see if you understand that many forecasting models, like ARIMA, are built on the assumption that the underlying statistical properties of a series are stable. They are probing for both theoretical understanding (what is it?) and practical application (how do you test for it and fix it?). It separates candidates who have only used high-level libraries from those who understand the underlying mechanics.

A GOOD ANSWER COVERS: A strong answer has three parts. First, define stationarity: a time series is stationary if its statistical properties—specifically its mean, variance, and autocorrelation—are constant over time. The joint probability distribution does not change when shifted in time. Second, explain why it is critical for models like ARIMA: these models work by capturing and extrapolating past relationships (the 'AR' and 'MA' parts). If these relationships change over time (i.e., the series is non-stationary), the model's assumptions are violated, and its forecasts will be unreliable. Third, provide practical techniques. For testing, mention a statistical test like the Augmented Dickey-Fuller (ADF) test. For achieving stationarity, mention differencing (subtracting the previous observation from the current one) to remove trends, and applying transformations like logarithms to stabilize variance.

COMMON WRONG ANSWERS: A major red flag is a vague or incorrect definition, such as "the data is flat" or "it has no noise." This shows a superficial understanding. Another mistake is only mentioning the mean and forgetting variance and autocorrelation. When discussing fixes, a weak answer might just say "transform the data" without naming specific techniques like differencing or log transforms. Finally, confusing correlation with stationarity is a common error; a series can be highly correlated but non-stationary (e.g., a simple upward trend).

LIKELY FOLLOW-UPS: Expect questions like "What does the p-value in an ADF test tell you?" (A p-value below a threshold, e.g., 0.05, lets you reject the null hypothesis of non-stationarity and conclude the series is stationary). Or, "What if differencing once isn't enough?" (You can apply second-order differencing, but over-differencing can introduce artificial patterns). Another could be "Are there models that don't require stationarity?" (Yes, some models like Prophet or certain deep learning approaches can handle trends and seasonality directly).

ONE CONCRETE EXAMPLE: Imagine forecasting daily stock prices. The raw price series is almost never stationary; it has a trend and changing volatility. An ADF test on raw prices would likely yield a high p-value (e.g., > 0.5), failing to reject non-stationarity. To fix this, you would calculate the daily returns by differencing: return(t) = price(t) - price(t-1). This new series of returns is much more likely to be stationary, hovering around a mean of zero, making it a suitable input for an ARIMA model.

Read the original → en.wikipedia.org

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.