horizonForecasts: Calculate forecasts at specified horizons

Description Usage Arguments Details Value See Also Examples

View source: R/dse2.R

Description

Calculate forecasts at specified horizons.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
    is.horizonForecasts(obj)
    horizonForecasts(obj, ...)
    ## S3 method for class 'TSmodel'
horizonForecasts(obj, data, horizons=1:4,
	 discard.before=minimumStartupLag(obj), compiled=.DSEflags()$COMPILED, ...)
    ## S3 method for class 'TSestModel'
horizonForecasts(obj, data=NULL, ...)
    ## S3 method for class 'TSdata'
horizonForecasts(obj, model, ...)
    ## S3 method for class '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.

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.

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).

See Also

featherForecasts

Examples

1
2
3
data("eg1.DSE.data.diff", package="dse")
model <- estVARXls(eg1.DSE.data.diff)
z <-  horizonForecasts(model, eg1.DSE.data.diff)

Example output

Loading required package: tfplot
Loading required package: tframe

Attaching package: 'dse'

The following objects are masked from 'package:stats':

    acf, simulate

dse documentation built on March 4, 2020, 3:01 a.m.