PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_stat_prob_dickey_fuller_unit (g01ew)
Purpose
nag_stat_prob_dickey_fuller_unit (g01ew) returns the probability associated with the lower tail of the distribution for the Dickey–Fuller unit root test statistic.
Syntax
[
pvalue,
state,
ifail] = g01ew(
type,
n,
ts, 'method',
method, 'nsamp',
nsamp, 'state',
state)
[
pvalue,
state,
ifail] = nag_stat_prob_dickey_fuller_unit(
type,
n,
ts, 'method',
method, 'nsamp',
nsamp, 'state',
state)
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.
nag_stat_prob_dickey_fuller_unit (g01ew) is designed to be called after
nag_tsa_uni_dickey_fuller_unit (g13aw) and returns the probability associated with 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. The three types of test statistic are constructed as follows:
1. |
To test whether a time series, , for , has a unit root the regression model
is fit and the test statistic constructed as
where is the difference operator, with , and where and are the least squares estimate and associated standard error for respectively. |
2. |
To test for a unit root with drift the regression model
is fit and the test statistic constructed as
|
3. |
To test for a unit root with drift and deterministic time trend the regression model
is fit and the test statistic constructed as
|
All three test statistics:
,
and
can be calculated using
nag_tsa_uni_dickey_fuller_unit (g13aw).
The probability distributions of these statistics are nonstandard and are a function of the length of the series of interest,
. The probability associated with a given test statistic, for a given
, can therefore only be calculated by simulation as described in
Dickey and Fuller (1979). However, such simulations require a significant number of iterations and are therefore prohibitively expensive in terms of the time taken. As such
nag_stat_prob_dickey_fuller_unit (g01ew) also allows the probability to be interpolated from a look-up table. Two such tables are provided, one from
Dickey (1976) and one constructed as described in
Further Comments. The three different methods of obtaining an estimate of the probability can be chosen via the
method argument. Unless there is a specific reason for choosing otherwise,
should be used.
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
Parameters
Compulsory Input Parameters
- 1:
– int64int32nag_int scalar
-
The type of test statistic, supplied in
ts.
Constraint:
, or .
- 2:
– int64int32nag_int scalar
-
, the length of the time series used to calculate the test statistic.
Constraints:
- if , ;
- if and , ;
- if and , ;
- if and , .
- 3:
– double scalar
-
The Dickey–Fuller test statistic for which the probability is required. If
- ts must contain .
- ts must contain .
- ts must contain .
If the test statistic was calculated using
nag_tsa_uni_dickey_fuller_unit (g13aw) the value of
type and
n must not change between calls to
nag_stat_prob_dickey_fuller_unit (g01ew) and
nag_tsa_uni_dickey_fuller_unit (g13aw).
Optional Input Parameters
- 1:
– int64int32nag_int scalar
Default:
The method used to calculate the probability.
- The probability is interpolated from a look-up table, whose values were obtained via simulation.
- The probability is interpolated from a look-up table, whose values were obtained from Dickey (1976).
- The probability is obtained via simulation.
The probability calculated from the look-up table should give sufficient accuracy for most applications.
Constraint:
, or .
- 2:
– int64int32nag_int scalar
Default:
If
, the number of samples used in the simulation; otherwise
nsamp is not referenced and need not be set.
Constraint:
if , .
- 3:
– int64int32nag_int array
-
If
,
state must contain information on the selected base generator and its current state; otherwise
state is not referenced and need not be set.
Output Parameters
- 1:
– double scalar
-
- 2:
– int64int32nag_int array
-
If
,
state contains updated information on the state of the generator otherwise a zero length vector is returned.
- 3:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
-
-
Constraint: , or .
-
-
Constraint: , or .
-
-
Constraint: if , .
Constraint: if and , .
Constraint: if and , .
Constraint: if and , .
-
-
Constraint: if , .
-
-
On entry,
and the
state vector has been corrupted or not initialized.
- W
-
The supplied input values were outside the range of at least one look-up table, therefore extrapolation was used.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
When
, the probability returned by this function is unlikely to be accurate to more than
or
decimal places, for
this accuracy is likely to drop to
or
decimal places (see
Further Comments for details on how these probabilities are constructed). In both cases the accuracy of the probability is likely to be lower when extrapolation is used, particularly for small values of
n (less than around
). When
the accuracy of the returned probability is controlled by the number of simulations performed (i.e., the value of
nsamp used).
Further Comments
When
or
the probability returned is constructed by interpolating from a series of look-up tables. In the case of
the look-up tables are taken directly from
Dickey (1976) and the interpolation is carried out using
nag_interp_2d_scat (e01sa)
and
nag_interp_2d_scat_eval (e01sb)
.
For
the look-up tables were constructed as follows:
(i) |
A sample size, was chosen. |
(ii) |
simulations were run. |
(iii) |
At each simulation, a time series was constructed as described in chapter five of Dickey (1976). The relevant test statistic was then calculated for each of these time series. |
(iv) |
A series of quantiles were calculated from the sample of test statistics. The quantiles were calculated at intervals of between and . |
(v) |
A spline was fit to the quantiles using nag_fit_1dspline_auto (e02be). |
This process was repeated for , resulting in splines.
Given the
splines, and a user-supplied sample size,
and test statistic,
, an estimated
-value is calculated as follows:
Example
See
Example in
nag_tsa_uni_dickey_fuller_unit (g13aw).
Open in the MATLAB editor:
g01ew_example
function g01ew_example
fprintf('g01ew example results\n\n');
type = int64(1);
p = int64(1);
y = [ -217; -177; -166; -136; -110; -95; -64; -37; -14; -25;
-51; -62; -73; -88; -113; -120; -83; -33; -19; 21;
17; 44; 44; 78; 88; 122; 126; 114; 85; 64];
[ts,ifail] = g13aw(type,p,y);
warn_state = nag_issue_warnings();
nag_issue_warnings(true);
n = int64(size(y,1));
[pvalue,~,ifail] = g01ew(type,n,ts);
nag_issue_warnings(warn_state);
fprintf('Dickey-Fuller test statistic = %6.3f\n', ts);
fprintf('associated p-value = %6.3f\n', pvalue);
g01ew example results
Dickey-Fuller test statistic = -2.540
associated p-value = 0.013
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015