NAG Library Chapter Introduction
G13 – Time Series Analysis
1 Scope of the Chapter
This chapter provides facilities for investigating and modelling the statistical structure of series of observations collected at points in time. The models may then be used to forecast the series.
The chapter covers the following models and approaches.
||Univariate time series analysis, including autocorrelation functions and autoregressive moving average (ARMA) models.
||Univariate spectral analysis.
||Transfer function (multi-input) modelling, in which one time series is dependent on other time series.
||Bivariate spectral methods including coherency, gain and input response functions.
|| Vector ARMA models for multivariate time series.
||Kalman filter models (linear and nonlinear).
||GARCH models for volatility.
||Inhomogeneous Time Series.
2 Background to the Problems
2.1 Univariate Analysis
Let the given time series be
is its length. The structure which is intended to be investigated, and which may be most evident to the eye in a graph of the series, can be broadly described as:
||trends, linear or possibly higher-order polynomial;
||seasonal patterns, associated with fixed integer seasonal periods. The presence of such seasonality and the period will normally be known a priori. The pattern may be fixed, or slowly varying from one season to another;
||cycles or waves of stable amplitude and period (from peak to peak). The period is not necessarily integer, the corresponding absolute frequency (cycles/time unit) being and angular frequency . The cycle may be of pure sinusoidal form like , or the presence of higher harmonic terms may be indicated, e.g., by asymmetry in the wave form;
||quasi-cycles, i.e., waves of fluctuating period and amplitude; and
||irregular statistical fluctuations and swings about the overall mean or trend.
Trends, seasonal patterns, and cycles might be regarded as deterministic components following fixed mathematical equations, and the quasi-cycles and other statistical fluctuations as stochastic and describable by short-term correlation structure. For a finite dataset it is not always easy to discriminate between these two types, and a common description using the class of autoregressive integrated moving-average (ARIMA) models is now widely used. The form of these models is that of difference equations (or recurrence relations) relating present and past values of the series. You are referred to Box and Jenkins (1976)
for a thorough account of these models and how to use them. We follow their notation and outline the recommended steps in ARIMA model building for which routines are available.
If the variance of the observations in the series is not constant across the range of observations it may be useful to apply a variance-stabilizing transformation to the series. A common situation is for the variance to increase with the magnitude of the observations and in this case typical transformations used are the log or square root transformation. A range-mean plot or standard deviation-mean plot provides a quick and easy way of detecting non-constant variance and of choosing, if required, a suitable transformation. These are plots of either the range or standard deviation of successive groups of observations against their means.
2.1.2 Differencing operations
These may be used to simplify the structure of a time series.
First-order differencing, i.e., forming the new series
will remove a linear trend. First-order seasonal differencing
eliminates a fixed seasonal pattern.
These operations reflect the fact that it is often appropriate to model a time series in terms of changes from one value to another. Differencing is also therefore appropriate when the series has something of the nature of a random walk, which is by definition the accumulation of independent changes.
Differencing may be applied repeatedly to a series, giving
are the orders of differencing. The derived series
will be shorter, of length
, and extend for
2.1.3 Sample autocorrelations
Given that a series has (possibly as a result of simplifying by differencing operations) a homogeneous appearance throughout its length, fluctuating with approximately constant variance about an overall mean level, it is appropriate to assume that its statistical properties are stationary. For most purposes the correlations between terms or separated by lag give an adequate description of the statistical structure and are estimated by the sample autocorrelation function (ACF) , for .
As described by Box and Jenkins (1976)
, these may be used to indicate which particular ARIMA model may be appropriate.
2.1.4 Partial autocorrelations
The information in the autocorrelations, , may be presented in a different light by deriving from them the coefficients of the partial autocorrelation function (PACF) , for . which measures the correlation between and conditional upon the intermediate values . The corresponding sample values give further assistance in the selection of ARIMA models.
Both autocorrelation function (ACF) and PACF may be rapidly computed, particularly in comparison with the time taken to estimate ARIMA models.
2.1.5 Finite lag predictor coefficients and error variances
The partial autocorrelation coefficient
is determined as the final parameter in the minimum variance predictor of
in terms of
is the prediction error, and the first subscript
emphasizes the fact that the parameters will alter as
increases. Moderately good estimates
are obtained from the sample autocorrelation function (ACF), and after calculating the partial autocorrelation function (PACF) up to lag
, the successive values
of the prediction error variance estimates,
, are available, together with the final values of the coefficients
has nonzero mean,
, it is adequate to use
in place of
in the prediction equation.
Although Box and Jenkins (1976)
do not place great emphasis on these prediction coefficients, their use is advocated for example by Akaike (1971)
, who recommends selecting an optimal order of the predictor as the lag for which the final prediction error (FPE) criterion
is a minimum.
2.1.6 ARIMA models
The correlation structure in stationary time series may often be represented by a model with a small number of parameters belonging to the autoregressive moving-average (ARMA) class. If the stationary series
has been derived by differencing from the original series
is said to follow an ARIMA model. Taking
, the (non-seasonal) ARIMA
, represents the structure of
by the equation
is an uncorrelated series (white noise) with mean
and constant variance
has a nonzero mean
, then this is allowed for by replacing
in the model. Although
is often estimated by the sample mean of
this is not always optimal.
A series generated by this model will only be stationary provided restrictions are placed on
to avoid unstable growth of
. These are called stationarity constraints. The series
may also be usefully interpreted as the linear innovations in
), i.e., the error if
were to be predicted using the information in all past values
, provided also that
satisfy invertibility constraints. This allows the series
to be regenerated by rewriting the model equation as
For a series with short-term correlation only, i.e.,
is not significant beyond some low lag
(see Box and Jenkins (1976)
for the statistical test), then the pure moving-average model
is appropriate, with no autoregressive parameters, i.e.,
Autoregressive parameters are appropriate when the autocorrelation function (ACF) pattern decays geometrically, or with a damped sinusoidal pattern which is associated with quasi-periodic behaviour in the series. If the sample partial autocorrelation function (PACF) is significant only up to some low lag , then a pure autoregressive model is appropriate, with . Otherwise moving-average terms will need to be introduced, as well as autoregressive terms.
The seasonal ARIMA
model allows for correlation at lags which are multiples of the seasonal period
, the series is represented in a two-stage manner via an intermediate series
are the seasonal parameters and
are the corresponding orders. Again,
may be replaced by
2.1.7 ARIMA model estimation
In theory, the parameters of an ARIMA model are determined by a sufficient number of autocorrelations . Using the sample values in their place it is usually (but not always) possible to solve for the corresponding ARIMA parameters.
These are rapidly computed but are not fully efficient estimates, particularly if moving-average parameters are present. They do provide useful preliminary values for an efficient but relatively slow iterative method of estimation. This is based on the least squares principle by which parameters are chosen to minimize the sum of squares of the innovations
, which are regenerated from the data using (2)
, or the reverse of (3)
in the case of seasonal models.
Lack of knowledge of terms on the right-hand side of (2)
, is overcome by introducing
unknown series values
which are estimated as nuisance parameters, and using correction for transient errors due to the autoregressive terms. If the data
is viewed as a single sample from a multivariate Normal density whose covariance matrix
is a function of the ARIMA model parameters, then the exact likelihood of the parameters is
The least squares criterion as outlined above is equivalent to using the quadratic form
as an objective function to be minimized. Neglecting the term
yields estimates which differ very little from the exact likelihood except in small samples, or in seasonal models with a small number of whole seasons contained in the data. In these cases bias in moving-average parameters may cause them to stick at the boundary of their constraint region, resulting in failure of the estimation method.
Approximate standard errors of the parameter estimates and the correlations between them are available after estimation.
The model residuals, , are the innovations resulting from the estimation and are usually examined for the presence of autocorrelation as a check on the adequacy of the model.
2.1.8 ARIMA model forecasting
An ARIMA model is particularly suited to extrapolation of a time series. The model equations are simply used for replacing the unknown future values of by zero. This produces future values of , and if differencing has been used this process is reversed (the so-called integration part of ARIMA models) to construct future values of .
Forecast error limits are easily deduced.
This process requires knowledge only of the model orders and parameters together with a limited set of the terms
which appear on the right-hand side of the models (3)
(and the differencing equations) when
. It does not require knowledge of the whole series.
We call this the state set. It is conveniently constituted after model estimation. Moreover, if new observations come to hand, then the model equations can easily be used to update the state set before constructing forecasts from the end of the new observations. This is particularly useful when forecasts are constructed on a regular basis. The new innovations may be compared with the residual standard deviation, , of the model used for forecasting, as a check that the model is continuing to forecast adequately.
2.1.9 Exponential smoothing
Exponential smoothing is a relatively simple method of short term forecasting for a time series. A variety of different smoothing methods are possible, including; single exponential, Brown's double exponential, linear Holt (also called double exponential smoothing in some references), additive Holt–Winters and multiplicative Holt–Winters. The choice of smoothing method used depends on the characteristics of the time series. If the mean of the series is only slowly changing then single exponential smoothing may be suitable. If there is a trend in the time series, which itself may be slowly changing, then linear Holt smoothing may be suitable. If there is a seasonal component to the time series, e.g., daily or monthly data, then one of the two Holt–Winters methods may be suitable.
For a time series
, the five smoothing functions are defined by the following:
- Single Exponential Smoothing
- Brown Double Exponential Smoothing
- Linear Holt Smoothing
- Additive Holt–Winters Smoothing
- Multiplicative Holt–Winters Smoothing
and is defined as in the additive Holt–Winters smoothing,
is the mean,
is the trend and
is the seasonal component at time
being the seasonal order. The
-step ahead forecasts are given by
and their variances by
. The term
is estimated as the mean deviation.
The parameters, , and control the amount of smoothing. The nearer these parameters are to one, the greater the emphasis on the current data point. Generally these parameters take values in the range to . The linear Holt and two Holt–Winters smoothers include an additional parameter, , which acts as a trend dampener. For the trend is dampened and for the forecast function has an exponential trend, removes the trend term from the forecast function and does not dampen the trend.
For all methods, values for , , and can be chosen by trying different values and then visually comparing the results by plotting the fitted values along side the original data. Alternatively, for single exponential smoothing a suitable value for can be obtained by fitting an model. For Brown's double exponential smoothing and linear Holt smoothing with no dampening, (i.e., ), suitable values for and, in the case of linear Holt smoothing, can be obtained by fitting an model. Similarly, the linear Holt method, with , can be expressed as an model and the additive Holt–Winters, with no dampening, (), can be expressed as a seasonal ARIMA model with order of the form . There is no similar procedure for obtaining parameter values for the multiplicative Holt–Winters method, or the additive Holt–Winters method with . In these cases parameters could be selected by minimizing a measure of fit using nonlinear optimization.
2.1.10 Change point analysis
Given a time series , a change point is a place or time point such that segment of the series up to , , follows one distribution and the segment after , , follows a different distribution. This idea can be extended to change points, in which case becomes a vector of ordered (strictly monotonic increasing) change points with and . The th segment therefore consists of where, for ease of notation, we define . A change point problem is therefore twofold: estimating the number of change points (and hence the number of segments) and estimating the location of those change points.
Given a cost function,
one formulation of the change point problem can be expressed as the solution to:
is a penalty term used to control the number of change points. Two methods of solving equation (5)
are available: the PELT algorithm and binary segmentation. The Pruned Exact Linear Time (PELT) algorithm of Killick et al. (2012)
is a tree based method which is guaranteed to return the optimal solution to (5)
as long as there exists a constant
. Unlike PELT, binary segmentation is an iterative method that only results in an approximate solution to (5)
. A description of the binary segmentation algorithm can be found in Section 3 in G13NDF
2.2 Univariate Spectral Analysis
In describing a time series using spectral analysis the fundamental components are taken to be sinusoidal waves of the form
, which for a given angular frequency
, is specified by its amplitude
. Thus in a time series of
observations it is not possible to distinguish more than
independent sinusoidal components. The frequency range
is limited to the shortest wavelength of two sampling units because any wave of higher frequency is indistinguishable upon sampling (or is aliased with) a wave within this range. Spectral analysis follows the idea that for a series made up of a finite number of sine waves the amplitude of any component at frequency
is given to order
2.2.1 The sample spectrum
For a series
this is defined as
the scaling factor now being chosen in order that
i.e., the spectrum indicates how the sample variance (
) of the series is distributed over components in the frequency range
It may be demonstrated that
is equivalently defined in terms of the sample ACF
of the series as
are the sample autocovariance coefficients.
If the series does contain a deterministic sinusoidal component of amplitude , this will be revealed in the sample spectrum as a sharp peak of approximate width and height . This is called the discrete part of the spectrum, the variance associated with this component being in effect concentrated at a single frequency.
If the series
has no deterministic components, i.e., is purely stochastic being stationary with autocorrelation function (ACF)
, then with increasing sample size the expected value of
converges to the theoretical spectrum – the continuous part
are the theoretical autocovariances.
The sample spectrum does not however converge to this value but at each frequency point fluctuates about the theoretical spectrum with an exponential distribution, being independent at frequencies separated by an interval of or more. Various devices are therefore employed to smooth the sample spectrum and reduce its variability. Much of the strength of spectral analysis derives from the fact that the error limits are multiplicative so that features may still show up as significant in a part of the spectrum which has a generally low level, whereas they are completely masked by other components in the original series. The spectrum can help to distinguish deterministic cyclical components from the stochastic quasi-cycle components which produce a broader peak in the spectrum. (The deterministic components can be removed by regression and the remaining part represented by an ARIMA model.)
A large discrete component in a spectrum can distort the continuous part over a large frequency range surrounding the corresponding peak. This may be alleviated at the cost of slightly broadening the peak by tapering a portion of the data at each end of the series with weights which decay smoothly to zero. It is usual to correct for the mean of the series and for any linear trend by simple regression, since they would similarly distort the spectrum.
2.2.2 Spectral smoothing by lag window
The estimate is calculated directly from the sample autocovariances
the smoothing being induced by the lag window weights
which extend up to a truncation lag
which is generally much less than
. The smaller the value of
, the greater the degree of smoothing, the spectrum estimates being independent only at a wider frequency separation indicated by the bandwidth
which is proportional to
. It is wise, however, to calculate the spectrum at intervals appreciably less than this. Although greater smoothing narrows the error limits, it can also distort the spectrum, particularly by flattening peaks and filling in troughs.
2.2.3 Direct spectral smoothing
The unsmoothed sample spectrum is calculated for a fine division of frequencies, then averaged over intervals centred on each frequency point for which the smoothed spectrum is required. This is usually at a coarser frequency division. The bandwidth corresponds to the width of the averaging interval.
2.3 Linear Lagged Relationships Between Time Series
We now consider the context in which one time series, called the dependent or output series,
, is believed to depend on one or more explanatory or input series, e.g.,
. This dependency may follow a simple linear regression, e.g.,
or more generally may involve lagged values of the input
is called the impulse response function (IRF) of the relationship. The term
represents that part of
which cannot be explained by the input, and it is assumed to follow a univariate ARIMA model. We call
the (output) noise component of
, and it includes any constant term in the relationship. It is assumed that the input series,
, and the noise component,
, are independent.
The part of
which is explained by the input is called the input component
The eventual aim is to model both these components of
on the basis of observations of
. In applications to forecasting or control both components are important. In general there may be more than one input series, e.g.,
, which are assumed to be independent and corresponding components
2.3.1 Transfer function models
In a similar manner to that in which the structure of a univariate series may be represented by a finite-parameter ARIMA model, the structure of an input component may be represented by a transfer function (TF) model with delay time
this represents an impulse response function (IRF) which is infinite in extent and decays with geometric and/or sinusoidal behaviour. The parameters
are constrained to satisfy a stability condition identical to the stationarity condition of autoregressive models. There is no constraint on
An important tool for investigating how an input series
affects an output series
is the sample cross-correlation function (CCF)
between the series. If
are (jointly) stationary time series this is an estimator of the theoretical quantity
, is distinct from
, though it is possible to interpret
When the series
are believed to be related by a transfer function (TF) model, the CCF is determined by the impulse response function (IRF)
and the autocorrelation function (ACF) of the input
In the particular case when
is an uncorrelated series or white noise (and is uncorrelated with any other inputs):
and the sample CCF can provide an estimate of
are the sample standard deviations of
In theory the IRF coefficients determine the parameters in the TF model, and using to estimate it is possible to solve for preliminary estimates of , .
2.3.3 Prewhitening or filtering by an ARIMA model
In general an input series
is not white noise, but may be represented by an ARIMA model with innovations or residuals
which are white noise. If precisely the same operations by which
is generated from
are applied to the output
to produce a series
, then the transfer function relationship between
is preserved between
. It is then possible to estimate
The procedure of generating
) is called prewhitening or filtering by an ARIMA model. Although
is necessarily white noise, this is not generally true of
2.3.4 Multi-input model estimation
The term multi-input model is used for the situation when one output series
is related to one or more input series
, as described in Section 2.3
. If for a given input the relationship is a simple linear regression, it is called a simple input; otherwise it is a transfer function input. The error or noise term follows an ARIMA model.
Given that the orders of all the transfer function models and the ARIMA model of a multi-input model have been specified, the various parameters in those models may be (simultaneously) estimated.
The procedure used is closely related to the least squares principle applied to the innovations in the ARIMA noise model.
The innovations are derived for any proposed set of parameter values by calculating the response of each input to the transfer functions and then evaluating the noise
as the difference between this response (combined for all the inputs) and the output. The innovations are derived from the noise using the ARIMA model in the same manner as for a univariate series, and as described in Section 2.1.6
In estimating the parameters, consideration has to be given to the lagged terms in the various model equations which are associated with times prior to the observation period, and are therefore unknown. The subroutine descriptions provide the necessary detail as to how this problem is treated.
Also, as described in Section 2.1.7
the sum of squares criterion
is related to the quadratic form in the exact log-likelihood of the parameters:
is the vector of appropriately differenced noise terms, and
is the innovation variance parameter.
The least squares criterion is therefore identical to minimization of the quadratic form, but is not identical to exact likelihood. Because
may be expressed as
is a function of the ARIMA model parameters, substitution of
by its maximum likelihood (ML) estimator yields a concentrated (or profile) likelihood which is a function of
is the length of the differenced noise series
Use of the above quantity, called the deviance, , as an objective function is preferable to the use of alone, on the grounds that it is equivalent to exact likelihood, and yields estimates with better properties. However, there is an appreciable computational penalty in calculating , and in large samples it differs very little from , except in the important case of seasonal ARIMA models where the number of whole seasons within the data length must also be large.
You are given the option of taking the objective function to be either or , or a third possibility, the marginal likelihood. This is similar to exact likelihood but can counteract bias in the ARIMA model due to the fitting of a large number of simple inputs.
Approximate standard errors of the parameter estimates and the correlations between them are available after estimation.
The model residuals are the innovations resulting from the estimation, and they are usually examined for the presence of either autocorrelation or cross-correlation with the inputs. Absence of such correlation provides some confirmation of the adequacy of the model.
2.3.5 Multi-input model forecasting
A multi-input model may be used to forecast the output series provided future values (possibly forecasts) of the input series are supplied.
Construction of the forecasts requires knowledge only of the model orders and parameters, together with a limited set of the most recent variables which appear in the model equations. This is called the state set. It is conveniently constituted after model estimation. Moreover, if new observations of the output series and of (all) the independent input series become available, then the model equations can easily be used to update the state set before constructing forecasts from the end of the new observations. The new innovations generated in this updating may be used to monitor the continuing adequacy of the model.
2.3.6 Transfer function model filtering
In many time series applications it is desired to calculate the response (or output) of a transfer function (TF) model for a given input series.
Smoothing, detrending, and seasonal adjustment are typical applications. You must specify the orders and parameters of a TF model for the purpose being considered. This may then be applied to the input series.
Again, problems may arise due to ignorance of the input series values prior to the observation period. The transient errors which can arise from this may be substantially reduced by using ‘backforecasts’ of these unknown observations.
2.4 Multivariate Time Series
Multi-input modelling represents one output time series in terms of one or more input series. Although there are circumstances in which it may be more appropriate to analyse a set of time series by modelling each one in turn as the output series with the remainder as inputs, there is a more symmetric approach in such a context. These models are known as vector autoregressive moving-average (VARMA) models.
2.4.1 Differencing and transforming a multivariate time series
As in the case of a univariate time series, it may be useful to simplify the series by differencing operations which may be used to remove linear or seasonal trends, thus ensuring that the resulting series to be used in the model estimation is stationary. It may also be necessary to apply transformations to the individual components of the multivariate series in order to stabilize the variance. Commonly used transformations are the log and square root transformations.
2.4.2 Model identification for a multivariate time series
Multivariate analogues of the autocorrelation and partial autocorrelation functions are available for analysing a set of time series, , for , thereby making it possible to obtain some understanding of a suitable VARMA model for the observed series.
It is assumed that the time series have been differenced if necessary, and that they are jointly stationary. The lagged correlations between all possible pairs of series, i.e.,
are then taken to provide an adequate description of the statistical relationships between the series. These quantities are estimated by sample auto- and cross-correlations
. For each
these may be viewed as elements of a (lagged) autocorrelation matrix.
Thus consider the vector process (with elements ) and lagged autocovariance matrices with elements of where . Correspondingly, is estimated by the matrix with elements where is the sample variance of .
For a series with short-term cross-correlation only, i.e., is not significant beyond some low lag , then the pure vector model, with no autoregressive parameters, i.e., , is appropriate.
The correlation matrices provide a description of the joint statistical properties of the series. It is also possible to calculate matrix quantities which are closely analogous to the partial autocorrelations of univariate series (see Section 2.1.4
). Wei (1990)
discusses both the partial autoregression matrices proposed by Tiao and Box (1981)
and partial lag correlation matrices.
In the univariate case the partial autocorrelation function (PACF) between
is the correlation coefficient between the two after removing the linear dependence on each of the intervening variables
. This partial autocorrelation may also be obtained as the last regression coefficient associated with
. Tiao and Box (1981)
extended this method to the multivariate case to define the partial autoregression matrix. Heyse and Wei (1985)
also extended the univariate definition of the PACF to derive the correlation matrix between the vectors
after removing the linear dependence on each of the intervening vectors
, the partial lag correlation matrix.
Note that the partial lag correlation matrix is a correlation coefficient matrix since each of its elements is a properly normalized correlation coefficient. This is not true of the partial autoregression matrices (except in the univariate case for which the two types of matrix are the same). The partial lag correlation matrix at lag also reduces to the regular correlation matrix at lag ; this is not true of the partial autoregression matrices (again except in the univariate case).
Both the above share the same cut-off property for autoregressive processes; that is for an autoregressive process of order , the terms of the matrix at lags and greater are zero. Thus if the sample partial cross-correlations are significant only up to some low lag then a pure vector model is appropriate with . Otherwise moving-average terms will need to be introduced as well as autoregressive terms.
Under the hypothesis that is an autoregressive process of order , times the sum of the squared elements of the partial lag correlation matrix at lag is asymptotically distributed as a variable with degrees of freedom where is the dimension of the multivariate time series. This provides a diagnostic aid for determining the order of an autoregressive model.
The partial autoregression matrices may be found by solving a multivariate version of the Yule–Walker equations to find the autoregression matrices, using the final regression matrix coefficient as the partial autoregression matrix at that particular lag.
The basis of these calculations is a multivariate autoregressive model:
are matrix coefficients, and
is the vector of errors in the prediction. These coefficients may be rapidly computed using a recursive technique which requires, and simultaneously furnishes, a backward prediction equation:
(in the univariate case
The forward prediction equation coefficients, , are of direct interest, together with the covariance matrix of the prediction errors . The calculation of these quantities for a particular maximum equation lag involves calculation of the same quantities for increasing values of .
may be viewed as generalized variance ratios, and provide a measure of the efficiency of prediction (the smaller the better). The reduction from
which occurs on extending the order of the predictor to
may be represented as
is a multiple squared partial autocorrelation coefficient associated with
degrees of freedom.
Sample estimates of all the above quantities may be derived by using the series covariance matrices
, in place of
. The best lag for prediction purposes may be chosen as that which yields the minimum final prediction error (FPE) criterion:
An alternative method of estimating the sample partial autoregression matrices is by using multivariate least squares to fit a series of multivariate autoregressive models of increasing order.
2.4.3 VARMA model estimation
The cross-correlation structure of a stationary multivariate time series may often be represented by a model with a small number of parameters belonging to the VARMA class. If the stationary series
has been derived by transforming and/or differencing the original series
is said to follow the VARMA model:
is a vector of uncorrelated residual series (white noise) with zero mean and constant covariance matrix
autoregressive (AR) parameter matrices and
moving-average (MA) parameter matrices. If
has a nonzero mean
, then this can be allowed for by replacing
in the model.
A series generated by this model will only be stationary provided restrictions are placed on
to avoid unstable growth of
. These are stationarity constraints. The series
may also be usefully interpreted as the linear innovations in
, i.e., the error if
were to be predicted using the information in all past values
, provided also that
satisfy what are known as invertibility constraints. This allows the series
to be generated by rewriting the model equation as
The method of maximum likelihood (ML) may be used to estimate the parameters of a specified VARMA model from the observed multivariate time series together with their standard errors and correlations.
The residuals from the model may be examined for the presence of autocorrelations as a check on the adequacy of the fitted model.
2.4.4 VARMA model forecasting
Forecasts of the series may be constructed using a multivariate version of the univariate method. Efficient methods are available for updating the forecasts each time new observations become available.
2.5 Cross-spectral Analysis
The relationship between two time series may be investigated in terms of their sinusoidal components at different frequencies. At frequency
a component of
of the form
has its amplitude
and phase lag
and similarly for
. In the univariate analysis only the amplitude was important – in the cross analysis the phase is important.
2.5.1 The sample cross-spectrum
This is defined by
It may be demonstrated that this is equivalently defined in terms of the sample cross-correlation function (CCF),
, of the series as
is the cross-covariance function.
2.5.2 The amplitude and phase spectrum
The cross-spectrum is specified by its real part or cospectrum
and imaginary part or quadrature spectrum
, but for the purpose of interpretation the cross-amplitude spectrum and phase spectrum are useful:
If the series
contain deterministic sinusoidal components of amplitudes
will have a peak of approximate width
at that frequency, with corresponding phase
. This supplies no information that cannot be obtained from the two series separately. The statistical relationship between the series is better revealed when the series are purely stochastic and jointly stationary, in which case the expected value of
converges with increasing sample size to the theoretical cross-spectrum
. The sample spectrum, as in the univariate case, does not converge to the theoretical spectrum without some form of smoothing which either implicitly (using a lag window) or explicitly (using a frequency window) averages the sample spectrum
over wider bands of frequency to obtain a smoothed estimate
2.5.3 The coherency spectrum
If there is no statistical relationship between the series at a given frequency, then
, and the smoothed estimate
, will be close to
. This is assessed by the squared coherency between the series:
is the corresponding smoothed univariate spectrum estimate for
, and similarly for
. The coherency can be treated as a squared multiple correlation. It is similarly invariant in theory not only to simple scaling of
, but also to filtering of the two series, and provides a useful test statistic for the relationship between autocorrelated series. Note that without smoothing,
so the coherency is
at all frequencies, just as a correlation is
for a sample of size
. Thus smoothing is essential for cross-spectrum analysis.
2.5.4 The gain and noise spectrum
is believed to be related to
by a linear lagged relationship as in Section 2.3
then the theoretical cross-spectrum is
is called the frequency response of the relationship.
were a sinusoidal wave at frequency
would be similar but multiplied in amplitude by
and shifted in phase by
. Furthermore, the theoretical univariate spectrum
, with spectrum
, is assumed independent of the input
Cross-spectral analysis thus furnishes estimates of the gain
and the phase
From these representations of the estimated frequency response
, parametric transfer function (TF) models may be recognized and selected. The noise spectrum may also be estimated as
a formula which reflects the fact that in essence a regression is being performed of the sinusoidal components of
on those of
over each frequency band.
Interpretation of the frequency response may be aided by extracting from estimates of the impulse response function (IRF) . It is assumed that there is no anticipatory response between and , i.e., no coefficients with or are needed (their presence might indicate feedback between the series).
2.5.5 Cross-spectrum smoothing by lag window
The estimate of the cross-spectrum is calculated from the sample cross-variances as
The lag window
extends up to a truncation lag
as in the univariate case, but its centre is shifted by an alignment lag
usually chosen to coincide with the peak cross-correlation. This is equivalent to an alignment of the series for peak cross-correlation at lag
, and reduces bias in the phase estimation.
The selection of the truncation lag , which fixes the bandwidth of the estimate, is based on the same criteria as for univariate series, and the same choice of and window shape should be used as in univariate spectrum estimation to obtain valid estimates of the coherency, gain, etc., and test statistics.
2.5.6 Direct smoothing of the cross-spectrum
The computations are exactly as for smoothing of the univariate spectrum except that allowance is made for an implicit alignment shift between the series.
2.6 Kalman Filters
2.6.1 Linear State Space Models
Kalman filtering provides a method for the analysis of multidimensional time series. The underlying model is:
is the unobserved state vector,
is the observed measurement vector,
is the state noise,
is the measurement noise,
is the state transition matrix,
is the noise coefficient matrix and
is the measurement coefficient matrix at time
. The state noise and the measurement noise are assumed to be uncorrelated with zero mean and covariance matrices:
If the system matrices
and the covariance matrices
are known then Kalman filtering can be used to compute the minimum variance estimate of the stochastic variable
The estimate of given observations to is denoted by
with state covariance matrix
while the estimate of given observations to is denoted by
with covariance matrix
The update of the estimate,
, from time to time , is computed in two stages.
First, the update equations are
where the residual
has an associated covariance matrix
is the Kalman gain matrix with
The second stage is the one-step-ahead prediction equations given by
These two stages can be combined to give the one-step-ahead update-prediction equations
The above equations thus provide a method for recursively calculating the estimates of the state vectors
and their covariance matrices
from their previous values. This recursive procedure can be viewed in a Bayesian framework as being the updating of the prior by the data
The initial values
are required to start the recursion. For stationary systems,
can be computed from the following equation:
which can be solved by iterating on the equation. For
can be used if it is available.
18.104.22.168 Computational methods
To improve the stability of the computations the square root algorithm is used. One recursion of the square root covariance filter algorithm which can be summarised as follows:
is an orthogonal transformation triangularizing the left-hand pre-array to produce the right-hand post-array,
is the lower triangular Cholesky factor of the state covariance matrix
are the lower triangular Cholesky factor of the covariance matrices
is the lower triangular Cholesky factor of the covariance matrix of the residuals. The relationship between the Kalman gain matrix,
is given by
To improve the efficiency of the computations when the matrices
do not vary with time the system can be transformed to give a simpler structure. The transformed state vector is
is the transformation that reduces the matrix pair
to lower observer Hessenberg form. That is, the matrix
is computed such that the compound matrix
is a lower trapezoidal matrix. The transformations need only be computed once at the start of a series, and the covariance matrices
can still be time-varying.
22.214.171.124 Model fitting and forecasting
If the state space model contains unknown parameters,
, these can be estimated using maximum likelihood (ML). Assuming that
are normal variates the log-likelihood for observations
, is given by
Optimal estimates for the unknown model parameters
can then be obtained by using a suitable optimizer routine to maximize the likelihood function.
Once the model has been fitted forecasting can be performed by using the one-step-ahead prediction equations. The one-step-ahead prediction equations can also be used to ‘jump over’ any missing values in the series.
126.96.36.199 Kalman filter and time series models
Many commonly used time series models can be written as state space models. A univariate
model can be cast into the following state space form:
The representation for a -variate series (VARMA) is very similar to that given above, except now the state vector is of length and the and are now matrices and the 1s in , and are now the identity matrix of order . If or then the appropriate or matrices are set to zero, respectively.
Since the compound matrix
is already in lower observer Hessenberg form (i.e., it is lower trapezoidal with zeros in the top right-hand triangle) the invariant Kalman filter algorithm can be used directly without the need to generate a transformation matrix
2.6.2 Nonlinear State Space Models
A nonlinear state space model, with additive noise, can, at time
, be described by:
represents the unobserved state vector of length
the observed measurement vector of length
. The process noise is denoted
, which is assumed to have mean zero and covariance structure
, and the measurement noise by
, which is assumed to have mean zero and covariance structure
. The two nonlinear functions,
may be time dependent. Two methods are commonly used to analyse nonlinear state space models: the Extended Kalman Filter (EKF) and the Unscented Kalman Filter (UKF).
The EKF solves the nonlinear state space model by first linearising the set of equations given in (18)
using a first order taylor expansion around
(the estimate of the state vector at time
given the full data:
) in the case of
(the estimate of the state vector at time
given the partial data:
) in the case of
. This leads to the linear state space model:
This linear state space model can then be solved using the standard Kalman Filter. See Haykin (2001)
for more details.
Unlike the EKF, the UKF of Julier and Uhlmann (1997)
does not attempt to linearise the problem, rather it uses a minimal set of carefully chosen points, called sigma points, to capture the mean and covariance of the underlying Gaussian random variables. These points are then propagated through the nonlinear functions giving an estimate of the transformed mean and covariance. A brief description of the UKF can be found in Section 3
2.7 GARCH Models
2.7.1 ARCH models and their generalizations
Rather than modelling the mean (for example using regression models) or the autocorrelation (by using ARMA models) there are circumstances in which the variance of a time series needs to be modelled. This is common in financial data modelling where the variance (or standard deviation) is known as volatility. The ability to forecast volatility is a vital part in deciding the risk attached to financial decisions like portfolio selection. The basic model for relating the variance at time
to the variance at previous times is the autoregressive conditional heteroskedastic (ARCH) model. The standard ARCH model is defined as
is the information up to time
is the conditional variance.
In a similar way to that in which autoregressive (AR) models were generalized to ARMA models the ARCH models have been generalized to a GARCH model; see Engle (1982)
, Bollerslev (1986)
and Hamilton (1994)
This can be combined with a regression model:
, are the exogenous variables.
The above models assume that the change in variance, , is symmetric with respect to the shocks, that is, that a large negative value of has the same effect as a large positive value of . A frequently observed effect is that a large negative value often leads to a greater variance than a large positive value. The following three asymmetric models represent this effect in different ways using the parameter as a measure of the asymmetry.
Type I AGARCH(
Type II AGARCH(
), or Glosten, Jagannathan and Runkle GARCH (see Glosten et al. (1993)
The first assumes that the effects of the shocks are symmetric about
rather than zero, so that for
the effect of negative shocks is increased and the effect of positive shocks is decreased. Both the Type II AGARCH and the GJR GARCH (see Glosten et al. (1993)
) models introduce asymmetry by increasing the value of the coefficient of
for negative values of
. In the case of the Type II AGARCH the effect is multiplicative while for the GJR GARCH the effect is additive.
|Type II AGARCH
(Note that in the case of GJR GARCH, needs to be positive to inflate variance after negative shocks while for Type I and Type II AGARCH, needs to be negative.)
A third type of GARCH model is the exponential GARCH (EGARCH). In this model the variance relationship is on the log scale and hence asymmetric.
denotes the expected value of
Note that the terms represent a symmetric contribution to the variance while the terms give an asymmetric contribution.
Another common characteristic of financial data is that it is heavier in the tails (leptokurtic) than the Normal distribution. To model this the Normal distribution is replaced by a scaled Student's -distribution (that is a Student's -distribution standardized to have variance ). The Student's -distribution is such that the smaller the degrees of freedom the higher the kurtosis for degrees of freedom .
2.7.2 Fitting GARCH models
The models are fitted by maximizing the conditional log-likelihood. For the Normal distribution the conditional log-likelihood is
For the Student's -distribution the function is more complex. An approximation to the standard errors of the parameter estimates is computed from the Fisher information matrix.
2.8 Inhomogeneous Time Series
If we denote a generic univariate time series as a sequence of pairs of values , for where the 's represent an observed scalar value and the 's the time that the value was observed, then in a standard time series analysis, as discussed in other sections of this introduction, it is assumed that the series being analysed is homogeneous, that is the sampling times are regularly spaced with for some value . In many real world applications this assumption does not hold, that is, the series is inhomogeneous.
Standard time series analysis techniques cannot be used on an inhomogeneous series without first preprocessing the series to construct an artificial homogeneous series, by for example, resampling the series at regular intervals. Zumbach and Müller (2001)
introduced a series of operators that can be used to extract robust information directly from the inhomogeneous time series. In this context, robust information means that the results should be essentially independent of minor changes to the sampling mechanism used when collecting the data, for example, changing a number of time stamps or adding or removing a few observations.
The basic operator available for inhomogeneous time series is the exponential moving average (EMA). This operator has a single parameter,
, and is an average operator with an exponentially decaying kernel given by:
This gives rise to the following iterative formula:
The value of
depends on the method of interpolation chosen. Three interpolation methods are available:
Given the EMA, a number of other operators can be defined, including:
||-Iterated Exponential Moving Average, defined as
||Moving Average (MA), defined as
||Moving Norm (MNorm), defined as
||Moving Variance (MVar), defined as
||Moving Standard Deviation (MSD), defined as
||Differential ( ), defined as
||Volatility, defined as
A discussion of each of these operators, their use and in some cases, alternative definitions, are given in Zumbach and Müller (2001)
3 Recommendations on Choice and Use of Available Routines
3.1 Univariate Analysis
The availability of routines for each of these four steps is given below.
3.1.1 ARMA-type Models
ARMA-type modelling usually follows the methodology made popular by Box and Jenkins. It consists of four steps: identification, model fitting, model checking and forecasting.
The routine G13AUF
may be used in obtaining either a range-mean or standard deviation-mean plot for a series of observations, which may be useful in detecting the need for a variance-stabilizing transformation. G13AUF
computes the range or standard deviation and the mean for successive groups of observations
may then be used to produce a scatter plot of range against mean or of standard deviation against mean.
The routine G13AAF
may be used to difference a time series. The
values of the differenced time series which extends for
are stored in the first
elements of the output array.
The routine G13ABF
may be used for direct computation of the autocorrelations. It requires the time series as input, after optional differencing by G13AAF
An alternative is to use G13CAF
, which uses the fast Fourier transform (FFT) to carry out the convolution for computing the autocovariances. Circumstances in which this is recommended are
||if the main aim is to calculate the smoothed sample spectrum;
||if the series length and maximum lag for the autocorrelations are both very large, in which case appreciable computing time may be saved.
For more precise recommendations, see Gentleman and Sande (1966)
. In this case the autocorrelations
need to be obtained from the autocovariances
The routine G13ACF
computes the partial autocorrelation function (PACF) and prediction error variance estimates from an input autocorrelation function (ACF). Note that G13DNF
, which is designed for multivariate time series, may also be used to compute the PACF together with
statistics and their significance levels.
Finite lag predictor coefficients are also computed by the routine G13ACF
. It may have to be used twice, firstly with a large value for the maximum lag
in order to locate the optimum final prediction error (FPE) lag, then again with
reset to this lag.
The routine G13DXF
may be used to check that the autoregressive (AR) part of the model is stationary and that the moving-average (MA) part is invertible.
The routine G13ADF
is used to compute preliminary estimates of the ARIMA model parameters, the sample autocorrelations of the appropriately differenced series being input. The model orders are required.
The main routine for parameter estimation for ARIMA models is G13AEF
, and an easy-to-use version is G13AFF
. Both these routines use the least squares criterion of estimation.
In some circumstances the use of
which use maximum likelihood (ML), is recommended.
The routines require the time series values to be input, together with the ARIMA orders. Any differencing implied by the model is carried out internally. They also require the maximum number of iterations to be specified, and return the state set for use in forecasting.
should be preferred to G13AFF
||more information about the differenced series, its backforecasts and the intermediate series;
||greater control over the output at successive iterations;
||more detailed control over the search policy of the nonlinear least squares algorithm;
||more information about the first and second derivatives of the objective function during and upon completion of the iterations.
is primarily designed for estimating relationships between time series. It is, however, easily used in a univariate mode for ARIMA model estimation. The advantage is that it allows (optional) use of the exact likelihood estimation criterion, which is not available in G13AEF
. This is particularly recommended for models which have seasonal parameters, because it reduces the tendency of parameter estimates to become stuck at points on the parameter space boundary. The model parameters estimated in this routine should be passed over to G13AJF
for use in univariate forecasting.
The routine G13DDF
is primarily designed for fitting vector ARMA models to multivariate time series but may also be used in a univariate mode. It allows the use of either the exact or conditional likelihood estimation criterion, and allows you to fit non-multiplicative seasonal models which are not available in
calculates the correlations in the residuals from a model fitted by either G13AEF
. In addition the standard errors and correlations of the residual autocorrelations are computed along with a portmanteau test for model adequacy.
can be used after a univariate model has been fitted by G13BEF
, but care must be taken in selecting the correct inputs to G13ASF
. Note that if G13DDF
has been used to fit a non-multiplicative seasonal model to a univariate series then G13DSF
may be used to check the adequacy of the model.
||Forecasting using an ARIMA model
Given that the state set produced on estimation of the ARIMA model by either G13AEF
has been retained, G13AHF
can be used directly to construct forecasts for
, together with probability limits.
If some further observations
have come to hand since model estimation (and there is no desire to re-estimate the model using the extended series), then
can be used to update the state set using the new observations, prior to forecasting from the end of the extended series. The original series is not required.
The routine G13AJF
is provided for forecasting when the ARIMA model is known but the state set is unknown. For example, the model may have been estimated by a procedure other than the use of G13AEF
, such as G13BEF
constructs the state set and optionally constructs forecasts with probability limits. It is equivalent to a call to G13AEF
with zero iterations requested, followed by an optional call to G13AHF
, but it is much more efficient.
3.1.2 Exponential smoothing
A variety of different smoothing methods are provided by G13AMF
, including; single exponential, Brown's double exponential, linear Holt (also called double exponential smoothing in some references), additive Holt–Winters and multiplicative Holt–Winters. The choice of smoothing method used depends on the characteristics of the time series. If the mean of the series is only slowly changing then single exponential smoothing may be suitable. If there is a trend in the time series, which itself may be slowly changing, then double exponential smoothing may be suitable. If there is a seasonal component to the time series, e.g., daily or monthly data, then one of the two Holt–Winters methods may be suitable.
3.1.3 Change point analysis
Four routines are available for change point analysis, two implementing the PELT algorithm (G13NAF
) and two binary segmentation (G13NDF
). Of these, G13NAF
have six pre-defined cost functions based on the log-likelihood of the Normal, Gamma, Exponential and Poisson distributions. In the case of the Normal distribution changes in the mean, standard deviation or both can be investigated. The remaining two routines, G13NBF
take a user-supplied cost function.
Binary segmentation only returns an approximate solution to the change point problem as defined in equation (5)
. It is therefore recommended that the PELT algorithm is used in most cases. However, for long time series the binary segmentation algorithm may give a marked improvement in terms of speed especially if the maximum depth for the iterative process (MDEPTH
) is set to a low value.
3.2 Univariate Spectral Analysis
Two routines are available, G13CAF
carrying out smoothing using a lag window and G13CBF
carrying out direct frequency domain smoothing. Both can take as input the original series, but G13CAF
alone can use the sample autocovariances as alternative input. This has some computational advantage if a variety of spectral estimates needs to be examined for the same series using different amounts of smoothing.
However, the real choice in most cases will be which of the four shapes of lag window in G13CAF
to use, or whether to use the trapezium frequency window of G13CBF
. The references may be consulted for advice on this, but the two most recommended lag windows are the Tukey and Parzen. The Tukey window has a very small risk of supplying negative spectrum estimates; otherwise, for the same bandwidth, both give very similar results, though the Parzen window requires a higher truncation lag (more autocorrelation function (ACF) values).
The frequency window smoothing procedure of G13CBF
with a trapezium shape parameter
generally gives similar results for the same bandwidth as lag window methods with a slight advantage of somewhat less distortion around sharp peaks, but suffering a rather less smooth appearance in fine detail.
3.3 Linear Lagged Relationships Between Time Series
The availability of routines for each of four steps: identification, model fitting, model checking and forecasting, is given below.
Normally use G13BCF
for direct computation of cross-correlations, from which cross-covariances may be obtained by multiplying by
, and impulse response estimates (after prewhitening) by multiplying by
are the sample standard deviations of the series.
An alternative is to use G13CCF
, which exploits the fast Fourier transform (FFT) to carry out the convolution for computing cross-covariances. The criteria for this are the same as given in Section 3.1.1
for calculation of autocorrelations. The impulse response function may also be computed by spectral methods without prewhitening using G13CGF
may be used to prewhiten or filter a series by an ARIMA model.
may be used to filter a time series using a transfer function model.
The routine G13BDF
is used to obtain preliminary estimates of transfer function model parameters. The model orders and an estimate of the impulse response function (see Section 3.2
) are required.
The simultaneous estimation of the transfer function model parameters for the inputs, and ARIMA model parameters for the output, is carried out by G13BEF
This routine requires values of the output and input series, and the orders of all the models. Any differencing implied by the model is carried out internally.
The routine also requires the maximum number of iterations to be specified, and returns the state set for use in forecasting.
The routine G13ASF
, primarily designed for univariate time series, can be used to test the residuals from an input-output model.
Given that the state set produced on estimation of the model by G13BEF
has been retained, the routine G13BHF
can be used directly to construct forecasts of the output series. Future values of the input series (possibly forecasts previously obtained using G13AHF
) are required.
If further observations of the output and input series have become available since model estimation (and there is no desire to re-estimate the model using the extended series) then G13BGF
can be used to update the state set using the new observations prior to forecasting from the end of the extended series. The original series are not required.
The routine G13BJF
is provided for forecasting when the multi-input model is known, but the state set is unknown. The set of output and input series must be supplied to the routine which then constructs the state set (for future use with G13BGF
) and also optionally constructs forecasts of the output series in a similar manner to G13BHF
In constructing probability limits for the forecasts, it is possible to allow for the fact that future input series values may themselves have been calculated as forecasts using ARIMA models. Use of this option requires that these ARIMA models be supplied to the routine.
||Filtering a time series using a transfer function model
The routine for this purpose is G13BBF
3.4 Multivariate Time Series
The availability of routines for each of four steps: identification, model fitting, model checking and forecasting, is given below.
The routine G13DLF
may be used to difference the series. You must supply the differencing parameters for each component of the multivariate series. The order of differencing for each individual component does not have to be the same. The routine may also be used to apply a log or square root transformation to the components of the series.
The routine G13DMF
may be used to calculate the sample cross-correlation or cross-covariance matrices. It requires a set of time series as input. You may request either the cross-covariances or cross-correlations.
The routine G13DNF
computes the partial lag correlation matrices from the sample cross-correlation matrices computed by G13DMF
, and the routine G13DPF
computes the least squares estimates of the partial autoregression matrices and their standard errors. Both routines compute a series of
statistics that aid the determination of the order of a suitable autoregressive model. G13DBF
may also be used in the identification of the order of an autoregressive model. The routine computes multiple squared partial autocorrelations and predictive error variance ratios from the sample cross-correlations or cross-covariances computed by G13DMF
The routine G13DXF
may be used to check that the autoregressive part of the model is stationary and that the moving-average part is invertible.
||Estimation of VARMA model parameters
The routine for this purpose is G13DDF
. This routine requires a set of time series to be input, together with values for
. You must also specify the maximum number of likelihood evaluations to be permitted and which parameters (if any) are to be held at their initial (user-supplied) values. The fitting criterion is either exact maximum likelihood (ML) or conditional maximum likelihood.
is primarily designed for estimating relationships between time series. It may, however, easily be used in univariate mode for non-seasonal and non-multiplicative seasonal ARIMA model estimation. The advantage is that it allows (optional) use of the exact maximum likelihood (ML) estimation criterion, which is not available in
The conditional likelihood option is recommended for those models in which the parameter estimates display a tendency to become stuck at points on the boundary of the parameter space. When one of the series is known to be influenced by all the others, but the others in turn are mutually independent and do not influence the output series, then G13BEF
(the transfer function (TF) model fitting routine) may be more appropriate to use.
||VARMA model checking
calculates the cross-correlation matrices of residuals for a model fitted by G13DDF
. In addition the standard errors and correlations of the residual correlation matrices are computed along with a portmanteau test for model adequacy.
||Forecasting using a VARMA model
The routine G13DJF
may be used to construct a chosen number of forecasts using the model estimated by G13DDF
. The standard errors of the forecasts are also computed. A reference vector is set up by G13DJF
so that should any further observations become available the existing forecasts can be efficiently updated using G13DKF
. On a call to G13DKF
the reference vector itself is also updated so that G13DKF
may be called again each time new observations are available.
3.5 Cross-spectral Analysis
Two routines are available for the main step in cross-spectral analysis. To compute the cospectrum and quadrature spectrum estimates using smoothing by a lag window, G13CCF
should be used. It takes as input either the original series or cross-covariances which may be computed in a previous call of the same routine or possibly using results from G13BCF
. As in the univariate case, this gives some advantage if estimates for the same series are to be computed with different amounts of smoothing.
The choice of window shape will be determined as the same as that which has already been used in univariate spectrum estimation for the series.
For direct frequency domain smoothing, G13CDF
should be used, with similar consideration for the univariate estimation in choice of degree of smoothing.
The cross-amplitude and squared coherency spectrum estimates are calculated, together with upper and lower confidence bounds, using G13CEF
. For input the cross-spectral estimates from either G13CCF
and corresponding univariate spectra from either G13CAF
The gain and phase spectrum estimates are calculated together with upper and lower confidence bounds using G13CFF
. The required input is as for G13CEF
The noise spectrum estimates and impulse response function estimates are calculated together with multiplying factors for confidence limits on the former, and the standard error for the latter, using G13CGF
. The required input is again the same as for G13CEF
3.6 Kalman Filtering
3.6.1 Linear state space models
Two routines are available for analysing a linear state space model using Kalman filtering: G13EAF
for time varying systems and G13EBF
for time invariant systems. The latter will optionally compute the required transformation to lower observer Hessenberg form. Both these routines return the Cholesky factor of the residual covariance matrix,
, with the Cholesky factor of the state covariance matrix
and the Kalman gain matrix,
; in the case of G13EBF
these may be for the transformed system. To compute the updated state vector and the residual vector the required matrix-vector multiplications can be performed by F06PAF (DGEMV)
3.6.2 Nonlinear state space models
Two routines are available for analysing a nonlinear state space model: G13EJF
. The difference between the two routines is how the nonlinear functions,
are supplied, with G13EJF
using reverse communication and G13EKF
using direct communication. See Section 3.3.3
in How to Use the NAG Library and its Documentation for a description of the terms reverse and direct communication.
As well as having the additional flexibility inherent in reverse communication routines G13EJF
also offers an alternative method of generating the sigma points utilized by the Unscented Kalman Filter (UKF), potentially allowing for additional information to be propagated through the state space model. However, due to the increased complexity of the interface it is recommended that G13EKF
is used unless this additional flexibility is definitely required.
3.7 GARCH Models
The main choice in selecting a type of GARCH model is whether the data is symmetric or asymmetric and if asymmetric what form of asymmetry should be included in the model.
A symmetric ARCH or GARCH model can be fitted by G13FAF
and the volatility forecast by G13FBF
. For asymmetric data the choice is between the type of asymmetry as described in Section 2.7
All routines allow the option of including regressor variables in the model and the choice between Normal and Student's -distribution for the errors.
3.8 Inhomogeneous Time Series
The following routines deal with inhomogeneous time series, G13MEF
-iterated exponential moving average (EMA). In most cases G13MEF
can be used, which returns
for a given value of
, overwriting the input data. Sometimes it is advantageous to have access to the intermediate results, for example when calculating the differential operator, in which case G13MFF
can be used, which can return
can also be used if you do not wish to overwrite the input data.
The last routine, G13MGF
should be used if you require the moving average, (MA), moving norm (MNorm), moving variance (MVar) or moving standard deviation (MSD). Other operators can be calculated by calling a combination of these three routines and the use of simple mathematics (additions, subtractions, etc.).
3.9 Time Series Simulation
There are routines available in Chapter G05
for generating a realization of a time series from a specified model: G05PHF
for univariate time series and G05PJF
for multivariate time series. There is also a suite of routines for simulating GARCH models:
The routine G05PMF
can be used to simulate data from an exponential smoothing model.
4 Functionality Index
| Dickey–Fuller unit root test|| ||G13AWF|
| estimation (comprehensive)|| ||G13AEF|
| estimation (easy-to-use)|| ||G13AFF|
| forecasting from fully specified model|| ||G13AJF|
| forecasting from state set|| ||G13AHF|
| user supplied cost function|| ||G13NEF|
| user supplied cost function|| ||G13NBF|
| symmetric or type I AGARCH,|| |
| iterated exponential moving average,|| |
| final value only returned|| ||G13MEF|
| intermediate values returned|| ||G13MFF|
| unscented (reverse communication)|| ||G13EJF|
| Bartlett, Tukey, Parzen windows|| ||G13CCF|
| cross amplitude spectrum|| ||G13CEF|
| Bartlett, Tukey, Parzen windows|| ||G13CAF|
|Transfer function modelling,|| |
| forecasting from fully specified model|| ||G13BJF|
| forecasting from state set|| ||G13BHF|
| partial autoregression matrices|| ||G13DPF|
| partial correlation matrices|| ||G13DNF|
| squared partial autocorrelations|| ||G13DBF|
| zeros of ARIMA operator|| ||G13DXF|
5 Auxiliary Routines Associated with Library Routine Arguments
See the description of the argument
PIV in G13AEF.
6 Routines Withdrawn or Scheduled for Withdrawal
The following lists all those routines that have been withdrawn since Mark 19 of the Library or are scheduled for withdrawal at one of the next two marks.
Akaike H (1971) Autoregressive model fitting for control Ann. Inst. Statist. Math. 23 163–180
Bollerslev T (1986) Generalised autoregressive conditional heteroskedasticity Journal of Econometrics 31 307–327
Box G E P and Jenkins G M (1976) Time Series Analysis: Forecasting and Control (Revised Edition) Holden–Day
Engle R (1982) Autoregressive conditional heteroskedasticity with estimates of the variance of United Kingdom inflation Econometrica 50 987–1008
Gentleman W S and Sande G (1966) Fast Fourier transforms for fun and profit Proc. Joint Computer Conference, AFIPS 29 563–578
Glosten L, Jagannathan R and Runkle D (1993) Relationship between the expected value and the volatility of nominal excess return on stocks Journal of Finance 48 1779–1801
Hamilton J (1994) Time Series Analysis Princeton University Press
Haykin S (2001) Kalman Filtering and Neural Networks John Wiley and Sons
Heyse J F and Wei W W S (1985) The partial lag autocorrelation function Technical Report No. 32 Department of Statistics, Temple University, Philadelphia
Julier S J and Uhlmann J K (1997) A new extension of the Kalman Filter to nonlinear systems International Symposium for Aerospace/Defense, Sensing, Simulation and Controls (Volume 3) 26
Killick R, Fearnhead P and Eckely I A (2012) Optimal detection of changepoints with a linear computational cost Journal of the American Statistical Association 107:500 1590–1598
Tiao G C and Box G E P (1981) Modelling multiple time series with applications J. Am. Stat. Assoc. 76 802–816
Wei W W S (1990) Time Series Analysis: Univariate and Multivariate Methods Addison–Wesley
Zumbach G O and Müller U A (2001) Operators on inhomogeneous time series International Journal of Theoretical and Applied Finance 4(1) 147–178