| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Econometrics Toolbox |
| Contents | Index |
| Learn more about Econometrics Toolbox |
h = kpsstest(y)
h = kpsstest(y,'ParameterName',ParameterValue,...)
[h,pValue] = kpsstest(...)
[h,pValue,stat] = kpsstest(...)
[h,pValue,stat,cValue] = kpsstest(...)
[h,pValue,stat,cValue,reg] = kpsstest(...)
h = kpsstest(y) assesses the null hypothesis that a univariate time series y is trend stationary against the alternative that it is a nonstationary unit-root process.
h = kpsstest(y,'ParameterName',ParameterValue,...) accepts optional inputs as one or more comma-separated parameter-value pairs. 'ParameterName' is the name of the parameter inside single quotation marks. ParameterValue is the value corresponding to 'ParameterName'. Specify parameter-value pairs in any order; names are case-insensitive. Perform multiple tests by passing a vector value for any parameter. Multiple tests yield vector results.
[h,pValue] = kpsstest(...) returns p-values of the test statistics.
[h,pValue,stat] = kpsstest(...) returns the test statistics.
[h,pValue,stat,cValue] = kpsstest(...) returns critical values for the tests.
[h,pValue,stat,cValue,reg] = kpsstest(...) returns a structure of regression statistics.
y |
Vector of time-series data. The last element is the most recent observation. The test ignores NaN values, which indicate missing entries. |
'alpha' |
Scalar or vector of nominal significance levels for the tests. Set values between 0.01 and 0.1. Default: 0.05 |
'Lags' |
Scalar or vector of nonnegative integers indicating the number of autocovariance lags to include in the Newey-West estimator of the long-run variance. For best results, give a suitable value for 'lags'. For information on selecting 'lags', see Determine Appropriate Lags. Default: 0 |
'trend' |
Scalar or vector of Boolean values indicating whether to include the deterministic trend term dt in the model. Choose the value of 'trend' with a specific testing strategy in mind. If a series is growing, including a trend term (setting 'trend' to true) provides a reasonable comparison of a trend-stationary null and a unit-root process with drift. If a series does not exhibit long-term growth characteristics, do not include a trend term. Default: false |
h |
Vector of Boolean decisions for the tests, with length equal to the number of tests. Values of h equal to 1 indicate rejection of the trend-stationary null in favor of the unit-root alternative. Values of h equal to 0 indicate a failure to reject the null. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
pValue |
Vector of p-values of the test statistics, with length equal to the number of tests. Values are right-tail probabilities. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
stat |
Vector of test statistics, with length equal to the number of tests. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
cValue |
Vector of critical values for the tests, with length equal to the number of tests. Values are for right-tail probabilities. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
reg |
Structure of regression statistics for the OLS estimation of coefficients in the alternative model. The number of records equals the number of tests. Each record has the following fields:
|
kpsstest computes the vector of test statistics, with length equal to the number of tests, using an OLS regression of y on an intercept. If 'trend' is true, the regression includes a trend. The test statistic stat is:
![]()
where s(t) = r1 + ... + rt, r is
the vector of residuals from the regression,
is the Newey-West estimator
of the long-run variance, and T is the sample size.
Reproduce the first row of the second half of Table 5 in Kwiatkowski et al. [2]:
load NelsonPlosser y = log(NPDataset.GNPR); [~,~,stat] = kpsstest(y,'lags',0:8,'trend',true)
The resulting vector:
stat =
0.6299 0.3366 0.2421 0.1976 0.1729 0.1578 0.1479 0.1412 0.1369kpsstest performs a regression to find the LSQ fit between the data and the null model.
Test statistics follow nonstandard distributions under the null, even asymptotically. Kwiatkowski et al. [2] used Monte Carlo simulations, for models with and without a trend, to tabulate asymptotic critical values for a standard set of significance levels between 0.01 and 0.1. kpsstest interpolates critical values and p-values from these tables.
[1] Hamilton, J. D. Time Series Analysis. Princeton, NJ: Princeton University Press, 1994.
[2] Kwiatkowski, D., P. C. B. Phillips, P. Schmidt and Y. Shin. "Testing the Null Hypothesis of Stationarity against the Alternative of a Unit Root." Journal of Econometrics. Vol. 54, 1992, pp. 159–178.
[3] Newey, W. K., and K. D. West. "A Simple Positive Semidefinite, Heteroskedasticity and Autocorrelation Consistent Covariance Matrix." Econometrica. Vol. 55, 1987, pp. 703-708.
adftest | pptest | vratiotest
![]() | interpolate | lagmatrix | ![]() |
View demos and recorded presentations led by industry experts.
Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |