Inferensys

Glossary

Stationarity Test

A stationarity test is a statistical hypothesis test used to determine if the properties of a time series, such as its mean, variance, and autocorrelation, are constant over time.
Stylish WeWork-like workspace with hot desks and document wall, professional searching through enterprise knowledge base on a mounted ultrawide display, warm industrial pendants overhead.
CONCEPT DRIFT DETECTION

What is a Stationarity Test?

A statistical procedure used to determine if a time series has constant statistical properties over time, a key assumption for many forecasting models and a critical check for underlying stability before drift analysis.

A stationarity test is a statistical hypothesis test, such as the Augmented Dickey-Fuller (ADF) or Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test, used to determine if a time series is stationary. Stationarity implies that key properties like the mean, variance, and autocorrelation structure do not change over time. The absence of stationarity, indicated by trends, seasonality, or changing volatility, often signals an underlying data drift that can invalidate model assumptions and degrade predictive performance.

In concept drift detection, stationarity tests provide a foundational analysis of the input feature stream. A non-stationary signal suggests the data-generating process is evolving, which may necessitate drift adaptation strategies like model retraining. These tests are typically applied to a reference window of historical data. It is crucial to distinguish between stationarity (constant internal properties) and stability (no change relative to a baseline), as the latter is the direct target of most drift detection methods.

STATISTICAL METHODS

Key Stationarity Tests

Stationarity tests are formal statistical procedures used to determine if a time series has constant statistical properties over time, a foundational assumption for many forecasting models and drift detection systems.

01

Augmented Dickey-Fuller (ADF) Test

The Augmented Dickey-Fuller (ADF) test is the most common unit root test for stationarity. It assesses the null hypothesis that a time series has a unit root (i.e., is non-stationary). A low p-value (typically <0.05) leads to rejecting the null, indicating the series is stationary.

  • Mechanism: It fits a regression model to the differenced series with lagged difference terms to correct for higher-order autocorrelation.
  • Key Output: A test statistic and a p-value. The more negative the test statistic, the stronger the rejection of non-stationarity.
  • Use Case: The standard first test for checking if a series needs differencing to become stationary for ARIMA modeling.
02

Kwiatkowski-Phillips-Schmidt-Shin (KPSS) Test

The Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test inverts the hypothesis of the ADF test. Its null hypothesis is that the series is stationary (around a deterministic trend). A test statistic exceeding a critical value rejects stationarity.

  • Mechanism: It decomposes the series into a deterministic trend, a random walk, and a stationary error, testing the variance of the random walk component.
  • Complementary Use: Used alongside the ADF test for a robust conclusion. An ideal result is ADF rejects non-stationarity (p<0.05) and KPSS does not reject stationarity (p>0.05).
  • Trend Handling: Has variants for testing stationarity around a level versus around a deterministic trend.
03

Phillips-Perron (PP) Test

The Phillips-Perron (PP) test is another unit root test similar to the Dickey-Fuller test but uses non-parametric statistical methods to account for serial correlation and heteroskedasticity in the error terms.

  • Key Difference: Unlike the ADF test, which adds lagged difference terms to the model, the PP test modifies the test statistic directly. This makes it more robust to a wide range of error specifications.
  • Advantage: It is often more powerful than the basic Dickey-Fuller test when the error process is complex.
  • Consideration: While robust, it can be less reliable in finite samples compared to the ADF test with appropriately chosen lags.
04

Zivot-Andrews Test

The Zivot-Andrews test is a unit root test that allows for a single structural break in the series at an unknown point in time. This is critical because a structural break can make a stationary series appear non-stationary to standard tests.

  • Mechanism: It tests the null hypothesis of a unit root with drift, against the alternative of a trend-stationary process with a one-time break in the intercept, trend, or both.
  • Primary Use: Diagnosing whether an apparent unit root is actually caused by a sudden shift in the series' mean or growth rate (e.g., a policy change, market crash).
  • Drift Detection Link: A detected structural break is a definitive form of drift, signaling a permanent change in the data-generating process.
05

Ljung-Box Test (for Residuals)

While not a direct test of series stationarity, the Ljung-Box test is applied to the residuals of a time series model (like ARIMA) to check for remaining autocorrelation. Its failure is a key diagnostic for inadequate stationarity transformation.

  • Purpose: Tests the null hypothesis that the residuals are independently distributed (no autocorrelation).
  • Application in Stationarity: After differencing a series to achieve stationarity, the Ljung-Box test on the resulting series' autocorrelations helps verify if the differencing was sufficient. Significant p-values indicate remaining structure and potential non-stationarity.
  • Lag Parameter: The test is applied over a set number of lags (e.g., 10, 20) to check for long-range dependence.
06

Visual Analysis: ACF/PACF Plots

Autocorrelation Function (ACF) and Partial Autocorrelation Function (PACF) plots are essential visual diagnostics for stationarity before formal testing.

  • Stationary Series ACF: The ACF of a stationary series decays to zero relatively quickly. A slow, linear decay suggests a unit root (non-stationarity).
  • Differencing: If the ACF decays slowly, differencing the series and re-plotting the ACF is the standard remedy. A stationary series after differencing will show an ACF that cuts off or decays rapidly.
  • PACF Role: The PACF helps identify the order of an autoregressive (AR) process, which is only valid for stationary series. A sharp cutoff in the PACF suggests the AR order.
  • Practical First Step: Always plot the series, its ACF, and PACF to guide the choice and interpretation of formal statistical tests.
STATISTICAL FOUNDATION

Role in Concept Drift Detection

Stationarity tests provide a formal statistical framework for identifying a fundamental type of change in time-series data, serving as a critical early-warning system for predictive models.

A stationarity test is a statistical hypothesis test, such as the Augmented Dickey-Fuller (ADF) or Kwiatkowski–Phillips–Schmidt–Shin (KPSS) test, used to determine if a time series has constant statistical properties—like mean, variance, and autocorrelation—over time. In concept drift detection, rejecting the null hypothesis of stationarity signals a non-stationary process, which is a primary indicator that the underlying data distribution has changed and a model's assumptions are violated. This makes it a foundational tool for unsupervised drift detection in sequential data.

These tests are applied to model inputs, outputs, or error streams to detect covariate shift or concept drift without requiring true labels. A detected change in stationarity often triggers further investigation with two-sample hypothesis tests or drift localization. While powerful for trend detection, stationarity tests alone cannot pinpoint the drift's cause or specific features affected, necessitating integration with broader statistical process control (SPC) and model monitoring pipelines for actionable adaptation.

STATIONARITY TEST

Frequently Asked Questions

Stationarity tests are foundational statistical tools for analyzing time series data, crucial for detecting concept drift and ensuring model reliability. This FAQ addresses common technical questions about their application in machine learning systems.

A stationarity test is a statistical hypothesis test used to determine if the properties of a time series—such as its mean, variance, and autocorrelation—are constant over time, a condition known as stationarity. In machine learning, it is a critical diagnostic tool for concept drift detection, as non-stationarity in the input data or target variable often indicates that the underlying data-generating process has changed, which will degrade a model's predictive performance. Common tests include the Augmented Dickey-Fuller (ADF) test and the Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.