naginterfaces.library.stat.prob_dickey_fuller_unit¶
- naginterfaces.library.stat.prob_dickey_fuller_unit(ts_type, n, ts, method=1, nsamp=100000, statecomm=None)[source]¶
prob_dickey_fuller_unit
returns the probability associated with the lower tail of the distribution for the Dickey–Fuller unit root test statistic.For full information please refer to the NAG Library document for g01ew
https://www.nag.com/numeric/nl/nagdoc_28.4/flhtml/g01/g01ewf.html
- Parameters
- ts_typeint
The type of test statistic, supplied in .
- nint
, the length of the time series used to calculate the test statistic.
- tsfloat
The Dickey–Fuller test statistic for which the probability is required. If
must contain .
must contain .
must contain .
If the test statistic was calculated using
tsa.uni_dickey_fuller_unit
the value of and must not change between calls totsa.uni_dickey_fuller_unit
andprob_dickey_fuller_unit
.- methodint, optional
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.
- nsampint, optional
If , the number of samples used in the simulation; otherwise is not referenced and need not be set.
- statecommNone or dict, RNG communication object, optional, modified in place
RNG communication structure.
When , this argument must have been initialized by a prior call to
rand.init_repeat
orrand.init_nonrepeat
.
- Returns
- pintfloat
The probability associated with the lower tail of the distribution for the (augmented) Dickey–Fuller unit root test statistic supplied in .
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: , or .
- (errno )
On entry, .
Constraint: , or .
- (errno )
On entry, .
Constraint: if , .
- (errno )
On entry, .
Constraint: if and , .
- (errno )
On entry, .
Constraint: if and , .
- (errno )
On entry, .
Constraint: if and , .
- (errno )
On entry, .
Constraint: if , .
- (errno )
On entry, and the [‘state’] vector has been corrupted or not initialized.
- Warns
- NagAlgorithmicWarning
- (errno )
The supplied input values were outside the range of at least one look-up table, therefore, extrapolation was used.
- Notes
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.
prob_dickey_fuller_unit
is designed to be called aftertsa.uni_dickey_fuller_unit
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: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.
To test for a unit root with drift the regression model
is fit and the test statistic constructed as
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
tsa.uni_dickey_fuller_unit
.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
prob_dickey_fuller_unit
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 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