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 document “Statistical models underlying functions of ‘smooth’ package for R”. Some of the features of the package are also explained in my blog.
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
occurrenceparameter. This is the new function introduced in smooth v2.5.0, substituting the old
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
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
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
lagsparameter. Given that this function does not rely on any state space model, it might be moved to a different package at some point.
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:
summary(ourModel)– function prints brief output with explanation of what was fitted, with what parameters and errors;
fitted(ourModel)– fitted values of the model;
forecast(ourModel)– point and interval forecasts. This is needed for compatibility with Rob Hyndman’s “forecast” package.
forecast(ourModel)returns object of class
residuals(ourModel)– residuals of constructed model;
rstandard(ourModel)– standardised residuals of the model;
rstudent(ourModel)– studentised residuals of the model;
BICc(ourModel)– information criteria of the constructed model.
BICc()functions are not standard
statsfunctions and are imported from
greyboxpackage and modified in
smoothfor 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
simulate(ourModel)– produces data simulated from provided model;
summary(forecast(ourModel))– prints point and interval forecasts;
plot(forecast(ourModel))– produces graph with actuals, forecast, fitted and prediction interval using
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
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
orders(ourModel)– orders of the model (can be used with
modelType(ourModel)– returns the type of the model. Returns something like “MMM” for ETS(MMM). Can be used with
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;
formula(ourModel)– returns the formula for the measurement equation. This is just for the information and general understanding what we work with;
actuals(ourModel)– returns actual values;
multicov(ourModel)– covariance matrix of multiple steps ahead forecast errors;
pls(ourModel)- Prediction Likelihood Score for the model and the provided holdout. This is buggy and needs to be updated. Don’t rely on this method too much.