compareARIMA: Compare ARIMA Models

View source: R/compare_forecast.R

compareARIMAR Documentation

Compare ARIMA Models

Description

Compare up to three ARIMA models of the class CArima, with theirs metrics (Sigma square, AIC and SBC) and their forecasting performance.

Usage

compareARIMA(object, dates, m1, m2, m3, h = 10, plot = T)

Arguments

object

a time series object or a matrix containing the time series values.

dates

a vector or an array with the dates as character of each observation of the time series. This vector can be generated using the function dateSeq.

m1

an object describing a time series model; e.g. of class CArima.

m2

an object describing a time series model; e.g. of class CArima.

m3

an object describing a time series model; e.g. of class CArima.

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 TRUE, it will show all the plots in execution.

Value

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 SSEtable of m1 and m2 obtained with predCap function.

forecasts

A merge of the forecasts of m1 and m2 obtained with predCap function.

forecPlot1

A plot of the forecasts values and the confidence intervals calculated of m1 obtained with predCap function.

forecPlot2

A plot of the forecasts values and the confidence intervals calculated of m2 obtained with predCap function.

forecPlot3

A plot of the forecasts values and the confidence intervals calculated of m3 obtained with predCap function.

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.

See Also

ggplot, predCap.

Examples

#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

danipequelangos/CBJTSA documentation built on Oct. 16, 2022, 7:19 p.m.