This vignette explains how to use functions in smooth
package, what they produce, what each field in outputs and what returned
values mean. Underlying statistical models are not discussed here, but
if you want to know more about them, then there is a working paper “Smooth forecasting with
the smooth package in R”. Some of the features of the package are
also explained in my blog. Finally,
I have a monograph Forecasting
and Analytics with the Augmented Dynamic Adaptive Model (ADAM),
which explains the model underlying the majority of forecasting
functions in the package.
The package includes the following functions:
msarima()
, aka Multiple
Seasonal ARIMA;smoothCombine()
- function that combines forecasts of
the main univariate functions of smooth package based on information
criteria.oes()
can then be used in any
forecasting function as input variable for occurrence
parameter. This is the new function introduced in smooth v2.5.0,
substituting the old iss()
function.The functions (1) - (4) and (6) return object of class
smooth
, (5) returns the object of class
vsmooth
, (7) returns smooth.sim
class and
finally (8) returns oes
or viss
(depending on
the function used). There are several methods for these classes in the
package.
Some other functions, which are not considered as core and important:
cma()
- Centred Moving Average based on
sma()
and msarima()
msdecompose
- Multiple Seasonal Decomposition based on
centred moving averages. Useful if a series with several frequencies
need to be decomposed. The frequencies are specified separately in the
lags
parameter. Given that this function does not rely on
any state space model, it might be moved to a different package at some
point.smooth
There are several methods that can be used together with the
forecasting functions of the package. When a model is saved to some
object ourModel
, these function will do some magic. Here’s
the list of all the available methods with brief explanations:
print(ourModel)
– function prints brief output with
explanation of what was fitted, with what parameters and errors;summary(ourModel)
– returns an output with parameters,
standard errors and confidence intervals in case of adam()
function. For the other functions it is equivalent to
print(ourModel)
;actuals(ourModel)
– returns actual values;fitted(ourModel)
– fitted values of the model;residuals(ourModel)
– residuals of constructed
model;rstandard(ourModel)
– standardised residuals of the
model;rstudent(ourModel)
– studentised residuals of the
model;rmultistep(ourModel)
– returns in sample multiple steps
ahead forecast errors;AIC(ourModel)
, BIC(ourModel)
,
AICc(ourModel)
and BICc(ourModel)
–
information criteria of the constructed model. AICc()
and
BICc()
functions are not standard stats
functions and are imported from greybox
package and
modified in smooth
for the specific models;plot(ourModel)
– produces plots for the diagnostics of
the constructed model. There are 9 options of what to produce, see
?plot.smooth()
for more details. Note that if the number of
states is higher than 10, then several graphs are produced for the
option which=9
.forecast(ourModel)
– point and interval forecasts.
Returns object of class smooth.forecast
;plot(forecast(ourModel))
– produces graph with actuals,
forecast, fitted and prediction interval using graphmaker()
function from greybox
package.simulate(ourModel)
– produces data simulated from
provided model (not supported by adam()
yet);logLik(ourModel)
– returns log-likelihood of the
model;nobs(ourModel)
– returns number of observations
in-sample we had;nparam(ourModel)
– number of estimated parameters
(originally from greybox
package);pointLik(ourModel)
– likelihood values for each
separate observation;sigma(ourModel)
– variance of the residuals of the
model;lags(ourModel)
– lags of the model (used with
ssarima()
and gum()
);orders(ourModel)
– orders of the model (can be used
with ssarima()
, gum()
and
sma()
);modelType(ourModel)
– returns the type of the model.
Returns something like “MMM” for ETS(MMM). Can be used with
es()
, ces()
and ets()
;errorType(ourModel)
– the type of the error of a model
(additive or multiplicative);coef(ourModel)
– returns the vector of all the
estimated coefficients of the model;confint(ourModel)
– returns confidence intervals for
parameters of the model. Only works with adam()
;vcov(ourModel)
– returns the covariance matrix of
parameters. Only works with adam()
;coefbootstrap(ourModel)
– returns the bootstrapped
coefficients of model (imported from greybox
package). Only
works with adam()
;formula(ourModel)
– returns the formula for the
measurement equation. This is a proper formula in case of
adam()
and only decorative one for all the other
functions;multicov(ourModel)
– covariance matrix of multiple
steps ahead forecast errors;refit(ourModel)
– produces bootstrapped trajectories
from adam()
model. Only works with
adam()
;reforecast(ourModel)
– produces forecasts based on
bootstrapped trajectories from a model. Only works with
adam()
;