Phillips-Perron (PP) Test in Time Series Analysis
1. Introduction
Understanding the Terminology
Before diving into the specifics of statistical testing, it is essential to define a few foundational concepts in time series econometrics:- Time Series: A sequence of data points recorded, measured, or observed at successive, equally spaced time intervals.
- Example: Recording the daily closing price of Apple Inc. (AAPL) stock every trading day for five years, or tracking the monthly unemployment rate of a country over a decade.
- Stationarity (Weak Stationarity): A stationary time series is one whose statistical properties—namely its mean, variance, and autocorrelation—are constant over time. If you shift the time period, the shape of the data distribution remains stable. Stationarity is a strict prerequisite for most standard econometric forecasting models.
- Example: The daily number of customers visiting a well-established local coffee shop. The number might fluctuate randomly day-to-day (e.g., between 180 and 220), but it hovers around a stable average of 200 customers and doesn't exhibit a long-term upward or downward trend.
- Unit Root: A specific mathematical characteristic that makes a time series non-stationary. If a series has a unit root, it follows a "random walk." Random shocks have a permanent, lasting effect on the series rather than decaying, and the series has no stable long-run mean to revert to.
- Example: A drunk person walking down a large open field. Every step they take is in a random direction from their current position. If they stumble 10 feet to the right, that becomes their new starting point for the next step; they don't have a natural "pull" to return to where they started.
- Order of Integration, denoted as $I(d)$: This refers to the number of times a time series must be differenced to become stationary.
- An $I(0)$ series is already stationary.
- An $I(1)$ series has a unit root and must be differenced once (e.g., $\Delta y_t = y_t - y_{t-1}$) to achieve stationarity.
- Example: A country's total continuous Gross Domestic Product (GDP) is typically $I(1)$ because it keeps growing over time (non-stationary). However, if you calculate the quarter-over-quarter GDP growth rate (which is the first difference), that resulting series is usually $I(0)$ (stationary).
- Autocorrelation (Serial Correlation): This occurs when a time series is correlated with its own past values (lags).
- Example: Today's weather temperature. The temperature at noon today is highly correlated with the temperature at noon yesterday. A heatwave yesterday is a strong predictor of a hot day today.
- Heteroskedasticity: A condition where the variance of the error terms (or random shocks) changes over time. Financial time series often exhibit this as "volatility clustering"—periods of high volatility followed by periods of low volatility.
- Example: Cryptocurrency price swings. During a major bull market or crash (like late 2017 or early 2020), Bitcoin's daily price swings were massive (high variance). During mid-2023, the daily price swings were relatively small and boring (low variance).
- White Noise ($u_t$ or $\epsilon_t$): The ideal, purely random error term in a model. A white noise process has a mean of zero, a constant variance, and zero autocorrelation.
- Example: The outcome of rolling a fair six-sided die repeatedly. Each roll is completely independent of the previous roll, the average expected value never changes, and the variance remains identical on every single throw.
- Spurious Regression: A mathematical illusion that occurs when you run a standard regression (OLS) on two unrelated non-stationary variables. Because both series wander over time, the regression might show a very high $R^2$ and significant $t$-statistics, falsely suggesting a strong relationship where none exists.
- Example: You run a regression comparing "Global Ice Cream Sales" to "Number of Shark Attacks." You find a highly significant mathematical relationship. However, this is spurious; eating ice cream doesn't cause shark attacks. Both variables simply trend upwards during the summer months due to a third hidden factor (seasonality/temperature).
The Need for the Phillips-Perron Test
In time series econometrics, determining whether a dataset is stationary ($I(0)$) or non-stationary with a unit root ($I(1)$) is a fundamental first step to avoid spurious regressions. The Phillips-Perron (PP) test, developed by Peter C.B. Phillips and Pierre Perron in 1988, is a widely used statistical test to check for the presence of a null hypothesis that a time series contains a unit root.2. Comparison: PP Test vs. DF / ADF Tests
Before performing the math, it's crucial to understand why we might choose the Phillips-Perron test over its famous counterparts: the standard Dickey-Fuller (DF) and Augmented Dickey-Fuller (ADF) tests.| Feature/Test Approach | Dickey-Fuller (DF) | Augmented Dickey-Fuller (ADF) | Phillips-Perron (PP) |
| Handling Autocorrelation | Does not handle it. Assumes error terms are pure white noise. | Parametric: Adds lagged difference terms ($\Delta y_{t-1}, \Delta y_{t-2}$) directly into the regression equation to "whiten" the errors. | Non-Parametric: Modifies the test statistic after the regression using a mathematical correction (Newey-West estimator). |
| Handling Heteroskedasticity | Fails if volatility changes over time (assumes constant variance). | Fails if volatility changes over time (assumes constant variance). | Highly Robust: Naturally adjusts for changing variance (volatility clustering) without needing to alter the regression model. |
| Model Specification Difficulty | Easy (No lags to choose). | Harder (Must choose the correct number of lags $p$ using AIC/BIC criteria; picking wrong lags ruins the test). | Easy (No lags added to regression, but relies on a "bandwidth" parameter usually chosen automatically by software). |
| Best Use Case | Textbooks and purely theoretical, perfectly behaved data. | Standard macro-economic data (like GDP) without severe volatility clusters. | Financial data (stocks, crypto, exchange rates) which inherently have structural breaks and volatility clustering. |
3. Theoretical Foundation & Mathematical Model
The PP test is based on the standard first-order autoregressive, AR(1), process:$$y_t = \alpha + \beta t + \rho y_{t-1} + u_t$$
To test for a unit root, we subtract $y_{t-1}$ from both sides to specify the model in first differences:
$$\Delta y_t = \alpha + \beta t + \gamma y_{t-1} + u_t$$
(Where $\gamma = \rho - 1$)
The Hypotheses:
- Null Hypothesis ($H_0$): $\gamma = 0$ (implies the presence of a unit root / non-stationarity).
- Alternative Hypothesis ($H_1$): $\gamma < 0$ (implies the series is stationary or trend-stationary).
The PP test calculates the standard OLS t-statistic ($t_{\gamma}$) for $\gamma$ and then modifies it. The formula for the modified t-statistic ($Z_t$) is:
$$Z_t = \left( \sqrt{\frac{\hat{\sigma}^2}{\hat{\lambda}^2}} \right) \cdot t_{\gamma} - \frac{1}{2} \left( \frac{\hat{\lambda}^2 - \hat{\sigma}^2}{\hat{\lambda}^2} \right) \cdot \left( \frac{T \cdot SE(\hat{\gamma})}{\hat{\sigma}^2} \right)$$
Where:
- $t_{\gamma}$: Standard unadjusted t-statistic from the OLS regression.
- $\hat{\sigma}^2$: Short-run variance (variance of the OLS error terms).
- $\hat{\lambda}^2$: Long-run variance (calculated using a Newey-West HAC estimator).
- $T$: Total sample size.
- $SE(\hat{\gamma})$: Standard error of the $\gamma$ coefficient from the regression.
4. Five Real-World Math Examples Solved Step-by-Step
To execute the PP test from scratch, you follow a universal workflow:- Data Prep: Shift your data to create a "Lag 1" column, and subtract it from the raw data to create a "Difference" column.
- OLS Regression: Regress the "Difference" column (as Y) against the "Lag 1" column (as X). This generates your slope ($\hat{\gamma}$), standard error ($SE$), t-statistic ($t_\gamma$), and short-run error variance ($\hat{\sigma}^2$).
- HAC Calculation: Extract the regression errors (residuals) and apply a Newey-West formula to find the long-run variance ($\hat{\lambda}^2$).
- Substitution: Plug everything into the $Z_t$ formula and compare to critical values.
Example 1: Bitcoin Daily Closing Prices (High Volatility)
Context: We want to check if Bitcoin ($BTC_t$) follows a random walk (non-stationary). We choose a model with a constant, but no trend, because prices wander without a strict deterministic upward slope.Data Preparation:
| Day ($t$) | Raw Price ($BTC_t$) | Lag 1 ($BTC_{t-1}$) | Difference ($\Delta BTC_t$) |
| 1 | 40,000 | - | - |
| 2 | 40,500 | 40,000 | +500 |
| 3 | 39,800 | 40,500 | -700 |
| ... | ... | ... | ... |
| 1000 ($T$) | 42,000 | 41,500 | +500 |
Step 1: OLS Regression Results
How we get this: We run a standard linear regression where $\Delta BTC_t$ is our Y-variable and $BTC_{t-1}$ is our X-variable. The equation is $\Delta BTC_t = \alpha + \gamma BTC_{t-1} + u_t$. The software outputs the following descriptive parameters:
- $T = 1000$ (Total days of data)
- $\hat{\gamma} = -0.0025$ (The slope coefficient of the Lag 1 variable)
- $SE(\hat{\gamma}) = 0.0020$ (The standard error of the slope)
- $t_{\gamma} = -1.25$ (Calculated by dividing slope by standard error: $-0.0025 / 0.0020$)
- $\hat{\sigma}^2 = 400$ (The short-run variance of the residuals $u_t$)
Step 2: Software HAC Long-Run Variance
How we get this: We take the residuals ($u_t$) from the regression above. Because Bitcoin is highly volatile, the errors exhibit "heteroskedasticity" (volatility clustering). A Bartlett kernel spectral window adjusts for this.
$\hat{\lambda}^2 = 625$ (Notice the long-run variance is much higher than the short-run variance).
Step 3: Math Substitution ($Z_t$)
Now we substitute the values exactly as extracted into the formula:
$$Z_t = \left( \sqrt{\frac{400}{625}} \right) \cdot (-1.25) - \frac{1}{2} \left( \frac{625 - 400}{625} \right) \cdot \left( \frac{1000 \cdot 0.0020}{400} \right)$$
Solve the fractions in parentheses first:
$$Z_t = \left( \sqrt{0.64} \right) \cdot (-1.25) - \frac{1}{2} \left( \frac{225}{625} \right) \cdot \left( \frac{2}{400} \right)$$
Resolve the square root and inner fractions:
$$Z_t = (0.8) \cdot (-1.25) - (0.5) \cdot (0.36) \cdot (0.005)$$
Perform the multiplications:
$$Z_t = -1.00 - (0.18) \cdot (0.005)$$
$$Z_t = -1.00 - 0.0009 = -1.0009$$
Step 4: Conclusion
Calculated $Z_t = -1.00$
5% Critical Value = $-2.86$
Since $-1.00$ is NOT less than $-2.86$ (it is mathematically greater/closer to zero), we fail to reject the null hypothesis. Bitcoin is an $I(1)$ non-stationary random walk.
Example 2: US Inflation Rate (Monthly)
Context: Testing if inflation ($\pi_t$) is mean-reverting. Model: Constant, no trend.Step 1: OLS Regression Results
How we get this: We construct a table just like in Example 1, creating $\Delta \pi_t$ and $\pi_{t-1}$. Regressing the difference on the lag yields:
- $T = 360$ months
- $\hat{\gamma} = -0.16$ (Slope)
- $SE(\hat{\gamma}) = 0.05$ (Standard Error)
- $t_{\gamma} = -3.20$ (Calculated: $-0.16 / 0.05$)
- $\hat{\sigma}^2 = 0.04$ (Short-run variance)
How we get this: Analyzing the residuals reveals almost zero volatility clustering or severe autocorrelation.
$\hat{\lambda}^2 = 0.04$ (Because errors behave like pure white noise, long-run variance equals short-run variance).
Step 3: Math Substitution ($Z_t$)
Notice what happens to the second term of the equation when variances match:
$$Z_t = \left( \sqrt{\frac{0.04}{0.04}} \right) \cdot (-3.20) - \frac{1}{2} \left( \frac{0.04 - 0.04}{0.04} \right) \cdot \left( \frac{360 \cdot 0.05}{0.04} \right)$$
Solve the fractions:
$$Z_t = (\sqrt{1}) \cdot (-3.20) - \frac{1}{2} \left( \frac{0}{0.04} \right) \cdot \left( \frac{18}{0.04} \right)$$
Because $0.04 - 0.04 = 0$, the entire right side collapses:
$$Z_t = (1) \cdot (-3.20) - 0 = -3.20$$
Step 4: Conclusion
Calculated $Z_t = -3.20$
5% Critical Value = $-2.87$
Since $-3.20 < -2.87$, we reject the null hypothesis. Inflation is $I(0)$ (stationary).
Example 3: Quarterly Gross Domestic Product (GDP)
Context: GDP generally grows upwards over time. Therefore, we must use a Constant and Time Trend model to test if it naturally reverts to a specific growth trend line.Data Preparation:
Step 1: OLS Regression Results
How we get this: We run a multiple regression: $\Delta GDP_t = \alpha + \beta t + \gamma GDP_{t-1}$. We extract the parameters specifically for the $\gamma$ coefficient.
$T = 200$ quarters
$SE(\hat{\gamma}) = 0.01$
$t_{\gamma} = -2.50$
$\hat{\sigma}^2 = 1.00$
Step 2: Software HAC Long-Run Variance
How we get this: GDP shocks have long-lasting persistence across business cycles.
$\hat{\lambda}^2 = 1.44$
Step 3: Math Substitution ($Z_t$)
$$Z_t = \left( \sqrt{\frac{1.00}{1.44}} \right) \cdot (-2.50) - \frac{1}{2} \left( \frac{1.44 - 1.00}{1.44} \right) \cdot \left( \frac{200 \cdot 0.01}{1.00} \right)$$
Solve fractions:
$$Z_t = \left( \frac{1}{1.2} \right) \cdot (-2.50) - (0.5) \cdot \left( \frac{0.44}{1.44} \right) \cdot \left( \frac{2}{1} \right)$$
Simplify the multiplication:
$$Z_t = (0.833) \cdot (-2.50) - (0.5) \cdot (0.3055) \cdot (2)$$
$$Z_t = -2.083 - 0.3055 = -2.3885$$
Step 4: Conclusion
Calculated $Z_t = -2.38$
5% Critical Value (Trend Model) = $-3.43$
Since $-2.38$ is greater than $-3.43$, we fail to reject the null. GDP contains a unit root (non-stationary); economic shocks shift the baseline permanently.
Example 4: EUR/USD Real Exchange Rate (Purchasing Power Parity)
Context: Testing long-run PPP theory which suggests exchange rates ($RER_t$) are stationary over time. Model: Constant, no trend.
Step 1: OLS Regression Results
How we get this: Regress $\Delta RER_t$ against $RER_{t-1}$.
$T = 500$ weeks
$SE(\hat{\gamma}) = 0.02$
$t_{\gamma} = -3.10$
$\hat{\sigma}^2 = 0.25$
Step 2: Software HAC Long-Run Variance
$\hat{\lambda}^2 = 0.25$
Step 3: Math Substitution ($Z_t$)
Just like in Example 2, because the long-run and short-run variance are identical ($\hat{\sigma}^2 = \hat{\lambda}^2 = 0.25$), the PP penalty (the second half of the equation) collapses to exactly zero.
$$Z_t = (\sqrt{1}) \cdot (-3.10) - 0 = -3.10$$
Step 4: Conclusion
Calculated $Z_t = -3.10$
5% Critical Value = $-2.86$
Since $-3.10 < -2.86$, we reject the null hypothesis. The real exchange rate is stationary, supporting long-run PPP.
Example 5: Daily Temperature Anomalies (Climate Data)
Context: Testing if daily temperature deviations ($Temp_t$) from historical averages mean-revert rapidly. Model: No constant, no trend (because anomalies are already mathematically centered around zero).
Step 1: OLS Regression Results
How we get this: Regress $\Delta Temp_t$ directly against $Temp_{t-1}$ with no constant ($\alpha=0$).
$T = 10,000$ days
$SE(\hat{\gamma}) = 0.01$
$t_{\gamma} = -12.00$
$\hat{\sigma}^2 = 2.25$
Step 2: Software HAC Long-Run Variance
How we get this: Weather clustering (heat waves) pushes the Newey-West long-run variance higher.
$\hat{\lambda}^2 = 4.00$
Step 3: Math Substitution ($Z_t$)
$$Z_t = \left( \sqrt{\frac{2.25}{4.00}} \right) \cdot (-12.00) - \frac{1}{2} \left( \frac{4.00 - 2.25}{4.00} \right) \cdot \left( \frac{10000 \cdot 0.01}{2.25} \right)$$
Solve inside the brackets:
$$Z_t = \left( \frac{1.5}{2} \right) \cdot (-12.00) - (0.5) \cdot \left( \frac{1.75}{4.00} \right) \cdot \left( \frac{100}{2.25} \right)$$
Simplify to decimals:
$$Z_t = (0.75) \cdot (-12.00) - (0.5) \cdot (0.4375) \cdot (44.44)$$
Perform the multiplications:
$$Z_t = -9.00 - 9.72 = -18.72$$
Step 4: Conclusion
Calculated $Z_t = -18.72$
5% Critical Value (No Constant/Trend) = $-1.95$
Since $-18.72 \ll -1.95$, we strongly reject the null hypothesis. Temperature anomalies are highly stationary and mean-reverting.
5. Conclusion
The Phillips-Perron (PP) test is an essential tool in a time-series econometrician's arsenal. While the Augmented Dickey-Fuller (ADF) test requires the researcher to manually determine the correct number of lagged difference terms to eliminate autocorrelation, the PP test operates automatically using non-parametric mathematical corrections.This makes the PP test vastly superior when analyzing financial or macroeconomic data known to exhibit structural breaks, volatility clustering (heteroskedasticity), or unknown forms of moving-average autocorrelation.
Summary of Action: If the calculated PP $Z_t$ statistic is less (more negative) than the Mackinnon critical values, you safely conclude your data is stationary ($I(0)$) and can proceed with standard OLS modeling, VARs, or ARMA forecasting. If the series has a unit root ($I(1)$), you must difference the data or investigate cointegration frameworks to proceed without generating spurious regressions.