NAG FL Interface
g13awf (uni_​dickey_​fuller_​unit)

1 Purpose

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

2 Specification

Fortran Interface
Function g13awf ( type, p, n, y, ifail)
Real (Kind=nag_wp) :: g13awf
Integer, Intent (In) :: type, p, n
Integer, Intent (Inout) :: ifail
Real (Kind=nag_wp), Intent (In) :: y(n)
C Header Interface
#include <nag.h>
double  g13awf_ (const Integer *typ, const Integer *p, const Integer *n, const double y[], Integer *ifail)
The routine may be called by the names g13awf or nagf_tsa_uni_dickey_fuller_unit.

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 fitted 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 Arguments

1: type Integer Input
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 Integer Input
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 Integer Input
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) array Input
On entry: y, the time series.
5: ifail Integer Input/Output
On entry: ifail must be set to 0, -1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of -1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value -1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. 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:
  • if type=1, n>2p;
  • if type=2, n>2p+1;
  • if type=3, n>2p+2.
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 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

g13awf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g13awf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

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)