Posted On: 1/27/2025 11:37:32 AM |
Written By: Dr. Tej Bahadur Chandra
Statistical Tests to Check the Stationarity of Time Series Data
Two statistical test are broadly used to test the stationarity of the time series data: 1. Augmented Dickey-Fuller (ADF) test
2. KPSS (Kwiatkowski-Phillips-Schmidt-Shin) Test
1. Augmented Dickey-Fuller (ADF) test
The Augmented Dickey-Fuller (ADF) test is a statistical test used to determine whether a time series is stationary or contains a unit root. In time series analysis, stationarity is an essential property, as many statistical models assume the data is stationary (i.e., its statistical properties, like mean and variance, are constant over time).
Key ConceptsStationarity: - A time series is stationary if its statistical properties, such as mean, variance, and autocorrelation, do not change over time.
- Non-stationary time series often exhibit trends, seasonality, or changing variance.
Unit Root: - A unit root is a feature of some non-stationary time series that causes random shocks to have permanent effects.
- The presence of a unit root indicates the series is non-stationary.
Purpose of ADF Test: - To test the null hypothesis () that the time series has a unit root (i.e., it is non-stationary).
- The alternative hypothesis () is that the time series is stationary.
The Test EquationThe ADF test is based on estimating the following regression: Where: - : The time series value at time t.
- : The first difference of the series.
- : Time trend (optional).
- : Constant term (drift).
- : Coefficient of the time trend.
- : Coefficient that determines the presence of a unit root.
- : Lagged differences to account for autocorrelation in residuals.
- : White noise error term.
Steps to Perform the ADF TestState the Hypotheses: - : The time series has a unit root (non-stationary).
- : The time series does not have a unit root (stationary).
Estimate the Test Statistic: - Perform a regression using the above equation and calculate the test statistic for .
Compare with Critical Values: - The test statistic is compared against critical values at different significance levels (e.g., 1%, 5%, 10%).
- If the test statistic is less than the critical value, reject and conclude the series is stationary.
P-Value Approach: - Alternatively, a p-value is provided. If the p-value is less than the chosen significance level (e.g., 0.05), reject .
Outputs of the ADF TestTest Statistic: - Indicates whether to accept or reject .
Critical Values: - Thresholds for rejecting at 1%, 5%, and 10% significance levels.
P-Value: - A measure of the strength of evidence against .
Lag Order: - The number of lags used to address autocorrelation in the time series.
Limitations of ADF TestLow Power: - The ADF test might struggle to reject for near-stationary series.
Sensitivity to Lag Selection: - The number of lags chosen can impact results.
Not Robust to Structural Breaks: - If the time series has structural breaks, the ADF test might fail to detect stationarity.
Practical Use (Python Example)
from statsmodels.tsa.stattools import adfuller
# Example time series data = [your_time_series_data]
# Perform ADF test result = adfuller(data)
# Display results print("ADF Statistic:", result[0]) print("p-value:", result[1]) print("Critical Values:", result[4])
if result[1] < 0.05: print("Reject null hypothesis: The series is stationary.") else: print("Fail to reject null hypothesis: The series is non-stationary.")
|