Syntax
C# |
---|
public static void g05ph( int mode, int n, double xmean, int ip, double[] phi, int iq, double[] theta, double avar, double[] r, G05..::..G05State g05state, out double var, double[] x, out int ifail ) |
Visual Basic |
---|
Public Shared Sub g05ph ( _ mode As Integer, _ n As Integer, _ xmean As Double, _ ip As Integer, _ phi As Double(), _ iq As Integer, _ theta As Double(), _ avar As Double, _ r As Double(), _ g05state As G05..::..G05State, _ <OutAttribute> ByRef var As Double, _ x As Double(), _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void g05ph( int mode, int n, double xmean, int ip, array<double>^ phi, int iq, array<double>^ theta, double avar, array<double>^ r, G05..::..G05State^ g05state, [OutAttribute] double% var, array<double>^ x, [OutAttribute] int% ifail ) |
F# |
---|
static member g05ph : mode : int * n : int * xmean : float * ip : int * phi : float[] * iq : int * theta : float[] * avar : float * r : float[] * g05state : G05..::..G05State * var : float byref * x : float[] * ifail : int byref -> unit |
Parameters
- mode
- Type: System..::..Int32On entry: a code for selecting the operation to be performed by the method.
- Set up reference vector only.
- Generate terms in the time series using reference vector set up in a prior call to g05ph.
- Set up reference vector and generate terms in the time series.
Constraint: , or .
- n
- Type: System..::..Int32On entry: , the number of observations to be generated.Constraint: .
- xmean
- Type: System..::..DoubleOn entry: the mean of the time series.
- ip
- Type: System..::..Int32On entry: , the number of autoregressive coefficients supplied.Constraint: .
- phi
- Type: array<System..::..Double>[]()[][]An array of size [ip]On entry: the autoregressive coefficients of the model, .
- iq
- Type: System..::..Int32On entry: , the number of moving average coefficients supplied.Constraint: .
- theta
- Type: array<System..::..Double>[]()[][]An array of size [iq]On entry: the moving average coefficients of the model, .
- avar
- Type: System..::..DoubleOn entry: , the variance of the Normal perturbations.Constraint: .
- r
- Type: array<System..::..Double>[]()[][]An array of size [lr]On entry: if , the reference vector from the previous call to g05ph.On exit: the reference vector.
- g05state
- Type: NagLibrary..::..G05..::..G05StateAn Object of type G05.G05State.
- var
- Type: System..::..Double%On exit: the proportion of the variance of a term in the series that is due to the moving-average (error) terms in the model. The smaller this is, the nearer is the model to non-stationarity.
- x
- Type: array<System..::..Double>[]()[][]An array of size [n]On exit: contains the next observations from the time series.
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
Let the vector , denote a time series which is assumed to follow an autoregressive moving average (ARMA) model of the form:
where , is a residual series of independent random perturbations assumed to be Normally distributed with zero mean and variance . The parameters , for , are called the autoregressive (AR) parameters, and , for , the moving average (MA) parameters. The parameters in the model are thus the values, the values, the mean and the residual variance .
g05ph sets up a reference vector containing initial values corresponding to a stationary position using the method described in Tunnicliffe–Wilson (1979). The method can then return a realization of . On a successful exit, the recent history is updated and saved in the reference vector r so that g05ph may be called again to generate a realization of , etc. See the description of the parameter mode in [Parameters] for details.
One of the initialization methods (G05KFF not in this release) (for a repeatable sequence if computed sequentially) or (G05KGF not in this release) (for a non-repeatable sequence) must be called prior to the first call to g05ph.
References
Knuth D E (1981) The Art of Computer Programming (Volume 2) (2nd Edition) Addison–Wesley
Tunnicliffe–Wilson G (1979) Some efficient computational procedures for high order ARMA models J. Statist. Comput. Simulation 8 301–309
Error Indicators and Warnings
Errors or warnings detected by the method:
- On entry, , or .
- On entry, .
- On entry, .
- phi does not define a stationary autoregressive process.
- On entry, .
- On entry, .
- On entry, .
On entry, state vector was not initialized or has been corrupted.
Accuracy
Any errors in the reference vector's initial values should be very much smaller than the error term; see Tunnicliffe–Wilson (1979).
Parallelism and Performance
None.
Further Comments
The time taken by g05ph is essentially of order .
Note: The reference vector, r, contains a copy of the recent history of the series. If attempting to re-initialize the series by calling (G05KFF not in this release) (G05KGF not in this release) a call to g05ph with must also be made. In the repeatable case the calls to g05ph should be performed in the same order (at the same point(s) in simulation) every time (G05KFF not in this release) is used. When the generator state is saved and restored using the parameter state, the time series reference vector must be saved and restored as well.
The ARMA model for a time series can also be written as:
where
- is the observed value of the time series at time ,
- is the number of autoregressive parameters, ,
- is the number of moving average parameters, ,
- is the mean of the time series,
and
- is a series of independent random Standard Normal perturbations.
This is related to the form given in [Description] by:
- ,
- ,
- ,
- ,
- ,
- .