g05pm simulates from an exponential smoothing model, where the model uses either single exponential, double exponential or a Holt–Winters method.
Syntax
C# |
---|
public static void g05pm( int mode, int n, int itype, int p, double[] param, double[] init, double var, double[] r, G05..::..G05State g05state, double[] e, int en, double[] x, out int ifail ) |
Visual Basic |
---|
Public Shared Sub g05pm ( _ mode As Integer, _ n As Integer, _ itype As Integer, _ p As Integer, _ param As Double(), _ init As Double(), _ var As Double, _ r As Double(), _ g05state As G05..::..G05State, _ e As Double(), _ en As Integer, _ x As Double(), _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void g05pm( int mode, int n, int itype, int p, array<double>^ param, array<double>^ init, double var, array<double>^ r, G05..::..G05State^ g05state, array<double>^ e, int en, array<double>^ x, [OutAttribute] int% ifail ) |
F# |
---|
static member g05pm : mode : int * n : int * itype : int * p : int * param : float[] * init : float[] * var : float * r : float[] * g05state : G05..::..G05State * e : float[] * en : int * x : float[] * ifail : int byref -> unit |
Parameters
- mode
- Type: System..::..Int32On entry: indicates if g05pm is continuing from a previous call or, if not, how the initial values are computed.Constraint: , or .
- n
- Type: System..::..Int32On entry: the number of terms of the time series being generated.Constraint: .
- itype
- Type: System..::..Int32On entry: the smoothing function.
- Single exponential.
- Brown's double exponential.
- Linear Holt.
- Additive Holt–Winters.
- Multiplicative Holt–Winters.
Constraint: , , , or .
- p
- Type: System..::..Int32On entry: if or , the seasonal order, , otherwise p is not referenced.Constraint: if or , .
- param
- Type: array<System..::..Double>[]()[][]An array of size [_lparam]Note: the dimension of the array param must be at least if or , if and at least if or .On entry: the smoothing parameters.If or , and any remaining elements of param are not referenced.If , , , and any remaining elements of param are not referenced.If or , , , and and any remaining elements of param are not referenced.Constraints:
- if , ;
- if , ;
- if , and and ;
- if or , and and and .
- init
- Type: array<System..::..Double>[]()[][]An array of size [_linit]Note: the dimension of the array init must be at least if , if or and at least if or .On entry: if , the initial values for , and , for , used to initialize the smoothing.If , and any remaining elements of init are not referenced.If or , and and any remaining elements of init are not referenced.If or , , and to hold the values for , for . Any remaining elements of init are not referenced.
- var
- Type: System..::..DoubleOn entry: the variance, of the Normal distribution used to generate the errors . If then Normally distributed errors are not used.
- r
- Type: array<System..::..Double>[]()[][]An array of size [_lr]Note: the dimension of the array r must be at least if , or and at least if or .On entry: if or , r must contain the values as returned by a previous call to g05pm, r need not be set otherwise.
- g05state
- Type: NagLibrary..::..G05..::..G05StateAn Object of type G05.G05State.
- e
- Type: array<System..::..Double>[]()[][]An array of size [en]On entry: if and , a vector from which the errors, are randomly drawn, with replacement.If , e is not referenced.
- en
- Type: System..::..Int32On entry: if , then the length of the vector e.If both and then , for .
- x
- Type: array<System..::..Double>[]()[][]An array of size [n]On exit: the generated time series, , for .
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
g05pm returns , a realization of a time series from an exponential smoothing model defined by one of five smoothing functions:
- Single Exponential Smoothing
- Brown Double Exponential Smoothing
- Linear Holt Exponential Smoothing
- Additive Holt–Winters Smoothing
- Multiplicative Holt–Winters Smoothing
References
Chatfield C (1980) The Analysis of Time Series Chapman and Hall
Error Indicators and Warnings
Errors or warnings detected by the method:
- On entry, , or .
- On entry, , , , or .
On entry, or and .
- On entry, at least one of , or or .On entry, and .On entry, .
On entry, .
On entry, or and the array r has not been initialized correctly.
- On entry, the array state has not been initialized correctly.
- and model is unsuitable for multiplicative Holt–Winter.
Accuracy
Not applicable.
Parallelism and Performance
None.
Further Comments
None.
Example
g05pm is then called multiple times to obtain simulated forecast confidence intervals.
Example program (C#): g05pme.cs