-
-#' Initialize empty Forecast object
-#'
-#' @param o Object of class Forecast
-#' @param private List of private members in o
-#' @param dates vector of dates where forecast occurs
-initializeForecast = function(o, private, dates)
-{
- private$.dates <- dates
- invisible(o)
-}
-
-#' Number of individual forecasts"
-#'
-#' @inheritParams initializeForecast
-getSizeForecast = function(private)
- length(private$.pred)
-
-#' Obtain a new pair (serie, params)"
-#'
-#' @inheritParams initializeForecast
-#' @param new_serie Values of a new serie
-#' @param new_params Associated (optimized) parameters
-#' @param new_index_in_data Corresponding index in data
-appendForecast = function(private, new_serie, new_params, new_index_in_data)
-{
- private$.pred[[length(private$.pred)+1]] <-
- list("serie"=new_serie, "params"=new_params, "index_in_data"=new_index_in_data)
-}
-
-#' Dates where prediction occurs
-#'
-#' inheritParams initializeForecast
-getDatesForecast = function(private)
- private$.dates
-
-#' Serie values at specified index"
-#'
-#' @inheritParams initializeForecast
-#' @param index Return value at this index
-getSerieForecast = function(index)
-{
- if (is(index,"Date"))
- index = match(index, private$.dates)
- private$.pred[[index]]$serie
-}
-
-#' Params at specified index"
-#'
-#' @inheritParams getSerieForecast
-getParamsForecast = function(index)
-{
- if (is(index,"Date"))
- index = match(index, private$.dates)
- private$.pred[[index]]$params
-}
-
-#' (day) Index in data where prediction took place"
-#'
-#' @inheritParams getSerieForecast
-getIndexInDataForecast = function(index)
-{
- if (is(index,"Date"))
- index = match(index, private$.dates)
- private$.pred[[index]]$index_in_data
-}