adam  R Documentation 
Function constructs an advanced Single Source of Error model, based on ETS taxonomy and ARIMA elements
adam(data, model = "ZXZ", lags = c(frequency(data)), orders = list(ar = c(0), i = c(0), ma = c(0), select = FALSE), constant = FALSE, formula = NULL, regressors = c("use", "select", "adapt"), occurrence = c("none", "auto", "fixed", "general", "oddsratio", "inverseoddsratio", "direct"), distribution = c("default", "dnorm", "dlaplace", "ds", "dgnorm", "dlnorm", "dinvgauss", "dgamma"), loss = c("likelihood", "MSE", "MAE", "HAM", "LASSO", "RIDGE", "MSEh", "TMSE", "GTMSE", "MSCE"), outliers = c("ignore", "use", "select"), level = 0.99, h = 0, holdout = FALSE, persistence = NULL, phi = NULL, initial = c("optimal", "backcasting"), arma = NULL, ic = c("AICc", "AIC", "BIC", "BICc"), bounds = c("usual", "admissible", "none"), silent = TRUE, ...) auto.adam(data, model = "ZXZ", lags = c(frequency(data)), orders = list(ar = c(0), i = c(0), ma = c(0), select = FALSE), formula = NULL, regressors = c("use", "select", "adapt"), occurrence = c("none", "auto", "fixed", "general", "oddsratio", "inverseoddsratio", "direct"), distribution = c("dnorm", "dlaplace", "ds", "dgnorm", "dlnorm", "dinvgauss", "dgamma"), outliers = c("ignore", "use", "select"), level = 0.99, h = 0, holdout = FALSE, persistence = NULL, phi = NULL, initial = c("optimal", "backcasting"), arma = NULL, ic = c("AICc", "AIC", "BIC", "BICc"), bounds = c("usual", "admissible", "none"), silent = TRUE, parallel = FALSE, ...) ## S3 method for class 'adam' sm(object, model = "YYY", lags = NULL, orders = list(ar = c(0), i = c(0), ma = c(0), select = FALSE), constant = FALSE, formula = NULL, regressors = c("use", "select", "adapt"), data = NULL, persistence = NULL, phi = NULL, initial = c("optimal", "backcasting"), arma = NULL, ic = c("AICc", "AIC", "BIC", "BICc"), bounds = c("usual", "admissible", "none"), silent = TRUE, ...)
data 
Vector, containing data needed to be forecasted. If a matrix (or
data.frame / data.table) is provided, then the first column is used as a
response variable, while the rest of the matrix is used as a set of explanatory
variables. 
model 
The type of ETS model. The first letter stands for the type of
the error term ("A" or "M"), the second (and sometimes the third as well) is for
the trend ("N", "A", "Ad", "M" or "Md"), and the last one is for the type of
seasonality ("N", "A" or "M"). In case of several lags, the seasonal components
are assumed to be the same. The model is then printed out as
ETS(M,Ad,M)[m1,m2,...], where m1, m2, ... are the lags specified by the
Also, Keep in mind that model selection with "Z" components uses Branch and Bound algorithm and may skip some models that could have slightly smaller information criteria. If you want to do a exhaustive search, you would need to list all the models to check as a vector. The default value is set to 
lags 
Defines lags for the corresponding components. All components
count, starting from level, so ETS(M,M,M) model for monthly data will have

orders 
The order of ARIMA to be included in the model. This should be passed
either as a vector (in which case the nonseasonal ARIMA is assumed) or as a list of
a type 
constant 
Logical, determining, whether the constant is needed in the model or not.
This is mainly needed for ARIMA part of the model, but can be used for ETS as well. In
case of pure regression, this is completely ignored (use 
formula 
Formula to use in case of explanatory variables. If 
regressors 
The variable defines what to do with the provided explanatory
variables:

occurrence 
The type of model used in probability estimation. Can be
The type of model used in the occurrence is equal to the one provided in the
Also, a model produced using oes or alm function can be used here. 
distribution 
what density function to assume for the error term. The full
name of the distribution should be provided, starting with the letter "d" 
"density". The names align with the names of distribution functions in R.
For example, see dnorm. For detailed explanation of available
distributions, see vignette in greybox package: 
loss 
The type of Loss Function used in optimization.
In case of LASSO / RIDGE, the variables are not normalised prior to the estimation, but the parameters are divided by the mean values of explanatory variables. Note that model selection and combination works properly only for the default
Furthermore, just for fun the absolute and half analogues of multistep estimators
are available: Last but not least, user can provide their own function here as well, making sure
that it accepts parameters

outliers 
Defines what to do with outliers: 
level 
What confidence level to use for detection of outliers. The default is 99%. The specific bounds of confidence interval depend on the distribution used in the model. 
h 
The forecast horizon. Mainly needed for the multistep loss functions. 
holdout 
Logical. If 
persistence 
Persistence vector g, containing smoothing
parameters. If 
phi 
Value of damping parameter. If 
initial 
Can be either character or a list, or a vector of initial states.
If it is character, then it can be 
arma 
Either the named list or a vector with AR / MA parameters ordered lagwise.
The number of elements should correspond to the specified orders e.g.

ic 
The information criterion to use in the model selection / combination procedure. 
bounds 
The type of bounds for the persistence to use in the model
estimation. Can be either 
silent 
Specifies, whether to provide the progress of the function or not.
If 
... 
Other nondocumented parameters. For example,
You can also pass parameters to the optimiser in order to fine tune its work:
You can read more about these parameters by running the function
nloptr.print.options.
Finally, the parameter 
parallel 
If TRUE, the estimation of ADAM models is done in parallel (used in 
object 
The model previously estimated using 
Function estimates ADAM in a form of the Single Source of Error state space model of the following type:
y_{t} = o_t (w(v_{tl}) + h(x_t, a_{t1}) + r(v_{tl}) ε_{t})
v_{t} = f(v_{tl}, a_{t1}) + g(v_{tl}, a_{t1}, x_{t}) ε_{t}
Where o_{t} is the Bernoulli distributed random variable (in case of normal data it equals to 1 for all observations), v_{t} is the state vector and l is the vector of lags, x_t is the vector of exogenous variables. w(.) is the measurement function, r(.) is the error function, f(.) is the transition function, g(.) is the persistence function and a_t is the vector of parameters for exogenous variables. Finally, ε_{t} is the error term.
The implemented model allows introducing several seasonal states and supports
intermittent data via the occurrence
variable.
The error term ε_t can follow different distributions, which
are regulated via the distribution
parameter. This includes:
default
 Normal distribution is used for the Additive error models,
Gamma is used for the Multiplicative error models.
dnorm  Normal distribution,
dlaplace  Laplace distribution,
ds  S distribution,
dgnorm  Generalised Normal distribution,
dlnorm  LogNormal distribution,
dgamma  Gamma distribution,
dinvgauss  Inverse Gaussian distribution,
For some more information about the model and its implementation, see the
vignette: vignette("adam","smooth")
. The more detailed explanation
of ADAM is provided by Svetunkov (2021).
The function auto.adam()
tries out models with the specified
distributions and returns the one with the most suitable one based on selected
information criterion.
sm.adam method estimates the scale model for the already estimated adam. In order for ADAM to take the SM model into account, the latter needs to be recorded in the former, amending the likelihood and the number of degrees of freedom. This can be done using implant method.
Object of class "adam" is returned. It contains the list of the following values:
model
 the name of the constructed model,
timeElapsed
 the time elapsed for the estimation of the model,
data
 the insample part of the data used for the training of the model. Includes
the actual values in the first column,
holdout
 the holdout part of the data, excluded for purposes of model evaluation,
fitted
 the vector of fitted values,
residuals
 the vector of residuals,
forecast
 the point forecast for h steps ahead (by default NA is returned). NOTE
that these do not always correspond to the conditional expectations for ETS models. See ADAM
textbook, Section 6.4. for details (https://openforecast.org/adam/ETSTaxonomyMaths.html),
states
 the matrix of states with observations in rows and states in columns,
persisten
 the vector of smoothing parameters,
phi
 the value of damping parameter,
transition
 the transition matrix,
measurement
 the measurement matrix with observations in rows and state elements
in columns,
initial
 the named list of initial values, including level, trend, seasonal, ARIMA
and xreg components,
initialEstimated
 the named vector, defining which of the initials were estimated in
the model,
initialType
 the type of initialisation used ("optimal" / "backcasting" / "provided"),
orders
 the orders of ARIMA used in the estimation,
constant
 the value of the constant (if it was included),
arma
 the list of AR / MA parameters used in the model,
nParam
 the matrix of the estimated / provided parameters,
occurrence
 the oes model used for the occurrence part of the model,
formula
 the formula used for the explanatory variables expansion,
loss
 the type of loss function used in the estimation,
lossValue
 the value of that loss function,
logLik
 the value of the loglikelihood,
distribution
 the distribution function used in the calculation of the likelihood,
scale
 the value of the scale parameter,
lambda
 the value of the parameter used in LASSO / dalaplace / dt,
B
 the vector of all estimated parameters,
lags
 the vector of lags used in the model construction,
lagsAll
 the vector of the internal lags used in the model,
profile
 the matrix with the profile used in the construction of the model,
profileInitial
 the matrix with the initial profile (for the before the sample values),
call
 the call used in the evaluation,
bounds
 the type of bounds used in the process,
other
 the list with other parameters, such as shape for distributions or ARIMA
polynomials.
Ivan Svetunkov, ivan@svetunkov.ru
Svetunkov, I. (2021) Time Series Analysis and Forecasting with ADAM: Lancaster, UK. https://openforecast.org/adam/.
Snyder, R. D., 1985. Recursive Estimation of Dynamic Linear Models. Journal of the Royal Statistical Society, Series B (Methodological) 47 (2), 272276.
Hyndman, R.J., Koehler, A.B., Ord, J.K., and Snyder, R.D. (2008) Forecasting with exponential smoothing: the state space approach, SpringerVerlag. doi: 10.1007/9783540719182.
Svetunkov Ivan and Boylan John E. (2017). Multiplicative StateSpace Models for Intermittent Time Series. Working Paper of Department of Management Science, Lancaster University, 2017:4 , 143.
Teunter R., Syntetos A., Babai Z. (2011). Intermittent demand: Linking forecasting to inventory obsolescence. European Journal of Operational Research, 214, 606615.
Croston, J. (1972) Forecasting and stock control for intermittent demands. Operational Research Quarterly, 23(3), 289303.
Syntetos, A., Boylan J. (2005) The accuracy of intermittent demand estimates. International Journal of Forecasting, 21(2), 303314.
Kolassa, S. (2011) Combining exponential smoothing forecasts using Akaike weights. International Journal of Forecasting, 27, pp 238  251.
Taylor, J.W. and Bunn, D.W. (1999) A Quantile Regression Approach to Generating Prediction Intervals. Management Science, Vol 45, No 2, pp 225237.
Lichtendahl Kenneth C., Jr., GrushkaCockayne Yael, Winkler Robert L., (2013) Is It Better to Average Probabilities or Quantiles? Management Science 59(7):15941611. DOI: doi: 10.1287/mnsc.1120.1667
es, msarima
### The main examples are provided in the adam vignette, check it out via: ## Not run: vignette("adam","smooth") # Model selection using a specified pool of models ourModel < adam(rnorm(100,100,10), model=c("ANN","ANA","AAA"), lags=c(5,10)) summary(ourModel) forecast(ourModel) par(mfcol=c(3,4)) plot(ourModel, c(1:11)) # Model combination using a specified pool ourModel < adam(rnorm(100,100,10), model=c("ANN","AAN","MNN","CCC"), lags=c(5,10)) # ADAM ARIMA ourModel < adam(rnorm(100,100,10), model="NNN", lags=c(1,4), orders=list(ar=c(1,0),i=c(1,0),ma=c(1,1))) ourModel < auto.adam(rnorm(100,100,10), model="ZZN", lags=c(1,4), orders=list(ar=c(2,2),ma=c(2,2),select=TRUE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.