naginterfaces.library.rand.times_smooth_exp¶
- naginterfaces.library.rand.times_smooth_exp(mode, n, itype, p, param, init, var, comm, statecomm, e)[source]¶
times_smooth_exp
simulates from an exponential smoothing model, where the model uses either single exponential, double exponential or a Holt–Winters method.For full information please refer to the NAG Library document for g05pm
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g05/g05pmf.html
- Parameters
- modeint
Indicates if
times_smooth_exp
is continuing from a previous call or, if not, how the initial values are computed.Values for , and , for , are supplied in .
times_smooth_exp
continues from a previous call using values that are supplied in [‘r’]. [‘r’] is not updated.times_smooth_exp
continues from a previous call using values that are supplied in [‘r’]. [‘r’] is updated.- nint
The number of terms of the time series being generated.
- itypeint
The smoothing function.
Single exponential.
Brown’s double exponential.
Linear Holt.
Additive Holt–Winters.
Multiplicative Holt–Winters.
- pint
If or , the seasonal order, , otherwise is not referenced.
- paramfloat, array-like, shape
Note: the required length for this argument is determined as follows: if : ; if : ; if : ; otherwise: .
The smoothing parameters.
If or , and any remaining elements of are not referenced.
If , , , and any remaining elements of are not referenced.
If or , , , and and any remaining elements of are not referenced.
- initfloat, array-like, shape
Note: the required length for this argument is determined as follows: if : ; if : ; if : ; otherwise: .
If , the initial values for , and , for , used to initialize the smoothing.
If , and any remaining elements of are not referenced.
If or , and and any remaining elements of are not referenced.
If or , , and to hold the values for , for .
Any remaining elements of are not referenced.
- varfloat
The variance, of the Normal distribution used to generate the errors . If then Normally distributed errors are not used.
- commdict, communication object, modified in place
Communication structure for the reference vector.
If or , this argument must have been initialized by a prior call to
times_smooth_exp
.- statecommdict, RNG communication object, modified in place
RNG communication structure.
This argument must have been initialized by a prior call to
init_repeat()
orinit_nonrepeat()
.- efloat, array-like, shape
If and , a vector from which the errors, are randomly drawn, with replacement.
If , is not referenced.
- Returns
- xfloat, ndarray, shape
The generated time series, , for .
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: , or .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: , , , or .
- (errno )
On entry, .
Constraint: if or , .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: if , .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, some of the elements of the array [‘r’] have been corrupted or have not been initialized.
- (errno )
On entry, [‘state’] vector has been corrupted or not initialized.
- (errno )
Model unsuitable for multiplicative Holt–Winter, try a different set of parameters.
- Notes
times_smooth_exp
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.
- References
Chatfield, C, 1980, The Analysis of Time Series, Chapman and Hall