# oesg: Occurrence ETS, general model In config-i1/smooth: Forecasting Using State Space Models

## Description

Function returns the general occurrence model of the of iETS model.

## Usage

  1 2 3 4 5 6 7 8 9 10 11 oesg(y, modelA = "MNN", modelB = "MNN", persistenceA = NULL, persistenceB = NULL, phiA = NULL, phiB = NULL, initialA = "o", initialB = "o", initialSeasonA = NULL, initialSeasonB = NULL, 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"), xregA = NULL, xregB = NULL, initialXA = NULL, initialXB = NULL, xregDoA = c("use", "select"), xregDoB = c("use", "select"), updateXA = FALSE, updateXB = FALSE, transitionXA = NULL, transitionXB = NULL, persistenceXA = NULL, persistenceXB = NULL, ...) 

## Arguments

 y Either numeric vector or time series vector. modelA The type of the ETS for the model A. modelB The type of the ETS for the model B. persistenceA The persistence vector g, containing smoothing parameters used in the model A. If NULL, then estimated. persistenceB The persistence vector g, containing smoothing parameters used in the model B. If NULL, then estimated. phiA The value of the dampening parameter in the model A. Used only for damped-trend models. phiB The value of the dampening parameter in the model B. Used only for damped-trend models. initialA Either "o" - optimal or the vector of initials for the level and / or trend for the model A. initialB Either "o" - optimal or the vector of initials for the level and / or trend for the model B. initialSeasonA The vector of the initial seasonal components for the model A. If NULL, then it is estimated. initialSeasonB The vector of the initial seasonal components for the model B. If NULL, then it is estimated. ic Information criteria to use in case of model selection. h 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"). xregA The vector or the matrix of exogenous variables, explaining some parts of occurrence variable of the model A. xregB The vector or the matrix of exogenous variables, explaining some parts of occurrence variable of the model B. initialXA The vector of initial parameters for exogenous variables in the model A. Ignored if xregA is NULL. initialXB The vector of initial parameters for exogenous variables in the model B. Ignored if xregB is NULL. xregDoA Variable defines what to do with the provided xregA: "use" means that all of the data should be used, while "select" means that a selection using ic should be done. xregDoB Similar to the xregDoA, but for the part B of the model. updateXA If TRUE, transition matrix for exogenous variables is estimated, introducing non-linear interactions between parameters. Prerequisite - non-NULL xregA. updateXB If TRUE, transition matrix for exogenous variables is estimated, introducing non-linear interactions between parameters. Prerequisite - non-NULL xregB. transitionXA The transition matrix F_x for exogenous variables of the model A. 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 xregA. transitionXB The transition matrix F_x for exogenous variables of the model B. Similar to the transitionXA. persistenceXA The persistence vector g_X, containing smoothing parameters for the exogenous variables of the model A. If NULL, then estimated. Prerequisite - non-NULL xregA. persistenceXB The persistence vector g_X, containing smoothing parameters for the exogenous variables of the model B. If NULL, then estimated. Prerequisite - non-NULL xregB. ... 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.

## Details

The function estimates probability of demand occurrence, based on the iETS_G state-space model. It involves the estimation and modelling of the two simultaneous state space equations. Thus two parts for the model type, persistence, initials etc.

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

The model is based on:

o_t \sim Bernoulli(p_t)

p_t = \frac{a_t}{a_t+b_t}

,

where a_t and b_t are the parameters of the Beta distribution and are modelled using separate ETS models.

## Value

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

• modelA - the model A of the class oes, that contains the output similar to the one from the oes() function;

• modelB - the model B of the class oes, that contains the output similar to the one from the oes() function.

• B - the vector of all the estimated parameters.

## Author(s)

Ivan Svetunkov, ivan@svetunkov.ru

es, oes
 1 2 y <- rpois(100,0.1) oesg(y, modelA="MNN", modelB="ANN")