Cforecast: Forecasting time series

View source: R/compare_forecast.R

CforecastR Documentation

Forecasting time series

Description

Largely a wrapper for the forecast function in the forecast package. It adds some usefull datas and graphs to validate and compare models.

Usage

Cforecast(
  object,
  h = ifelse(frequency(object) > 1, 2 * frequency(object), 10),
  level = c(80, 95),
  fan = FALSE,
  robust = FALSE,
  lambda = NULL,
  biasadj = FALSE,
  find.frequency = FALSE,
  allow.multiplicative.trend = FALSE,
  model = NULL,
  plot = TRUE,
  dates,
  ...
)

Arguments

object

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

h

number of periods for forecasting.

model

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

plot

if TRUE, it will show all the plots in execution.

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.

...

additional arguments to be passed to forecast.

Details

See the forecast function in the forecast package.

Value

See the forecast function in the forecast package. The additional objects returned are:

forecasts

The forecasts with their confidence intervals as a data.frame.

realForecPlot

A real + forecast plot.

realFitPlot

A real vs fitted values plot.

See Also

ggplot

Examples

#An easy example with AirPassengers
dates <- dateSeq(from = time(AirPassengers)[1], length.out = length(AirPassengers),
                 by = "month")
model <- CArima(as.vector(log(AirPassengers)), order = c(0, 1, 1), 
                 seasonal = list(order=c(0,1,1), period = 12))
model   
                
predModel <- Cforecast(as.vector(log(AirPassengers)), model = model, h = 24, 
                       dates = dates, plot = F) 
predModel
summary(predModel)

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