Augmented Dickey-Fuller test

returns
a logical value with the rejection decision from conducting an augmented
Dickey-Fuller test for a unit root in a univariate time series, `h`

= adftest(`Y`

)`Y`

.

uses
additional options specified by one or more `h`

= adftest(`Y`

,`Name,Value`

)`Name,Value`

pair
arguments.

If any

`Name,Value`

argument is a vector, then all`Name,Value`

arguments specified must be vectors of equal length or length one.`adftest(Y,Name,Value)`

treats each element of a vector input as a separate test, and returns a vector of rejection decisions.If any

`Name,Value`

argument is a row vector, then`adftest(Y,Name,Value)`

returns a row vector.

Test a time series for a unit root using the default autoregression model without augmented difference terms.

Load Canadian inflation rate data.

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

Test the time series for a unit root.

h = adftest(Y)

h = 0

The result `h = 0`

indicates that this test fails to reject the null hypothesis of a unit root against the autoregressive alternative.

Test a time series for a unit root against a trend-stationary alternative augmented with lagged difference terms.

Load a time series of GDP data, and calculate its log.

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

Test for a unit root against a trend-stationary alternative, augmenting the model with 0, 1, and 2 lagged difference terms.

h = adftest(Y,'model','TS','lags',0:2)

h = 0 0 0

`adftest`

treats the three lag choices as three separate tests, and returns a vector with rejection decisions for each test. The values `h = 0`

indicate that all three tests fail to reject the null hypothesis of a unit root against the trend-stationary alternative.

Test a time series for a unit root against trend-stationary alternatives augmented with different numbers of lagged difference terms. Look at the regression statistics corresponding to each of the alternative models to choose how many lagged difference terms to include in the augmented model.

Load a time series of GDP data, and calculate its log.

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

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

[h,~,~,~,reg] = adftest(Y,'model','TS','lags',0:2);

`adftest`

treats each of the three lag choices as separate tests, and returns results for each test. `reg`

is an array of three data structures, corresponding to each alternative model.

Display the names of the coefficients included in each of the three alternatives.

reg.names

ans = 'c' 'd' 'a' ans = 'c' 'd' 'a' 'b1' ans = 'c' 'd' 'a' 'b1' 'b2'

The output shows which terms are included in the three alternative models. The first model has no added difference terms, the second model has one difference term (`b1`

), and the third model has two difference terms (`b1`

and `b2`

).

Display the t-statistics and corresponding p-values for each coefficient in the three alternative models.

[reg(1).tStats.t reg(1).tStats.pVal] [reg(2).tStats.t reg(2).tStats.pVal] [reg(3).tStats.t reg(3).tStats.pVal]

ans = 2.0533 0.0412 1.8842 0.0608 61.4717 0.0000 ans = 2.9026 0.0041 2.7681 0.0061 64.1396 0.0000 5.6514 0.0000 ans = 3.2568 0.0013 3.1249 0.0020 62.7825 0.0000 4.7586 0.0000 1.7615 0.0795

The returned t-statistics and p-values correspond to the coefficients in `reg.names`

. These results indicate that the coefficient on the first difference term is significantly different from zero in both the second and third models, but the coefficient on the second term in the third model is not. This suggests augmenting the model with one lagged difference term is adequate.

Compare the BIC for each of the three alternatives.

reg.BIC

ans = -1.4774e+03 ans = -1.4966e+03 ans = -1.4878e+03

Based on the BIC values, choose the model augmented with one lagged difference term because it has the best (that is, the smallest) BIC value.

`Y`

— Univariate time seriescolumn vectorUnivariate time series, specified as a column vector. The last
element is the most recent observation. `adftest`

ignores
missing observations, indicated by `NaN`

s.

**Data Types: **`double`

Specify optional comma-separated pairs of `Name,Value`

arguments.
`Name`

is the argument
name and `Value`

is the corresponding
value. `Name`

must appear
inside single quotes (`' '`

).
You can specify several name and value pair
arguments in any order as `Name1,Value1,...,NameN,ValueN`

.

`'alpha',0.1,'lags',0:2`

specifies
three tests with 0, 1, and 2 lagged difference terms conducted at
the 0.1 significance level`'alpha'`

— Significance levels`0.05`

(default) | scalar | vectorSignificance levels for the hypothesis tests, specified as the
comma-separated pair consisting of `'alpha'`

and
a scalar or vector. Use a vector to conduct multiple tests. All values
of `alpha`

must be between `0.001`

and `0.999`

.

**Example: **`'alpha',0.01`

**Data Types: **`double`

`'lags'`

— Number of lagged difference terms`0`

(default) | nonnegative integer | vector of nonnegative integersNumber of lagged difference terms to include in the model, specified
as the comma-separated pair consisting of `'lags'`

and
a nonnegative integer or vector of nonnegative integers. Use a vector
to conduct multiple tests.

**Example: **`'lags',[0,1,2]`

**Data Types: **`double`

`'model'`

— Model variant`'AR'`

(default) | `'ARD'`

| `'TS'`

Model variant, specified as the comma-separated pair consisting
of `'model'`

and `'AR'`

, `'ARD'`

,
or `'TS'`

. To conduct multiple tests with different
model variants, use a cell array to specify the model variant for
each test.

`'AR'` | Autoregressive model variant, which specifies a test of the
null model $${y}_{t}={y}_{t-1}+{\beta}_{1}\Delta {y}_{t-1}+{\beta}_{2}\Delta {y}_{t-2}+\dots +{\beta}_{p}\Delta {y}_{t-p}+{\epsilon}_{t}$$ against the alternative model $${y}_{t}=\varphi {y}_{t-1}+{\beta}_{1}\Delta {y}_{t-1}+{\beta}_{2}\Delta {y}_{t-2}+\dots +{\beta}_{p}\Delta {y}_{t-p}+{\epsilon}_{t},$$ with AR(1) coefficient, $$\varphi <1.$$ |

`'ARD'` | Autoregressive model with drift variant, which specifies a
test of the null model $${y}_{t}={y}_{t-1}+{\beta}_{1}\Delta {y}_{t-1}+{\beta}_{2}\Delta {y}_{t-2}+\dots +{\beta}_{p}\Delta {y}_{t-p}+{\epsilon}_{t}$$ against the alternative model $${y}_{t}=c+\varphi {y}_{t-1}+{\beta}_{1}\Delta {y}_{t-1}+{\beta}_{2}\Delta {y}_{t-2}+\dots +{\beta}_{p}\Delta {y}_{t-p}+{\epsilon}_{t},$$ with drift coefficient, |

`'TS'` | Trend-stationary model variant, which specifies a test of the
null model $${y}_{t}=c+{y}_{t-1}+{\beta}_{1}\Delta {y}_{t-1}+{\beta}_{2}\Delta {y}_{t-2}+\dots +{\beta}_{p}\Delta {y}_{t-p}+{\epsilon}_{t}$$ against the alternative model $${y}_{t}=c+\delta t+\varphi {y}_{t-1}+{\beta}_{1}\Delta {y}_{t-1}+{\beta}_{2}\Delta {y}_{t-2}+\dots +{\beta}_{p}\Delta {y}_{t-p}+{\epsilon}_{t},$$ with drift coefficient, |

**Example: **`'model',{'AR','ARD'}`

**Data Types: **`char`

| `cell`

`'test'`

— Test statistic`'t1'`

(default) | `'t2'`

| `'F'`

Test statistic, specified as the comma-separated pair consisting
of `'test'`

and `'t1'`

, `'t2'`

,
or `'F'`

. To conduct multiple tests using different
test statistics, use a cell array to specify the test statistic for
each test.

`'t1'` | Standard t statistic,$${t}_{1}=\raisebox{1ex}{$(\widehat{\varphi}-1)$}\!\left/ \!\raisebox{-1ex}{$se$}\right.,$$ computed using the OLS estimate of the AR(1) coefficient, $$\widehat{\varphi},$$ and its standard error ( The test assesses the significance of the restriction, $$\varphi -1=0.$$ |

`'t2'` | Lag-adjusted, unstudentized t statistic,$${t}_{2}=\raisebox{1ex}{$N(\widehat{\varphi}-1)$}\!\left/ \!\raisebox{-1ex}{$(1-{\widehat{\beta}}_{1}-\dots -{\widehat{\beta}}_{p})$}\right.,$$ computed using the OLS estimates of the AR(1) coefficient
and stationary coefficients in the alternative model. The test assesses the significance of the restriction, $$\varphi -1=0.$$ |

`'F'` | F statistic for assessing the significance
of a joint restriction on the alternative model.For model variant `'ARD'` , the restrictions are$$\varphi -1=0$$ and*c*= 0.For model variant `'TS'` , the restrictions are$$\varphi -1=0$$ and*δ*= 0.
An |

**Example: **`'test',{'t2','F'}`

**Data Types: **`char`

| `cell`

`h`

— Test rejection decisionslogical | vector of logicalsTest rejection decisions, returned as a logical value or vector of logical values with length equal to the number of tests conducted.

`h = 1`

indicates rejection of the unit-root null in favor of the alternative model.`h = 0`

indicates failure to reject the unit-root null.

`pValue`

— Test statistic p-valuesscalar | vectorTest statistic p-values, returned as a scalar or vector with length equal to the number of tests conducted.

If the test statistic is

`'t1'`

or`'t2'`

, then the p-values are left-tail probabilities.If the test statistic is

`'F'`

, then the p-values are right-tail probabilities.

`stat`

— Test statisticsscalar | vectorTest statistics, returned as a scalar or vector with length
equal to the number of tests conducted. `adftest`

computes
test statistics using ordinary least squares (OLS) estimates of the
coefficients in the alternative model.

`cValue`

— Critical valuesscalar | vectorCritical values, returned as a scalar or vector with length equal to the number of tests conducted.

If the test statistic is

`'t1'`

or`'t2'`

, then the critical values are for left-tail probabilities.If the test statistic is

`'F'`

, then the critical values are for right-tail probabilities.

`reg`

— Regression statisticsdata structure | data structure arrayRegression statistics for ordinary least squares (OLS) estimation of coefficients in the alternative model, returned as a data structure or data structure array with length equal to the number of tests conducted.

Each data structure has the following fields.

Field | Description |
---|---|

`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 |

`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` | R^{2} statistic |

`aRSq` | Adjusted R^{2} statistic |

`LL` | Loglikelihood of data under Gaussian innovations |

`AIC` | Akaike information criterion |

`BIC` | Bayesian (Schwarz) information criterion |

`HQC` | Hannan-Quinn information criterion |

The *Augmented Dickey-Fuller test
for a unit root* assesses the null hypothesis of a unit
root using the model

$${y}_{t}=c+\delta t+\varphi {y}_{t-1}+{\beta}_{1}\Delta {y}_{t-1}+\dots +{\beta}_{p}\Delta {y}_{t-p}+{\epsilon}_{t},$$

where

Δ is the differencing operator, such that $$\Delta {y}_{t}={y}_{t}-{y}_{t-1}.$$

The number of lagged difference terms,

*p*, is user specified.*ε*is a mean zero innovation process._{t}

The null hypothesis of a unit root is

$${H}_{0}:\varphi =1.$$

Under the alternative hypothesis, $$\varphi <1.$$

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

A test that fails to reject the null hypothesis, fails to reject the possibility of a unit root.

`adftest`

performs ordinary least squares (OLS) regression to estimate the coefficients in the alternative model.Dickey-Fuller statistics follow nonstandard distributions under the null hypothesis (even asymptotically). Critical values for a range of sample sizes and significance levels have been tabulated using Monte Carlo simulations of the null model with Gaussian innovations, with five million replications per sample size.

For small samples, the tabulated critical values are only valid for Gaussian innovations. For large samples, the tabulated values are still valid for non-Gaussian innovations.

`adftest`

interpolates critical values and p-values from the tables. The tables for test types`'t1'`

and`'t2'`

are identical to those for`pptest`

.

`i10test`

| `kpsstest`

| `lmctest`

| `pptest`

| `vratiotest`

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Was this topic helpful?

You can also select a location from the following list:

- Canada (English)
- United States (English)

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)