nag_arma_time_series (g05hac) generates an autoregressive moving average (ARMA) time series with Normally distributed errors (or residuals). It initializes the series to a stationary position and sets up a reference vector enabling the function to be called repeatedly, adding terms to the previous series at each call.
An ARMA model, denoted by ARMA
, is a mixture of an autoregressive process of order
(AR) and a moving average (MA) process of order
and can be written as
are the realization of the series,
is the mean of the series and
are the errors (or residuals, also often called the white noise) which are independently distributed as normal with mean zero and variance
. The arguments
are the autoregressive arguments and the arguments
are the moving average arguments.
The function sets up initial values corresponding to a stationary position using the method described by Tunnicliffe–Wilson (1979)
. It generates
terms of the time series by first calculating the next term in the autoregressive series and then applying the moving-average summation and storing the result.
Tunnicliffe–Wilson G (1979) Some efficient computational procedures for high order ARMA models J. Statist. Comput. Simulation 8 301–309
start – Nag_BooleanInput
must be Nag_TRUE if a new series is to begin, if start
is Nag_FALSE a previously generated series will be continued. If start is Nag_FALSE then the scalar arguments p
and the contents of the array arguments, phi
must not be changed.
p – IntegerInput
On entry: the number of autoregressive coefficients supplied.
q – IntegerInput
On entry: the number of moving-average coefficients supplied.
phi[p] – const doubleInput
On entry: the autoregressive coefficients of the model, if any, must contain , for .
theta[q] – const doubleInput
On entry: the moving-average coefficients of the model, if any, must contain , for .
mean – doubleInput
On entry: the mean of the time series.
vara – doubleInput
On entry: the variance of the errors, .
n – IntegerInput
On entry: the number of observations to be generated.
w[n] – doubleOutput
On exit: the realization of the time series.
ref – doubleOutput
On exit: the reference vector and the recent history of the series.
fail – NagError *Input/Output
The NAG error argument (see Section 3.6
in the Essential Introduction).
The program below shows two calls of nag_arma_time_series (g05hac). In the first call an ARMA series is generated. In the second call terms are added to the already existing series.