In this article
  1. Before you start
  2. Why interviewers ask this
  3. Time series analysis from first principles
  4. Worked example
  5. Trade-offs and edge cases
  6. How to answer it in an interview
  7. Common mistakes
  8. Follow-up questions
  9. Sources

Before you start

This page sits in the machine learning algorithms learning path and builds on the statistics foundations.

Why interviewers ask this

Time series questions test whether a candidate remembers that order matters. Ordinary machine learning treats rows as independent, and time series data breaks that: the NIST handbook says such data may have an internal structure, such as autocorrelation, trend or seasonal variation, that must be accounted for.

A weak answer lists model names (autoregressive integrated moving average (ARIMA), Prophet, long short-term memory (LSTM)) and stops. A strong answer gives a sequence: look at the series, make it stationary, choose a family, then test on data from the future. A Staff-level answer adds what breaks: shuffled splits leak the future into training, and a model that fits history well can still lose to a naive forecast. Interviewers often follow with a "what if" question, such as a sudden level shift, which connects to distribution shift. Treat the four steps below as the spine of your answer.

Time series analysis from first principles

Time series
A time series is an ordered sequence of values of one variable taken at equally spaced time intervals, such as daily sales or monthly temperature, where the order carries information that shuffling the values would destroy.
Stationarity
Stationarity is the property of a series whose mean, variance and autocorrelation do not change over time, which many time series techniques assume because it lets patterns learned from the past carry forward.
Autocorrelation
Autocorrelation is the correlation of a series with a delayed copy of itself; the lag-1 value compares each point with the one before it, and the autocorrelation function (ACF) plots it for every lag.

In plain words

Picture a water-level gauge on a river. Today's reading depends heavily on yesterday's, rises with the season, and drifts upward over years. A gauge reading is not a fresh coin flip, so you cannot treat the readings as unrelated rows. The analogy breaks in one place: a river obeys physics, while a business series also reacts to promotions, holidays and one-off events that no past pattern contains.

Time series analysis finds how a series depends on its own past, through trend, seasonality and autocorrelation. It removes what breaks a model's assumptions. It fits the model. Then it judges the model on data from after the training period. NIST gives two aims. One is to understand the forces that produced the data. The other is to fit a model for forecasting, monitoring or control.

Step 1: Plot the series and split it into trend, seasonal and remainder

Decomposition is the first step: it splits a series into a trend, a seasonal part and a remainder. Per Hyndman's course slides, a trend is a long-term increase or decrease, a seasonal pattern follows a fixed period such as the month or day of the week, and a cyclic pattern rises and falls with no fixed period, usually over at least two years.

Two forms exist. Additive decomposition writes the series as seasonal plus trend plus remainder and fits when seasonal swings keep the same size; multiplicative decomposition multiplies the three and fits when swings grow in proportion to the level. NIST lists decomposition into trend, seasonal and residual components as one common approach. Input: the raw series. Output: three pieces you can inspect. You now know what structure the series has, which decides what to remove next.

Step 2: Make the series stationary

A series needs a steady mean, variance and autocorrelation before most techniques work, and NIST notes this is a common assumption and that a run sequence plot usually shows whether it holds. Stationary does not mean flat: a noisy series can be stationary, because only those three properties must stay constant.

Two fixes follow Hyndman and Athanasopoulos: a transformation such as a logarithm stabilises the variance, and differencing stabilises the mean. The ACF of non-stationary data decreases slowly, while that of stationary data drops to zero relatively quickly. In the worked series below, the lag-1 autocorrelation is 0.866 raw and 0.233 after a first difference.1

The Hyndman-Khandakar algorithm behind the ARIMA() function in that text chooses the number of differences, between 0 and 2, with repeated Kwiatkowski-Phillips-Schmidt-Shin (KPSS) tests. This choice decides which models are allowed: autoregressive moving average models assume a stationary input, and the d in ARIMA is the number of differences taken to get there. Exponential smoothing models the trend and season directly, without differencing first. Input: a trending series. Output: a series whose mean no longer drifts.

Step 3: Choose a technique family

Technique families answer different needs, and NIST covers moving averages, exponential smoothing, the Box-Jenkins approach and multivariate models. A moving average averages nearby values to smooth noise; it is not the moving-average term (the q) inside ARIMA, which models past forecast errors. Exponential smoothing is a forecasting method that weights recent values more heavily than old ones, in single, double and triple forms. ARIMA (autoregressive integrated moving average) is a model family that explains a value from its own past values and past errors after differencing; the Box-Jenkins approach builds it by identification, estimation and validation. Frequency-domain methods study the series as waves.

For ARIMA, Hyndman and Athanasopoulos describe choosing p and q by minimising the corrected Akaike information criterion (AICc) after differencing d times. Start with the simplest family that matches the structure from Step 1, and check it against a naive baseline. Need features for a learned model instead? See feature engineering techniques.

Each technique family suits a different kind of seriesTable comparing moving average, exponential smoothing, ARIMA and frequency methods by what each one does and when to reach for it.TechniqueWhat it doesReach for itwhenMoving averageAverages nearbyvaluesYou need asmoother viewExponential smoothingWeights recentvalues moreLevel, trend orseasonARIMALinks a value toits pastAutocorrelationremainsFrequency methodsStudies theseries as wavesRepeating cyclesmatterDiagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/time-series-analysis-techniques.html
Each technique family fits a different kind of series, so the structure you find decides the choice.CC BY 4.0 — source: Time series analysis techniques explained step by step
Text description of the diagram
  • Exponential smoothing weights recent values more.
  • ARIMA models the links between a value and its past values.

Step 4: Evaluate on future data with a rolling origin

Rolling-origin evaluation is a testing scheme that trains on the data up to a time point, forecasts the next values, scores the error, then moves the point forward and repeats. Hyndman and Athanasopoulos call it time series cross-validation. Training data always precede test data, so the model never sees the future.

Random K-fold splits break this order. Bergmeir, Hyndman and Koo (2018) note that serial correlation and non-stationarity make standard cross-validation hard to apply, though they show it can work for purely autoregressive models with uncorrelated errors. For scoring, Hyndman and Athanasopoulos recommend scale-free errors such as the mean absolute scaled error (MASE), because errors in raw units cannot be compared across series with different units. Input: a model and a series. Output: one error per forecast, averaged. A good fit on training data does not promise a good forecast.

Time series analysis moves from structure to a tested forecastFlow of four stages: look at the series and split it into trend and seasonal parts, make it stationary, choose a technique family, then test it on future data with a rolling origin.Decomposetrend, season,restStationarytransform,differenceTechniquesmoothing orARIMATestrolling originDiagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/time-series-analysis-techniques.html

Four steps take a raw series to a tested forecast, and each step feeds the next.CC BY 4.0 — source: Time series analysis techniques explained step by step
Step-by-step description
  1. Plot the series and split it into trend, seasonal and remainder.
  2. Transform and difference until the mean stops drifting.
  3. Choose smoothing, ARIMA or another family.
  4. Score forecasts on future data with a rolling origin.
  • Decompose the series into trend, seasonal and remainder.
  • Make the series stationary with a transform and differencing.
  • Choose a technique family such as smoothing or ARIMA.
  • Test on future data with a rolling origin.

Knowing it is half the job. Saying it is the other half.

Interview Clozo is an AI interview copilot for real interview rounds: it hears the question and puts a strong answer on your screen, and you say it in your own words. See the features or how it works.

Start Free Trial →

Worked example

The series has 24 monthly values built for this page (illustrative): a rise of 2 a month, a repeating yearly pattern and small fixed noise. It starts 101, 94, 97 and ends 138, 138, 138.1 The lag-1 autocorrelation is 0.866 raw, 0.233 after a first difference and -0.658 after a seasonal (12-month) difference.1 A strongly negative lag-1 value like that can hint at over-differencing or leftover structure in the noise. The seasonal differences sit near 24, which is twelve months of the rise of 2 a month, so the trend is clear.1

Four methods forecast one month ahead, starting from the first 13 months, which gives 11 forecasts. The "last-year change" method repeats the value from 12 months ago and adds the latest yearly change. MASE divides the mean absolute error by 5.083, the average one-month naive change in those first 13 months.1

On a rising series with a yearly pattern, repeating last year's value gives a mean absolute error of 24.09, while the naive forecast gives 4.73 and the last-year-change method 4.18.
MethodMean absolute error (MAE)Root mean squared error (RMSE)MASE
Naive (last value)4.735.820.93
Seasonal naive (same month last year)24.0924.234.74
Seasonal naive plus last year's change4.184.770.82
Simple exponential smoothing, weight 0.56.107.811.20

The seasonal naive forecast fails because it ignores the trend: each repeat is about 24 too low, the yearly rise.1 A MASE above 1 means the method is worse than the naive baseline's average change in training.

Repeating last year misses the trend that a yearly change catchesBar chart of the mean absolute one-month forecast error on an illustrative rising monthly series: naive 4.73, seasonal naive 24.09, seasonal naive plus last year's change 4.18, simple exponential smoothing 6.1.Mean absolute error0102030NaiveSeasonal naiveLast-yr changeSmoothing 0.5Method4.7324.094.186.1Diagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/time-series-analysis-techniques.html
Repeating last year's values misses the trend, so its error is about five times the naive forecast's.CC BY 4.0 — source: Time series analysis techniques explained step by step
Text description of the diagram
  • Seasonal naive has a mean absolute error of 24.09.
  • Seasonal naive plus last year's change has a mean absolute error of 4.18.

Trade-offs and edge cases

Simple methods often win. The naive forecast in the example beats simple exponential smoothing, so always keep a baseline. More flexible models raise the variance of the fit, the same tension as in bias versus variance.

Edge cases to name in an interview:

  • Mixed seasonal and cyclic patterns. A fixed period is seasonal; an irregular one is cyclic, so a seasonal difference will not remove it.
  • Level shifts and outliers. One break can fool a stationarity check; anomaly detection on a time series separates one-off spikes from real changes.
  • Percentage errors near zero. The mean absolute percentage error (MAPE) becomes unstable when actual values approach zero, which is another reason to prefer scaled errors.
  • Tests that disagree. The augmented Dickey-Fuller (ADF) test takes a unit root (non-stationarity) as its null hypothesis, while KPSS takes stationarity as its null, so the two can give opposite verdicts. Reported practice differs: some analysts decide from the plot, others from tests, so state which you used.
  • Seasonal data and ARIMA. Seasonal ARIMA (SARIMA) adds seasonal differencing and seasonal terms; per Hyndman and Athanasopoulos, the ARIMA() function picks the number of seasonal differences with unitroot_nsdiffs().
  • Learned models. In the M5 accuracy competition, LightGBM-based entries on lag features did best, and pretrained forecasting models such as Chronos forecast new series without refitting. Classical models remain the baseline to beat.

How to answer it in an interview

Interviewer asks

What techniques do you use to analyse a time series?

A strong answer

I plot the series and split it into trend, seasonal and remainder. Then I check stationarity and, if the mean drifts, difference it, and use a log transform if the variance grows. I choose the simplest family that fits: smoothing for a level, trend or season, ARIMA when autocorrelation remains. I evaluate with a rolling origin on future data, never a shuffled split, and compare against a naive baseline with a scaled error like MASE. What breaks is trusting a good training fit: it can still lose to the naive forecast.

The spoken structure: describe the series, make it stationary, name a family, then test on the future against a baseline.

Common mistakes

  • "Stationary means the values do not change." (wrong) "Stationary means the mean, variance and autocorrelation stay constant, and a noisy series can still qualify." (right)
  • "I split the data randomly into folds, as in standard machine learning." (wrong) "I train on the past and test on the future with a rolling origin." (right)
  • "The model fits history well, so it will forecast well." (wrong) "I judge it on held-out future data against a naive baseline." (right)
  • "Seasonal and cyclic mean the same." (wrong) "Seasonal has a fixed period; cyclic has none." (right)
  • "MAPE is the best measure for every series." (wrong) "I use a scaled error such as MASE when comparing across series." (right)

Follow-up questions

What is the difference between time series analysis and time series forecasting?

Analysis aims to understand the structure that produced the data; forecasting is one use of a fitted model. NIST lists both aims, understanding and then forecasting, monitoring or control.

How do you know if a time series is stationary?

Look at a run sequence plot for a steady mean and spread, and check that the ACF drops to zero quickly. Then run a test, and know the nulls: the ADF test has a unit root as its null, while KPSS has stationarity as its null, so they can disagree and are best read together. The Hyndman-Khandakar algorithm behind ARIMA() uses repeated KPSS tests to choose the number of differences.

Why can't you use random K-fold cross-validation on a time series?

Shuffled folds put future points in the training set and ignore serial correlation. The rolling origin keeps training data before test data; K-fold can be valid only in limited autoregressive cases with uncorrelated errors.

What is the difference between seasonal and cyclic patterns?

A seasonal pattern repeats at a fixed, known period such as the month; a cyclic pattern rises and falls with no fixed period, usually over at least two years.

What changes if you forecast 12 steps ahead instead of 1?

The forecast error is defined for each horizon h, so you score each horizon separately in the rolling origin. Accuracy usually worsens with the horizon; Hyndman (2014) says "the further ahead you forecast, the less accurate your forecasts should be". The worked example only covers one step ahead, so recompute before reusing its numbers.

Key takeaways
  • Time series data has order, so autocorrelation, trend and seasonality must be modelled, not ignored.
  • Decompose first, then make the series stationary with a transform and differencing.
  • Pick the simplest family that fits: smoothing, ARIMA or frequency methods.
  • Test with a rolling origin on future data and beat a naive baseline using a scaled error.

Sources

  1. Introduction to Time Series Analysis (NIST/SEMATECH e-Handbook, 6.4) — NIST, 26 Oct 2026
  2. Definitions, Applications and Techniques (NIST/SEMATECH e-Handbook, 6.4.1) — NIST, 30 Oct 2013
  3. Stationarity (NIST/SEMATECH e-Handbook, 6.4.4.2) — NIST, 30 Oct 2013
  4. Common Approaches to Univariate Time Series (NIST/SEMATECH e-Handbook, 6.4.4.4) — NIST, 30 Oct 2013
  5. Forecasting: Principles and Practice, 3rd ed., time series cross-validation — OTexts (Hyndman and Athanasopoulos), 1 May 2021
  6. Forecasting: Principles and Practice, 3rd ed., stationarity and differencing — OTexts (Hyndman and Athanasopoulos), 1 May 2021
  7. M5 accuracy competition: Results, findings, and conclusions — International Journal of Forecasting (Makridakis, Spiliotis, Assimakopoulos), 1 Jan 2022
  8. Chronos: Learning the Language of Time Series (arXiv 2403.07815) — arXiv (Ansari et al.), 12 Mar 2024
  9. Seasonality and decomposition (course slides) — Rob J Hyndman, 1 Jan 2017
  10. A note on the validity of cross-validation for evaluating autoregressive time series prediction — Computational Statistics and Data Analysis (Bergmeir, Hyndman, Koo), 1 Jan 2018
  11. Measuring forecast accuracy — Rob J Hyndman, 31 Mar 2014