g05pmc 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
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:
– Nag_InitialValues
Input
-
On entry: indicates if
g05pmc is continuing from a previous call or, if not, how the initial values are computed.
- Values for , and
, for , are supplied in init.
- g05pmc continues from a previous call using values that are supplied in r. r is not updated.
- g05pmc continues from a previous call using values that are supplied in r. r is updated.
Constraint:
, or .
-
2:
– Integer
Input
-
On entry: the number of terms of the time series being generated.
Constraint:
.
-
3:
– Nag_ExpSmoothType
Input
-
On entry: the smoothing function.
- Single exponential.
- Brown's double exponential.
- Linear Holt.
- Additive Holt–Winters.
- Multiplicative Holt–Winters.
Constraint:
, , , or .
-
4:
– Integer
Input
-
On entry: if
or
, the seasonal order,
, otherwise
p is not referenced.
Constraint:
if or , .
-
5:
– const double
Input
-
Note: the dimension,
dim, of the array
param
must be at least
- , when ;
- , when ;
- , when .
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:
– const double
Input
-
Note: the dimension,
dim, of the array
init
must be at least
- , when ;
- , when ;
- , when .
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:
– double
Input
-
On entry: the variance, of the Normal distribution used to generate the errors . If then Normally distributed errors are not used.
-
8:
– double
Communication Array
Note: the dimension,
dim, of the array
r
must be at least
- , when ;
- , when .
On entry: if
or
,
r must contain the values as returned by a previous call to
g05pmc,
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
g05pmc or
g13amc with
, and
r must not have been changed since that call.
-
9:
– Integer
Communication Array
Note: the dimension,
, of this array is dictated by the requirements of associated functions that must have been previously called. This array MUST be the same array passed as argument
state in the previous call to
nag_rand_init_repeatable (g05kfc) or
nag_rand_init_nonrepeatable (g05kgc).
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:
– const double
Input
-
On entry: if
and
, a vector from which the errors,
are randomly drawn, with replacement.
If
,
e is not referenced.
-
11:
– Integer
Input
-
On entry: if
, the length of the vector
e.
If both and then
, for .
-
12:
– double
Output
-
On exit: the generated time series,
, for .
-
13:
– NagError *
Input/Output
-
The
NAG error argument (see
Section 7 in the Introduction to the
NAG Library CL Interface).
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 3.1.2 in the Introduction to the
NAG Library CL Interface for further information.
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_ENUM_INT
-
On entry, .
Constraint: if or , .
- NE_INT
-
On entry, .
Constraint: .
- NE_INT_ARRAY
-
On entry, some of the elements of the array
r have been corrupted or have not been initialized.
- NE_INTERNAL_ERROR
-
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact
NAG for assistance.
See
Section 7.5 in the Introduction to the
NAG Library CL Interface for further information.
- NE_INVALID_STATE
-
On entry,
state vector has been corrupted or not initialized.
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the
NAG Library CL Interface for further information.
- NE_REAL_ARRAY
-
Model unsuitable for multiplicative Holt–Winter, try a different set of parameters.
On entry, .
Constraint: .
On entry, .
Constraint: if , .
On entry, .
Constraint: .
Not applicable.
Background information to multithreading can be found in the
Multithreading documentation.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
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
g13amc.