Learn R Programming

dse (version 2020.2-1)

horizonForecasts: Calculate forecasts at specified horizons

Description

Calculate forecasts at specified horizons.

Usage

is.horizonForecasts(obj)
    horizonForecasts(obj, ...)
    # S3 method for TSmodel
horizonForecasts(obj, data, horizons=1:4,
	 discard.before=minimumStartupLag(obj), compiled=.DSEflags()$COMPILED, ...)
    # S3 method for TSestModel
horizonForecasts(obj, data=NULL, ...)
    # S3 method for TSdata
horizonForecasts(obj, model, ...)
    # S3 method for forecastCov
horizonForecasts(obj,horizons=NULL, 
         discard.before=NULL, ...)

Arguments

obj

an object of class TSmodel, TSdata, or TSestModel.

model

an object of class TSmodel.

data

an object of class TSdata

horizons

a vector of integers indicating the horizon at which forecasts should be produced.

discard.before

period before which forecasts are not calculated.

compiled

if TRUE compiled code is called.

...

arguments passed to other methods.

Value

The result is a list of class horizonForecasts with elements model (a TSmodel), data, horizons, discard.before, and horizonForecasts. horizonForecasts is an array with three dimension: c(length(horizons), dim(model$data)). Projections are not calculated before discard.before or after the end of outputData(data). Each horizon is aligned so that horizonForecasts[h,t,] contains the forecast for the data point outputData(data)[t,] (from horizon[h] periods prior).

Details

Calculate multiple 'horizon'-step ahead forecasts ie. calculate forecasts but return only those indicated by horizons. Thus, for example, the result of horizonForecasts(model, data horizons=c(1,5)) would be the one-step ahead and five step ahead forecasts.

See Also

featherForecasts

Examples

Run this code
# NOT RUN {
data("eg1.DSE.data.diff", package="dse")
model <- estVARXls(eg1.DSE.data.diff)
z <-  horizonForecasts(model, eg1.DSE.data.diff)
# }

Run the code above in your browser using DataLab