pptest

Phillips-Perron test for one unit root

Syntax

``h = pptest(y)``
``````[h,pValue,stat,cValue] = pptest(y)``````
``StatTbl = pptest(Tbl)``
``[___] = pptest(___,Name=Value)``
``[___,reg] = pptest(___)``

Description

example

````h = pptest(y)` returns the rejection decision from conducting the Phillips-Perron test for a unit root in the input univariate time series.```

example

``````[h,pValue,stat,cValue] = pptest(y)``` also returns the p-value `pValue`, test statistic `stat`, and critical value `cValue` of the test.```

example

````StatTbl = pptest(Tbl)` returns a table containing variables for the test results, statistics, and settings from conducting the Phillips-Perron test on the last variable of the input table or timetable. To select a different variable to test, use the `DataVariable` name-value argument.```

example

````[___] = pptest(___,Name=Value)` specifies options using one or more name-value arguments in addition to any of the input argument combinations in previous syntaxes. `pptest` returns the output argument combination for the corresponding input arguments.Some options control the number of tests to conduct. The following conditions apply when `pptest` conducts multiple tests: `pptest` treats each test as separate from all other tests.If you specify `y`, all outputs are vectors.If you specify `Tbl`, each row of `StatTbl` contains the results of the corresponding test. For example, ```pptest(Tbl,DataVariable="GDP",Alpha=0.025,Lags=[0 1])``` conducts two tests, at a level of significance of 0.025, on the variable `GDP` of the table `Tbl`. The first test includes `0` autocovariance lags in the Newey-West covariance estimator and the second test includes `1` autocovariance lags.```

example

````[___,reg] = pptest(___)` additionally returns a structure of regression statistics for the hypothesis test.```

Examples

collapse all

Test a time series for a unit root using the default options of `pptest`. Input the time series data as a numeric vector.

Load the Canadian inflation rate data and extract the CPI-based inflation rate `INF_C`.

```load Data_Canada y = DataTable.INF_C;```

Test the time series for a unit root.

`h = pptest(y)`
```h = logical 0 ```

The result `h = 0` indicates that this test fails to reject the null hypothesis of a unit root against the AR(1) alternative.

Load Canadian inflation rate data and extract the CPI-based inflation rate `INF_C`.

```load Data_Canada y = DataTable.INF_C;```

Test the time series for a unit root. Return the test decision, $\mathit{p}$-value, test statistic, and critical value.

`[h,pValue,stat,cValue] = pptest(y)`
```h = logical 0 ```
```pValue = 0.3255 ```
```stat = -0.8769 ```
```cValue = -1.9476 ```

Test a time series, which is one variable in a table, for a unit root using default options.

Load Canadian inflation rate data, which contains yearly measurements on five time series variables in the table `DataTable`.

`load Data_Canada`

Test the long-term bond rate series `INT_L`, the last variable in the table, for a unit root.

`StatTbl = pptest(DataTable)`
```StatTbl=1×8 table h pValue stat cValue Lags Alpha Model Test _____ ______ _______ _______ ____ _____ ______ ______ Test 1 false 0.7358 0.24601 -1.9476 0 0.05 {'AR'} {'T1'} ```

`pptest` returns test results and settings in the table `StatTbl`, where variables correspond to test results (`h`, `pValue`, `stat`, and `cValue`) and settings (`Lags`, `Alpha`, `Model`, and `Test`), and rows correspond to individual tests (in this case, `pptest` conducts one test).

By default, `pptest` tests the last variable in the table. To select a variable from an input table to test, set the `DataVariable` option.

Test GDP data for a unit root using a trend-stationary alternative with 0, 1, and 2 lags for the Newey-West estimator.

```load Data_GDP logGDP = log(Data);```

Perform the Phillips-Perron test including 0, 1, and 2 autocovariance lags in the Newey-West robust covariance estimator.

`h = pptest(logGDP,Model="TS",Lags=0:2)`
```h = 1x3 logical array 0 0 0 ```

Each test returns `h` = 0, which means the test fails to reject the unit-root null hypothesis for each set of lags. Therefore, there is not enough evidence to suggest that log GDP is trend stationary.

Test a time series for a unit root against trend-stationary alternatives. Inspect the regression statistics corresponding to each of the tests.

Load a US macroeconomic data set `Data_USEconModel.mat`. Compute the log of the GDP and include the result as a new variable called `LogGDP` in the data set.

```load Data_USEconModel DataTimeTable.LogGDP = log(DataTimeTable.GDP);```

Test for a unit root in the logged GDP series using three different choices for the number of lagged difference terms. Return the regression statistics for each alternative model.

```[StatTbl,reg] = pptest(DataTimeTable,DataVariable="LogGDP",Model="TS",Lags=0:2); StatTbl```
```StatTbl=3×8 table h pValue stat cValue Lags Alpha Model Test _____ _______ _______ _______ ____ _____ ______ ______ Test 1 false 0.999 1.0247 -3.4302 0 0.05 {'TS'} {'T1'} Test 2 false 0.999 0.56702 -3.4302 1 0.05 {'TS'} {'T1'} Test 3 false 0.99829 0.31644 -3.4302 2 0.05 {'TS'} {'T1'} ```

`pptest` treats each of the three lag choices as separate tests, and returns results and settings for each test along the rows of the table `StatTbl`. `reg` is a 3-by-1 structure array containing regression statistics corresponding to each of the three alternative models.

Display the names of the coefficients, and their estimates and corresponding $\mathit{p}$-values resulting from the regressions of the three alternative models.

```test1 = array2table([reg(1).coeff reg(1).tStats.pVal], ... RowNames=reg(1).names,VariableNames=["Coeff" "pValue"])```
```test1=3×2 table Coeff pValue ___________ ___________ c -0.014026 0.6654 d -0.00013104 0.22383 a 1.0061 8.5908e-255 ```
```test2 = array2table([reg(2).coeff reg(2).tStats.pVal], ... RowNames=reg(2).names,VariableNames=["Coeff" "pValue"])```
```test2=3×2 table Coeff pValue ___________ ___________ c -0.014026 0.6654 d -0.00013104 0.22383 a 1.0061 8.5908e-255 ```
```test3 = array2table([reg(3).coeff reg(3).tStats.pVal], ... RowNames=reg(3).names,VariableNames=["Coeff" "pValue"])```
```test3=3×2 table Coeff pValue ___________ ___________ c -0.014026 0.6654 d -0.00013104 0.22383 a 1.0061 8.5908e-255 ```

The coefficients `c` and `d` are the drift and deterministic trend, respectively, in the alternative model. `a` is the lag 1 AR term in the null and alternative models. Although each test uses a different number of lags, all coefficient estimates are the same. This result occurs because `Lags` factors into the Newey-West estimate of the long-run variance, not the model itself.

Compare the Newey-West variance estimates among the tests.

`reg.NWEst`
```ans = 1.2352e-04 ```
```ans = 1.8025e-04 ```
```ans = 2.2355e-04 ```

Input Arguments

collapse all

Univariate time series data, specified as a numeric vector. Each element of `y` represents an observation.

Data Types: `double`

Time series data, specified as a table or timetable. Each row of `Tbl` is an observation.

Specify a single series (variable) to test by using the `DataVariable` argument. The selected variable must be numeric.

Note

`pptest` removes missing observations, represented by `NaN` values, from the input series.

Name-Value Arguments

Specify optional pairs of arguments as `Name1=Value1,...,NameN=ValueN`, where `Name` is the argument name and `Value` is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose `Name` in quotes.

Example: `pptest(Tbl,DataVariable="GDP",Alpha=0.025,Lags=[0 1])` conducts two tests, at a level of significance of 0.025, for the presence of a unit root in the variable `GDP` of the table `Tbl`. The first test includes `0` autocovariance lags in the Newey-West estimator of the long-run variance and the second test includes `1` autocovariance lag.

Number of autocovariance lags to include in the Newey-West estimator of the long-run variance, specified as a nonnegative integer or vector of nonnegative integers. If `Lags(j)` > 0, `pptest` includes lags 1 through `Lags(j)` in the estimator for test `j`.

`pptest` conducts a separate test for each element in `Lags`.

Example: `Lags=0:2` includes zero lagged autocovariance terms in the Newey-West estimator for the first test, the lag 1 autocovariance term for the second test, and autocovariance lags 1 and 2 in the third test.

Data Types: `double`

Model variant, specified as a model variant name, or a string vector or cell vector of model names. This table contains the supported model variant names.

Model Variant NameDescription
`"AR"`

Autoregressive model variant, which specifies a test of the null model

yt = yt – 1 + εt

against the alternative model

yt = ϕyt – 1 + εt

with AR(1) coefficient |ϕ| < 1.

`"ARD"`

Autoregressive model with drift variant, which specifies a test of the null model

yt = yt – 1 + εt

against the alternative model

yt = c + ϕyt – 1 + εt

with drift coefficient c and AR(1) coefficient |ϕ| < 1.

`"TS"`

Trend-stationary model variant, which specifies a test of the null model

yt = yt – 1 + εt

against the alternative model

yt = c + + ϕyt – 1 + εt

with drift coefficient c, deterministic trend coefficient δ, and AR(1) coefficient |ϕ| < 1.

`pptest` conducts a separate test for each model variant name in `Model`.

Example: `Model=["AR" "ARD"]` uses the stationary AR model as the alternative hypothesis for the first test, and then uses the stationary AR model with drift as the alternative hypothesis for the second test.

Data Types: `char` | `cell` | `string`

Test statistic, specified as a test name, or a string vector or cell vector of test names. This table contains the supported test names.

Test NameDescription
`"t1"`

Modification of the standard t statistic

`${t}_{1}=\frac{\stackrel{^}{\varphi }-1}{\text{SE}\left(\stackrel{^}{\varphi }\right)},$`

computed using the ordinary least squares (OLS) estimate of the AR(1) coefficient $\stackrel{^}{\varphi }$ and its standard error SE($\stackrel{^}{\varphi }$), in the alternative model.

`"t2"`

Modification of the unstudentized t statistic

t2 = T(ϕ – 1)

`${t}_{2}=\frac{T\left(\stackrel{^}{\varphi }-1\right)}{1-{\stackrel{^}{\beta }}_{1}-\dots -{\stackrel{^}{\beta }}_{p}},$`

computed using the OLS estimates of the AR(1) coefficient $\stackrel{^}{\varphi }$ in the alternative model. T is the effective sample size, which is adjusted for lags and missing values.

The test assesses the significance of the restriction $\varphi -1=0.$ `pptest` modifies the test statistics to account for serial correlations in the innovations process εt.

`pptest` conducts a separate test for each test name in `Test`.

Example: `Test="t2"` computes the F test statistic for all tests.

Data Types: `char` | `cell` | `string`

Nominal significance level for the hypothesis test, specified as a numeric scalar between `0.001` and `0.999` or a numeric vector of such values.

`pptest` conducts a separate test for each value in `Alpha`.

Example: `Alpha=[0.01 0.05]` uses a level of significance of `0.01` for the first test, and then uses a level of significance of `0.05` for the second test.

Data Types: `double`

Variable in `Tbl` to test, specified as a string scalar or character vector containing a variable name in `Tbl.Properties.VariableNames`, or an integer or logical vector representing the index of a name. The selected variable must be numeric.

Example: `DataVariable="GDP"`

Example: `DataVariable=[false true false false]` or `DataVariable=2` tests the second table variable.

Data Types: `double` | `logical` | `char` | `string`

Note

• When `pptest` conducts multiple tests, the function applies all single settings (scalars or character vectors) to each test.

• All vector-valued specifications that control the number of tests must have equal length.

• If you specify the vector `y` and any value is a row vector, all outputs are row vectors.

Output Arguments

collapse all

Test rejection decisions, returned as a logical scalar or vector with length equal to the number of tests. `pptest` returns `h` when you supply the input `y`.

• Values of `1` indicate rejection of the unit-root null hypothesis in favor of the alternative.

• Values of `0` indicate failure to reject the unit-root null hypothesis.

Test statistic p-values, returned as a numeric scalar or vector with length equal to the number of tests. `pptest` returns `pValue` when you supply the input `y`.

The p-values are left-tail probabilities.

When test statistics are outside tabulated critical values, `pptest` returns maximum (`0.999`) or minimum (`0.001`) p-values.

Test statistics, returned as a numeric scalar or vector with length equal to the number of tests. `pptest` returns `stat` when you supply the input `y`.

`pptest` computes test statistics using OLS estimates of the coefficients in the alternative model.

Critical values, returned as a numeric scalar or vector with length equal to the number of tests. `pptest` returns `cValue` when you supply the input `y`.

The critical values are for left-tail probabilities.

Test summary, returned as a table with variables for the outputs `h`, `pValue`, `stat`, and `cValue`, and with a row for each test. `pptest` returns `StatTbl` when you supply the input `Tbl`.

`StatTbl` contains variables for the test settings specified by `Lags`, `Alpha`, `Model`, and `Test`.

Regression statistics from the OLS estimation of coefficients in the alternative model, returned as a structure array with number of records equal to the number of tests.

Each element of `reg` has the fields in this table. You can access a field using dot notation, for example, `reg(1).coeff` contains the coefficient estimates of the first test.

 `num` Length of input series with `NaN`s removed `size` Effective sample size, adjusted for lags `names` Regression coefficient names `coeff` Estimated coefficient values `se` Estimated coefficient standard errors `Cov` Estimated coefficient covariance matrix `tStats` t statistics of coefficients and p-values `FStat` F statistic and p-value `yMu` Mean of the lag-adjusted input series `ySigma` Standard deviation of the lag-adjusted input series `yHat` Fitted values of the lag-adjusted input series `res` Regression residuals `autoCov` Estimated residual autocovariances `NWEst` Newey-West estimator `DWStat` Durbin-Watson statistic `SSR` Regression sum of squares `SSE` Error sum of squares `SST` Total sum of squares `MSE` Mean square error `RMSE` Standard error of the regression `RSq` R2 statistic `aRSq` Adjusted R2 statistic `LL` Loglikelihood of data under Gaussian innovations `AIC` Akaike information criterion `BIC` Bayesian (Schwarz) information criterion `HQC` Hannan-Quinn information criterion

collapse all

Phillips-Perron Test

The Phillips-Perron test assesses the null hypothesis of a unit root in a univariate time series yt, where

yt = c + δt + ϕyt – 1 + εt

and

• c is the drift coefficient (see `Model`).

• δ is the deterministic trend coefficient (see `Model`).

• εt is a mean zero innovation process.

The null hypothesis of a unit root restricts ϕ = 1. The alternative hypothesis is ϕ < 1. A test that fails to reject the null hypothesis, fails to reject the possibility of a unit root.

Variants of the model allow for different growth characteristics (see `Model`). The model with δ = 0 has no trend component, and the model with c = 0 and δ = 0 has no drift or trend.

Tips

• To draw valid inferences from a Phillips-Perron test, you must determine a suitable value for the `Lags` argument. The following methods help determine a suitable value:

• Begin by setting a small value and then evaluate the sensitivity of the results by adding more lags.

• Inspect sample autocorrelations of ytyt−1; slow rates of decay require more lags.

The Newey-West estimator is consistent when the number of lags is O(T1/4), where T is the effective sample size, adjusted for lag and missing values. For more details, see [9] and [5].

• With a specific testing strategy in mind, determine the value of `Model` by the growth characteristics of yt. If you include too many regressors (see `Lags`), the test loses power; if you include too few regressors, the test is biased towards favoring the null model [2]. In general, if a series grows, the `"TS"` model (see `Model`) provides a reasonable trend-stationary alternative to a unit-root process with drift. If a series is does not grow, the `"AR"` and `"ARD"` models provide reasonable stationary alternatives to a unit-root process without drift. The `"ARD"` alternative model has a mean of c/(1 – a); the `"AR"` alternative model has mean 0.

Algorithms

• In general, when a time series is lagged, the sample size is reduced. Without a presample, if yt is defined for t = 1,…,T, the lag k series ytk is defined for t = k+1,…,T. Consequently, the effective sample size of the common time base is Tk.

• To account for serial correlations in the innovations process εt, `pptest` uses modified Dickey-Fuller statistics (see `adftest`).

• Phillips-Perron statistics `stat` follow nonstandard distributions under the null, even asymptotically. `pptest` uses tabulated critical values, generated by Monte Carlo simulations, for a range of sample sizes and significance levels of the null model with Gaussian innovations and five million replications per sample size. `pptest` interpolates critical values `cValue` and p-values `pValue` from the tables. Tables for tests of `Test` types `"t1"` and `"t2"` are identical to those for `adftest`.

References

[1] Davidson, R., and J. G. MacKinnon. Econometric Theory and Methods. Oxford, UK: Oxford University Press, 2004.

[2] Elder, J., and P. E. Kennedy. "Testing for Unit Roots: What Should Students Be Taught?" Journal of Economic Education. Vol. 32, 2001, pp. 137–146.

[3] Hamilton, James D. Time Series Analysis. Princeton, NJ: Princeton University Press, 1994.

[4] Newey, W. K., and K. D. West. "A Simple, Positive Semidefinite, Heteroskedasticity and Autocorrelation Consistent Covariance Matrix." Econometrica. Vol. 55, 1987, pp. 703–708.

[5] Perron, P. "Trends and Random Walks in Macroeconomic Time Series: Further Evidence from a New Approach." Journal of Economic Dynamics and Control. Vol. 12, 1988, pp. 297–332.

[6] Phillips, P. "Time Series Regression with a Unit Root." Econometrica. Vol. 55, 1987, pp. 277–301.

[7] Phillips, P., and P. Perron. "Testing for a Unit Root in Time Series Regression." Biometrika. Vol. 75, 1988, pp. 335–346.

[8] Schwert, W. "Tests for Unit Roots: A Monte Carlo Investigation." Journal of Business and Economic Statistics. Vol. 7, 1989, pp. 147–159.

[9] White, H., and I. Domowitz. "Nonlinear Regression with Dependent Observations." Econometrica. Vol. 52, 1984, pp. 143–162.

Version History

Introduced in R2009b