View source: R/compare_forecast.R
compareARIMA | R Documentation |
Compare up to three ARIMA models of the class CArima
, with theirs metrics (Sigma square, AIC and SBC) and their forecasting performance.
compareARIMA(object, dates, m1, m2, m3, h = 10, plot = T)
object |
a time series object or a matrix containing the time series values. |
dates |
a vector or an array with the dates as |
m1 |
an object describing a time series model; e.g. of class |
m2 |
an object describing a time series model; e.g. of class |
m3 |
an object describing a time series model; e.g. of class |
h |
number of points that will not be used to fit the model, but to use as testing. The points will be taken from the bottom. |
plot |
if |
An object of class compareARIMA
containing:
metrics |
Some metrics of the models, such as AIC, Sigma square, SBC, SSE of prediction and two Ljung-Box test values. |
SSEtable |
A merge of the |
forecasts |
A merge of the |
forecPlot1 |
A plot of the forecasts values and the confidence intervals calculated of m1 obtained with |
forecPlot2 |
A plot of the forecasts values and the confidence intervals calculated of m2 obtained with |
forecPlot3 |
A plot of the forecasts values and the confidence intervals calculated of m3 obtained with |
bandWidthComp |
A data frame with the forecasts band widths of each model in a column. |
bandWidthPlot |
A plot of the forecasts band widths of each model. |
ggplot
, predCap
.
#Some examples with AirPassengers dates <- dateSeq(from = time(AirPassengers)[1], length.out = length(AirPassengers), by = "month") model1 <- CArima(as.vector(log(AirPassengers)), order = c(0, 1, 1), seasonal = list(order=c(0,0,1), period = 12)) model1 model2 <- CArima(as.vector(log(AirPassengers)), order = c(0, 1, 1), seasonal = list(order=c(0,1,1), period = 12)) model2 model3 <- CArima(as.vector(log(AirPassengers)), order = c(1, 1, 0), seasonal = list(order=c(1, 1, 0), period = 12)) model3 comp <- compareARIMA(as.vector(log(AirPassengers)), dates, model1, model2, model3, h = 12, plot = F) comp
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.