smooth (version 3.1.4)

oes: Occurrence ETS model

Description

Function returns the occurrence part of iETS model with the specified probability update and model types.

Usage

oes(y, model = "MNN", persistence = NULL, initial = "o",
  initialSeason = NULL, phi = NULL, occurrence = c("fixed", "general",
  "odds-ratio", "inverse-odds-ratio", "direct", "auto", "none"),
  ic = c("AICc", "AIC", "BIC", "BICc"), h = 10, holdout = FALSE,
  interval = c("none", "parametric", "likelihood", "semiparametric",
  "nonparametric"), level = 0.95, bounds = c("usual", "admissible",
  "none"), silent = c("all", "graph", "legend", "output", "none"),
  xreg = NULL, xregDo = c("use", "select"), initialX = NULL,
  updateX = FALSE, transitionX = NULL, persistenceX = NULL, ...)

Arguments

y

Either numeric vector or time series vector.

model

The type of ETS model used for the estimation. Normally this should be "MNN" or any other pure multiplicative or additive model. The model selection is available here (although it's not fast), so you can use, for example, "YYN" and "XXN" for selecting between the pure multiplicative and pure additive models respectively. Using mixed models is possible, but not recommended.

persistence

Persistence vector \(g\), containing smoothing parameters. If NULL, then estimated.

initial

Can be either character or a vector of initial states. If it is character, then it can be "optimal", meaning that the initial states are optimised, or "backcasting", meaning that the initials are produced using backcasting procedure.

initialSeason

The vector of the initial seasonal components. If NULL, then it is estimated.

phi

The value of the dampening parameter. Used only for damped-trend models.

occurrence

The type of model used in probability estimation. Can be "none" - none, "fixed" - constant probability, "odds-ratio" - the Odds-ratio model with b=1 in Beta distribution, "inverse-odds-ratio" - the model with a=1 in Beta distribution, "direct" - the TSB-like (Teunter et al., 2011) probability update mechanism a+b=1, "auto" - the automatically selected type of occurrence model, "general" - the general Beta model with two parameters. This will call oesg() function with two similar ETS models and the same provided parameters (initials and smoothing).

ic

The information criteria to use in case of model selection.

h

The forecast horizon.

holdout

If TRUE, holdout sample of size h is taken from the end of the data.

interval

Type of interval to construct. This can be:

  • "none", aka "n" - do not produce prediction interval.

  • "parametric", "p" - use state-space structure of ETS. In case of mixed models this is done using simulations, which may take longer time than for the pure additive and pure multiplicative models. This type of interval relies on unbiased estimate of in-sample error variance, which divides the sume of squared errors by T-k rather than just T.

  • "likelihood", "l" - these are the same as "p", but relies on the biased estimate of variance from the likelihood (division by T, not by T-k).

  • "semiparametric", "sp" - interval based on covariance matrix of 1 to h steps ahead errors and assumption of normal / log-normal distribution (depending on error type).

  • "nonparametric", "np" - interval based on values from a quantile regression on error matrix (see Taylor and Bunn, 1999). The model used in this process is e[j] = a j^b, where j=1,..,h.

The parameter also accepts TRUE and FALSE. The former means that parametric interval are constructed, while the latter is equivalent to none. If the forecasts of the models were combined, then the interval are combined quantile-wise (Lichtendahl et al., 2013).

level

Confidence level. Defines width of prediction interval.

bounds

What type of bounds to use in the model estimation. The first letter can be used instead of the whole word.

silent

If silent="none", then nothing is silent, everything is printed out and drawn. silent="all" means that nothing is produced or drawn (except for warnings). In case of silent="graph", no graph is produced. If silent="legend", then legend of the graph is skipped. And finally silent="output" means that nothing is printed out in the console, but the graph is produced. silent also accepts TRUE and FALSE. In this case silent=TRUE is equivalent to silent="all", while silent=FALSE is equivalent to silent="none". The parameter also accepts first letter of words ("n", "a", "g", "l", "o").

xreg

The vector or the matrix of exogenous variables, explaining some parts of occurrence variable (probability).

xregDo

Variable defines what to do with the provided xreg: "use" means that all of the data should be used, while "select" means that a selection using ic should be done. "combine" will be available at some point in future...

initialX

The vector of initial parameters for exogenous variables. Ignored if xreg is NULL.

updateX

If TRUE, transition matrix for exogenous variables is estimated, introducing non-linear interactions between parameters. Prerequisite - non-NULL xreg.

transitionX

The transition matrix \(F_x\) for exogenous variables. Can be provided as a vector. Matrix will be formed using the default matrix(transition,nc,nc), where nc is number of components in state vector. If NULL, then estimated. Prerequisite - non-NULL xreg.

persistenceX

The persistence vector \(g_X\), containing smoothing parameters for exogenous variables. If NULL, then estimated. Prerequisite - non-NULL xreg.

...

The parameters passed to the optimiser, such as maxeval, xtol_rel, algorithm and print_level. The description of these is printed out by nloptr.print.options() function from the nloptr package. The default values in the oes function are maxeval=500, xtol_rel=1E-8, algorithm="NLOPT_LN_SBPLX" and print_level=0.

Value

The object of class "occurrence" is returned. It contains following list of values:

  • model - the type of the estimated ETS model;

  • timeElapsed - the time elapsed for the construction of the model;

  • fitted - the fitted values for the probability;

  • fittedModel - the fitted values of the underlying ETS model, where applicable (only for occurrence=c("o","i","d"));

  • forecast - the forecast of the probability for h observations ahead;

  • forecastModel - the forecast of the underlying ETS model, where applicable (only for occurrence=c("o","i","d"));

  • lower - the lower bound of the interval if interval!="none";

  • upper - the upper bound of the interval if interval!="none";

  • lowerModel - the lower bound of the interval of the underlying ETS model if interval!="none";

  • upperModel - the upper bound of the interval of the underlying ETS model if interval!="none";

  • states - the values of the state vector;

  • logLik - the log-likelihood value of the model;

  • nParam - the number of parameters in the model (the matrix is returned);

  • residuals - the residuals of the model;

  • y - actual values of occurrence (zeros and ones).

  • persistence - the vector of smoothing parameters;

  • phi - the value of the damped trend parameter;

  • initial - initial values of the state vector;

  • initialSeason - the matrix of initials seasonal states;

  • occurrence - the type of the occurrence model;

  • updateX - boolean, defining, if the states of exogenous variables were estimated as well.

  • initialX - initial values for parameters of exogenous variables.

  • persistenceX - persistence vector g for exogenous variables.

  • transitionX - transition matrix F for exogenous variables.

  • accuracy - The error measures for the forecast (in case of holdout=TRUE).

  • B - the vector of all the estimated parameters (in case of "odds-ratio", "inverse-odds-ratio" and "direct" models).

Details

The function estimates probability of demand occurrence, using the selected ETS state space models.

For the details about the model and its implementation, see the respective vignette: vignette("oes","smooth")

References

  • Svetunkov Ivan and Boylan John E. (2017). Multiplicative State-Space Models for Intermittent Time Series. Working Paper of Department of Management Science, Lancaster University, 2017:4 , 1-43.

  • Teunter R., Syntetos A., Babai Z. (2011). Intermittent demand: Linking forecasting to inventory obsolescence. European Journal of Operational Research, 214, 606-615.

  • Croston, J. (1972) Forecasting and stock control for intermittent demands. Operational Research Quarterly, 23(3), 289-303.

  • Syntetos, A., Boylan J. (2005) The accuracy of intermittent demand estimates. International Journal of Forecasting, 21(2), 303-314.

See Also

adam, oesg, es

Examples

Run this code
# NOT RUN {
y <- rpois(100,0.1)
oes(y, occurrence="auto")

oes(y, occurrence="f")

# }

Run the code above in your browser using DataLab