G13AWF (PDF version)
G13 Chapter Contents
G13 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

G13AWF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

G13AWF returns the (augmented) Dickey–Fuller unit root test.

2  Specification

FUNCTION G13AWF ( TYPE, P, N, Y, IFAIL)
REAL (KIND=nag_wp) G13AWF
INTEGER  TYPE, P, N, IFAIL
REAL (KIND=nag_wp)  Y(N)

3  Description

If the root of the characteristic equation for a time series is one then that series is said to have a unit root. Such series are nonstationary. G13AWF returns one of three types of (augmented) Dickey–Fuller test statistic: τ, τμ or ττ, used to test for a unit root, a unit root with drift or a unit root with drift and a deterministic time trend, respectively.
To test whether a time series, yt, for t=1,2,,n, has a unit root the regression model
yt = β1 yt-1 + i=1 p-1 δi yt-i +εt  
is fit and the test statistic τ constructed as
τ = β^1 σ11  
where  is the difference operator, with yt = yt- yt-1 , and where β^1 and σ11 are the least squares estimate and associated standard error for β1 respectively.
To test for a unit root with drift the regression model
yt = β1 yt-1 + i=1 p-1 δi yt-i +α +εt  
is fit and the test statistic τμ constructed as
τμ = β^1 σ11  
To test for a unit root with drift and deterministic time trend the regression model
yt = β1 yt-1 + i=1 p-1 δi yt-i +α +β2t +εt  
is fit and the test statistic ττ constructed as
ττ = β^1 σ11  
The distributions of the three test statistics; τ, τμ and ττ, are nonstandard. An associated probability can be obtained from G01EWF.

4  References

Dickey A D (1976) Estimation and hypothesis testing in nonstationary time series PhD Thesis Iowa State University, Ames, Iowa
Dickey A D and Fuller W A (1979) Distribution of the estimators for autoregressive time series with a unit root J. Am. Stat. Assoc. 74 366 427–431

5  Parameters

1:     TYPE – INTEGERInput
On entry: the type of unit test for which the probability is required.
TYPE=1
A unit root test will be performed and τ returned.
TYPE=2
A unit root test with drift will be performed and τμ returned.
TYPE=3
A unit root test with drift and deterministic time trend will be performed and ττ returned.
Constraint: TYPE=1, 2 or 3.
2:     P – INTEGERInput
On entry: p, the degree of the autoregressive (AR) component of the Dickey–Fuller test statistic. When p>1 the test is usually referred to as the augmented Dickey–Fuller test.
Constraint: P>0.
3:     N – INTEGERInput
On entry: n, the length of the time series.
Constraints:
  • if TYPE=1, N>2P;
  • if TYPE=2, N>2P+1;
  • if TYPE=3, N>2P+2.
4:     YN – REAL (KIND=nag_wp) arrayInput
On entry: y, the time series.
5:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
IFAIL=11
On entry, TYPE=value.
Constraint: TYPE=1, 2 or 3.
IFAIL=21
On entry, P=value.
Constraint: P>0.
IFAIL=31
On entry, N=value.
Constraint: N>value.
IFAIL=41
On entry, the design matrix used in the estimation of β1 is not of full rank, this is usually due to all elements of the series being virtually identical. The returned statistic is therefore not unique and likely to be meaningless.
IFAIL=42
σ11=0, therefore depending on the sign of β^1, a large positive or negative value has been returned.
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.8 in the Essential Introduction for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
IFAIL=-999
Dynamic memory allocation failed.
See Section 3.6 in the Essential Introduction for further information.

7  Accuracy

None.

8  Parallelism and Performance

Not applicable.

9  Further Comments

None.

10  Example

In this example a Dickey–Fuller unit root test is applied to a time series related to the rate of the earth's rotation about its polar axis.

10.1  Program Text

Program Text (g13awfe.f90)

10.2  Program Data

Program Data (g13awfe.d)

10.3  Program Results

Program Results (g13awfe.r)


G13AWF (PDF version)
G13 Chapter Contents
G13 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2015