G05PMF simulates from an exponential smoothing model, where the model uses either single exponential, double exponential or a Holt–Winters method.
SUBROUTINE G05PMF ( |
MODE, N, ITYPE, P, PARAM, INIT, VAR, R, STATE, E, EN, X, IFAIL) |
INTEGER |
MODE, N, ITYPE, P, STATE(*), EN, IFAIL |
REAL (KIND=nag_wp) |
PARAM(*), INIT(*), VAR, R(*), E(EN), X(N) |
|
G05PMF returns
, a realisation 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
where
is the mean,
is the trend and
is the seasonal component at time
with
being the seasonal order. The errors,
are either drawn from a normal distribution with mean zero and variance
or randomly sampled, with replacement, from a user-supplied vector.
- 1: MODE – INTEGERInput
On entry: indicates if G05PMF is continuing from a previous call or, if not, how the initial values are computed.
- Values for , and
, for , are supplied in INIT.
- G05PMF continues from a previous call using values that are supplied in R. R is not updated.
- G05PMF continues from a previous call using values that are supplied in R. R is updated.
Constraint:
, or .
- 2: N – INTEGERInput
On entry: the number of terms of the time series being generated.
Constraint:
.
- 3: ITYPE – INTEGERInput
On entry: the smoothing function.
- Single exponential.
- Brown's double exponential.
- Linear Holt.
- Additive Holt–Winters.
- Multiplicative Holt–Winters.
Constraint:
, , , or .
- 4: P – INTEGERInput
On entry: if
or
, the seasonal order,
, otherwise
P is not referenced.
Constraint:
if or , .
- 5: PARAM() – REAL (KIND=nag_wp) arrayInput
-
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 .
- 6: INIT() – REAL (KIND=nag_wp) arrayInput
-
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.
- 7: VAR – REAL (KIND=nag_wp)Input
On entry: the variance, of the Normal distribution used to generate the errors . If then Normally distributed errors are not used.
- 8: R() – REAL (KIND=nag_wp) arrayInput/Output
-
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 G05PMF,
R need not be set otherwise.
On exit: if
,
R is unchanged. Otherwise,
R contains the information on the current state of smoothing.
Constraint:
if
or
,
R must have been initialized by at least one call to G05PMF or
G13AMF with
, and
R must not have been changed since that call.
- 9: STATE() – INTEGER arrayCommunication Array
-
Note: the actual argument supplied must be the array
STATE supplied to the initialization routines
G05KFF or
G05KGF.
On entry: contains information on the selected base generator and its current state.
On exit: contains updated information on the state of the generator.
- 10: E(EN) – REAL (KIND=nag_wp) arrayInput
On entry: if
and
, a vector from which the errors,
are randomly drawn, with replacement.
If
,
E is not referenced.
- 11: EN – INTEGERInput
On entry: if
, then the length of the vector
E.
If both and then
, for .
- 12: X(N) – REAL (KIND=nag_wp) arrayOutput
On exit: the generated time series,
, for .
- 13: IFAIL – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
.
When the value is used it is essential to test the value of IFAIL on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Not applicable.
None.
This example reads
observations from a time series relating to the rate of the earth's rotation about its polar axis and fits an exponential smoothing model using
G13AMF.
G05PMF is then called multiple times to obtain simulated forecast confidence intervals.