naginterfaces.library.tsa.uni_autocorr_part¶
- naginterfaces.library.tsa.uni_autocorr_part(r, nl)[source]¶
uni_autocorr_part
calculates partial autocorrelation coefficients given a set of autocorrelation coefficients. It also calculates the predictor error variance ratios for increasing order of finite lag autoregressive predictor, and the autoregressive parameters associated with the predictor of maximum order.For full information please refer to the NAG Library document for g13ac
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g13/g13acf.html
- Parameters
- rfloat, array-like, shape
The autocorrelation coefficient relating to lag , for .
- nlint
, the number of partial autocorrelation coefficients required.
- Returns
- pfloat, ndarray, shape
contains the partial autocorrelation coefficient at lag , , for .
- vfloat, ndarray, shape
contains the predictor error variance ratio , for .
- arfloat, ndarray, shape
The autoregressive parameters of maximum order, i.e., if no exception or warning is raised, or if = 3, for .
- nvlint
The number of valid values in each of , and . Thus in the case of premature termination at iteration (see Notes), is returned as .
- Raises
- NagValueError
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, the autocorrelation coefficient of lag has absolute value greater than or equal to .
- Warns
- NagAlgorithmicWarning
- (errno )
The autocorrelation coefficients do not form a positive definite sequence.
- Notes
In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.
The data consist of values of autocorrelation coefficients , relating to lags . These will generally (but not necessarily) be sample values such as may be obtained from a time series using
uni_autocorr()
.The partial autocorrelation coefficient at lag may be identified with the parameter in the autoregression
where is the predictor error.
The first subscript of and emphasizes the fact that the parameters will in general alter as further terms are introduced into the equation (i.e., as is increased).
The parameters are determined from the autocorrelation coefficients by the Yule–Walker equations
taking when , and .
The predictor error variance ratio is defined by
The above sets of equations are solved by a recursive method (the Durbin–Levinson algorithm). The recursive cycle applied for , where is the number of partial autocorrelation coefficients required, is initialized by setting and .
Then
If the condition occurs, say when , it indicates that the supplied autocorrelation coefficients do not form a positive definite sequence (see Hannan (1960)), and the recursion is not continued. The autoregressive parameters are overwritten at each recursive step, so that upon completion the only available values are , for , or if the recursion has been prematurely halted.
- References
Box, G E P and Jenkins, G M, 1976, Time Series Analysis: Forecasting and Control, (Revised Edition), Holden–Day
Durbin, J, 1960, The fitting of time series models, Rev. Inst. Internat. Stat. (28), 233
Hannan, E J, 1960, Time Series Analysis, Methuen