Accelerating the pace of engineering and science

# lmctest

Leybourne-McCabe stationarity test

## Syntax

h = lmctest(y)
h = lmctest(y,'ParameterName',ParameterValue)
[h,pValue] = lmctest(...)
[h,pValue,stat] = lmctest(...)
[h,pValue,stat,cValue] = lmctest(...)
[h,pValue,stat,cValue,reg1] = lmctest(...)
[h,pValue,stat,cValue,reg1,reg2] = lmctest(...)

## Description

h = lmctest(y) assesses the null hypothesis that a univariate time series y is a trend stationary AR(p) process, against the alternative that it is a nonstationary ARIMA(p,1,1) process.

h = lmctest(y,'ParameterName',ParameterValue) accepts one or more comma-separated parameter name/value pairs. Specify ParameterName inside single quotes. Perform multiple tests by passing a vector value for any parameter. Multiple tests yield vector results.

[h,pValue] = lmctest(...) returns p-values of the test statistics.

[h,pValue,stat] = lmctest(...) returns the test statistics.

[h,pValue,stat,cValue] = lmctest(...) returns critical values for the tests.

[h,pValue,stat,cValue,reg1] = lmctest(...) returns a structure of regression statistics from the maximum likelihood estimation of the reduced-form model.

[h,pValue,stat,cValue,reg1,reg2] = lmctest(...) returns a structure of regression statistics from the OLS estimation of the filtered data on a linear trend.

## Input Arguments

 y Vector of time-series data. The last element is the most recent observation. The test ignores NaN values, which indicate missing entries.

### Name-Value Pair Arguments

 '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 p of lagged values of y to include in the structural model (equal to the number p of lagged changes of y in the reduced-form model). 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 or not to include the deterministic trend term d*t in the structural model (equivalent to including the drift term d in the reduced-form model). Determine the value of trend by the growth characteristics of the time series y. Choose trend with a specific testing strategy in mind. If y is growing, set trend to true to provide a reasonable comparison of a trend-stationary null and a unit-root process with drift. If y does not exhibit long-term growth characteristics, set trend to false. Default: true 'test' String or cell vector of strings indicating which estimate of the variance ${\sigma }_{1}^{2}$ to use in computing the test statistic. Values are 'var1' or 'var2'. Default: 'var2'

## Output Arguments

 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 AR(p) null in favor of the ARIMA(p,1,1) alternative. Values of h equal to 0 indicate a failure to reject the AR(p) 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. For details, see Test Statistics. cValue Vector of critical values for the tests, with length equal to the number of tests. Values are for right-tail probabilities. reg1 Structure of regression statistics from the maximum likelihood estimation of the reduced-form model. The structure is described in Regression Statistics Structure. reg2 Structure of regression statistics The structure is described in Regression Statistics Structure.

## Examples

expand all

### Assess Whether a Series Is Trend Stationary and AR(p)

Test the growth of the U.S. unemployment rate using the data in Schwert, 1987.

```load Data_SchwertMacro
```

Focus on the unemployment rate growth over the dates condsidered in Leybourne and McCabe, 1999.

```UN = DataTableMth.UN;
t1 = find(datesMth == datenum([1948 01 01]));
t2 = find(datesMth == datenum([1985 12 01]));
dUN = diff(UN(t1:t2)); % Unemployment rate growth
```

Assess the null hypothesis that the unemployment rate growth is a trend stationary, AR(1) process using the estimated variance from OLS regression.

```[h1,~,stat1,cValue] = lmctest(dUN,'lags',1,'test','var1')
```
```Warning: Test statistic #1 below tabulated critical values:
maximum p-value = 0.100 reported.

h1 =

0

stat1 =

0.0992

cValue =

0.1460

```

The warning indicates that the pvalue is below 0.1. h1 = 0 indicates that there is not enough evidence to reject that the unemployment rate growth is a trend stationary, AR(1) process.

Assess the null hypothesis that the unemployment rate growth is a trend stationary, AR(1) process using the estimated variance from the maximum liklihood of the reduced-form regression model.

```[h2,~,stat2,cValue] = lmctest(dUN,'lags',1,'test','var2')
```
```h2 =

1

stat2 =

0.1874

cValue =

0.1460

```

h2 = 1 indicates that the there is enough evidence to asuggest that the unemployment rate growth is nonstationary.

Leybourne and McCabe, 1999 report that the original LMC statistic fails to reject stationarity, while the modified LMC statistic does reject it.

expand all

### Model Equations

lmctest uses the structural model

$\begin{array}{c}y\left(t\right)=c\left(t\right)+\delta t+{b}_{1}y\left(t-1\right)+\cdots +{b}_{p}y\left(t-p\right)+{u}_{1}\left(t\right)\\ c\left(t\right)=c\left(t-1\right)+{u}_{2}\left(t\right),\end{array}$

where

$\begin{array}{c}{u}_{1}\left(t\right)~\text{i}\text{.i}\text{.d}\text{.}\left(0,{\sigma }_{1}^{2}\right)\\ {u}_{2}\left(t\right)~\text{i}\text{.i}\text{.d}\text{.}\left(0,{\sigma }_{2}^{2}\right),\end{array}$

and u1 and u2 are independent of each other.

The model is second-order equivalent in moments to the reduced-form ARIMA(p,1,1) model

(1 – L)y(t) = δ + b1(1 – L)y(t – 1) + ... + bp(1 – L)y(tp) + (1 – aL)v(t),

where L is the lag operator Ly(t) = y(t–1), and v(t) ~ i.i.d(0,σ2).

The null hypothesis is that σ2 = 0 in the structural model, which is equivalent to a = 1 in the reduced-form model. The alternative is that σ2 > 0 or a < 1. Under the null, the structural model is AR(p) with intercept c(0) and trend δt; the reduced-form model is an over-differenced ARIMA(p,1,1) representation of the same process.

### Test Statistics

lmctest computes test statistics using a two-stage method that first finds maximum likelihood estimates (MLEs) of coefficients in the reduced-form model. It then regresses the filtered data

z(t) = y(t) – b1y(t–1) – ... – bpy(tp)

on an intercept and, if 'trend' is true, on a trend. It forms the stat test statistic using the residuals e from the first regression as follows:

$\text{stat}=\frac{{e}^{T}Ve}{{s}^{2}{T}^{2}},$

where V(i,j) = min(i,j), s2 is an estimate of ${\sigma }_{1}^{2}$ that depends on the value of test (estimate of the variance), and T is the effective sample size.

### Test Choices

You can choose between test values of 'var1' and 'var2'. These distinguish between the algorithm for estimating the variance ${\sigma }_{1}^{2}$.

• 'var1' — The estimate is (e'*e)/T, where e is the residual vector from the OLS regression reg2 and T is the effective sample size. This is the original Leybourne-McCabe test described in [3], with a rate of consistency O(T).

• 'var1' — The estimate is a*σ2, where a and σ2 are MLEs from the estimation reg1 of the reduced-form model. This is the modified Leybourne-McCabe test described in [4], with a rate of consistency O(T2).

### Regression Statistics Structure

Lagging and differencing a time series reduces the sample size. Absent any presample values, if y(t) is defined for t = 1:N, then the lagged series y(tk) is defined for t = k+1:N. Differencing reduces the time base to k+2:N. With p lagged differences, the common time base is p+2:N and the effective sample size is N – (p+1).

The maximum likelihood estimation of reg1 regresses Y = (1–L)y(t), with num = N–1, on p lagged changes of y, so that size = N – (p+1).

The OLS estimation of reg2 regresses Y = z(t), with num = Np, on an intercept and, if trend is true, a trend, so that size = num.

The regression statistics structures have the following form:

 num Length of input series with NaNs removed size Effective sample size, adjusted for lags and difference 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 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

### Algorithms

Test statistics follow nonstandard distributions under the null, even asymptotically. Asymptotic critical values for a standard set of significance levels between 0.01 and 0.1, for models with and without a trend, have been tabulated in [2] using Monte Carlo simulations. Critical values and p-values reported by lmctest are interpolated from the tables. Tables are identical to those for kpsstest.

[1] shows that bootstrapped critical values, used by tests with a unit root null (such as adftest and pptest), are not possible for lmctest. As a result, size distortions for small samples may be significant, especially for highly persistent processes.

[3] shows that the test is robust when p takes values greater than the value in the data-generating process. [3] also notes simulation evidence that, under the null, the marginal distribution of the MLE of bp is asymptotically normal, and so may be subject to a standard t-test for significance. Estimated standard errors, however, are unreliable in cases where the MA(1) coefficient a is near 1. As a result, [4] proposes another test for model order, valid under both the null and the alternative, that relies only on the MLEs of bp and a, and not on their standard errors.

## References

[1] Caner, M., and L. Kilian. "Size Distortions of Tests of the Null Hypothesis of Stationarity: Evidence and Implications for the PPP Debate." Journal of International Money and Finance. Vol. 20, 2001, pp. 639–657.

[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] Leybourne, S. J., and B. P. M. McCabe. "A Consistent Test for a Unit Root." Journal of Business and Economic Statistics. Vol. 12, 1994, pp. 157–166.

[4] Leybourne, S. J., and B. P. M. McCabe. "Modified Stationarity Tests with Data-Dependent Model-Selection Rules." Journal of Business and Economic Statistics. Vol. 17, 1999, pp. 264–270.

[5] Schwert, G. W. "Effects of Model Specification on Tests for Unit Roots in Macroeconomic Data." Journal of Monetary Economics. Vol. 20, 1987, pp. 73–103.