sma(data, order=NULL, ic=c("AICc","AIC","BIC"),
h=10, holdout=FALSE,
intervals=c("none","parametric","semiparametric","nonparametric"), level=0.95,
silent=c("none","all","graph","legend","output"), ...)NULL, then it is selected automatically using information criteria.
TRUE, holdout sample of size h is taken from the end of the data.
none, aka n - do not produce prediction intervals.
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.
semiparametric, sp - intervals based on covariance matrix of 1 to h steps ahead errors and assumption of normal / log-normal distribution (depending on error type).
nonparametric, np - intervals 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. Former means that parametric intervals are constructed, while latter is equivalent to none.
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").
model can accept a previously estimated SMA model and use its parameters.
model - the name of the estimated model.
timeElapsed - time elapsed for the construction of the model.
states - the matrix of the fuzzy components of ssarima, where rows correspond to time and cols to states.
transition - matrix F.
persistence - the persistence vector. This is the place, where smoothing parameters live.
order - order of moving average.
initialType - Typetof initial values used.
nParam - number of estimated parameters.
fitted - the fitted values of ETS.
forecast - the point forecast of ETS.
lower - the lower bound of prediction interval. When intervals=FALSE then NA is returned.
upper - the higher bound of prediction interval. When intervals=FALSE then NA is returned.
residuals - the residuals of the estimated model.
errors - The matrix of 1 to h steps ahead errors.
s2 - variance of the residuals (taking degrees of freedom into account).
intervals - type of intervals asked by user.
level - confidence level for intervals.
actuals - the original data.
holdout - the holdout part of the original data.
ICs - values of information criteria of the model. Includes AIC, AICc and BIC.
logLik - log-likelihood of the function.
cf - Cost function value.
cfType - Type of cost function used in the estimation.
accuracy - vector of accuracy measures for the holdout sample. In case of non-intermittent data includes: MPE, MAPE, SMAPE, MASE, sMAE, RelMAE, sMSE and Bias coefficient (based on complex numbers). In case of intermittent data the set of errors will be: sMSE, sPIS, sCE (scaled cumulative error) and Bias coefficient. This is available only when holdout=TRUE.
order).ma, es, ssarima# SMA of specific order
ourModel <- sma(rnorm(118,100,3),order=12,h=18,holdout=TRUE,intervals="p")
# SMA of arbitrary order
ourModel <- sma(rnorm(118,100,3),h=18,holdout=TRUE,intervals="sp")
summary(ourModel)
forecast(ourModel)
plot(forecast(ourModel))
Run the code above in your browser using DataLab