How to make Kpss test in Excel

The KPSS (Kwiatkowski-Phillips-Schmidt-Shin) test is a statistical test used to check for the stationarity of a time series around a deterministic trend. Unlike the Augmented Dickey-Fuller (ADF) test, which tests for unit roots, the KPSS test assumes that the series is stationary around a trend and tests against the null hypothesis of stationarity. Conducting a KPSS test in Excel requires a series of steps, as Excel does not have a built-in function for this specific test. However, you can perform the test by manually calculating the necessary statistics or using Excel’s capabilities for statistical analysis with some setup.

Step 1: Organize Your Data

Ensure your time series data is in a single column in Excel, with each row representing a consecutive time period (e.g., day, month, year).

Step 2: Calculate the Series Mean or Trend

For a simple KPSS test, you might consider the series mean as a representation of the trend. Use Excel’s AVERAGE function to calculate this:


For a more accurate trend estimation, you might perform a linear regression analysis on your time series data against time (1, 2, 3, …) and use the fitted values as your trend series.

Step 3: Calculate the Residuals

Subtract the mean (or fitted values from your trend estimation) from the original time series data to get the residuals. This can be done in Excel by simply subtracting the mean or fitted value from each data point in the series.

See also  How To Calculate A Variance Estimator in Excel

Step 4: Cumulative Sum of Residuals

Calculate the cumulative sum of the residuals. This can be done by using a formula that adds the current residual to the sum of all previous residuals.

Step 5: Calculate the Variance of the Residuals

Use Excel’s VAR.S function to calculate the variance of the residuals:

=VAR.S(residual range)

Step 6: Calculate the KPSS Statistic

The KPSS test statistic is calculated as the ratio of the squared sum of the cumulative residuals to the total variance of the residuals. You’ll need to square each cumulative residual, sum these squared values, and then divide by the total number of observations multiplied by the variance of the residuals.

Step 7: Determine the Critical Values

Critical values for the KPSS test depend on the sample size and the desired level of significance. These values are typically found in statistical tables. You’ll need to compare the KPSS statistic calculated in step 6 to the appropriate critical value to determine the stationarity of your series.

For more sophisticated statistical analysis, including the KPSS test, consider using statistical software or programming languages designed for statistical computing, such as R or Python, which have built-in functions for conducting the KPSS test.