Learn R Programming

ForecastFramework (version 0.10.3)

SimulatedForecast: SimulatedForecast

Description

This class is a forecast where the data is many simulated trials.

Arguments

Fields

data

The data used to create the forecast.

forecastMadeTime

When the forecast was created.

forecastTimes

The times the forecast is about.

model

The model used to create the forecast.

nsim

The number of simulations.

sample

Draw a random sample from the possible model predictions. Please see implementation of the data for the properties of the sampling.

Methods

binDist(cutoffs,include.lowest = FALSE,right = TRUE)

Get the distribution of simulations of the data within fixed bins.

Value

an ArrayData.

debug(string)

A function for debugging the methods of this class. It calls the browser command. In order for methods to opt into to debugging, they need to implement the following code at the beginning: if(<method_name> %in% private$.debug){browser()}. This method exists, because the debugger is not always intuitive when it comes to debugging R6 methods.

initialize(...)

This function should be extended. Create a new instance of this class.

mean(trim = 0,na.rm = FALSE)

This method extracts the elementwise mean of the forecast. This function will not change the number of rows or columns in the data, but will convert probabilistic estimates into deterministic ones.

Value

An IncidenceMatrix with the mean over all simulations.

median(na.rm=FALSE)

This method extracts the elementwise median of the forecast. This function will not change the number of rows or columns in the data, but will convert probabilistic estimates into deterministic ones.

Value

a MatrixData.

quantile(probs,na.rm=FALSE,names=TRUE,type=7)

Get the cutoffs for each percentile in probs.

Value

an ArrayData where the rows and columns correspond to the .

undebug(string)

A function for ceasing to debug methods. Normally a method will call the browser command every time it is run. This command will stop it from doing so.

See Also

Inherits from : Forecast

Is inherited by : IncidenceForecast

Examples

Run this code
# NOT RUN {

IncidenceForecast <- R6Class(
  classname = "IncidenceForecast",
  inherit = SimulatedForecast,
  private = list(
    .data = AbstractSimulatedIncidenceMatrix$new()
  ),
  public = list(
    initialize = function(data=SimulatedIncidenceMatrix$new(),forecastTimes=c()){
      if(data$ncol != length(forecastTimes)){
        stop("The number of columns should be the number of times forecasted.")
      }
      private$.forecastMadeTime = now()
      private$.forecastTimes = forecastTimes
      private$.data = data
    }
  ),
  active = list(
    data = function(value){
      private$defaultActive(".data","private",value)
    }
  )
)

# }

Run the code above in your browser using DataLab