This vignette explains how to use
functions in legion
package, what they produce, what each
field in outputs and what returned values mean.
The package includes the following functions:
legion
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, errors etc;summary(ourModel)
– alias for
print(ourModel)
;actuals(ourModel)
– returns actual values;fitted(ourModel)
– fitted values of the model;residuals(ourModel)
– residuals of constructed model;
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 legion
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.legion()
for more details. Prepare the canvas via
par(mfcol=...)
before using this function otherwise the
plotting might take time.forecast(ourModel)
– point and interval forecasts;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. Only works for ves()
for now;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);nvariate(ourModel)
– number of variates, time series in
the model (originally from greybox
package);sigma(ourModel)
– covariance matrix of the residuals of
the model;modelType(ourModel)
– returns the type of the model.
Returns something like “MMM” for ETS(MMM). Can be used with
ves()
and vets()
. In the latter case can also
accept pic=TRUE
, returning the PIC restrictions;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;