Learn R Programming

bsvarSIGNs (version 3.0)

specify_forecasts: R6 Class Representing Forecasts

Description

R6 class representing draws from the predictive density of a Bayesian Structural Vector Autoregression model.

Arguments

Value

An object of class Forecasts.

Public fields

forecasts

An N x horizon x S numeric array containing draws from the predictive density.

forecast_mean

An N x horizon x S numeric array containing the conditional means of the predictive density.

forecast_covariance

An N x N x horizon x S numeric array containing the conditional covariance matrices of the predictive density.

Y

An N x T numeric matrix containing the data on the dependent variables used for estimation.

Methods


Method new()

Creates a new Forecasts object from the output of the forecasting procedure.

Usage

specify_forecasts$new(output, Y)

Arguments

output

A list containing the forecasting output, including forecasts, forecast_mean, and forecast_cov.

Y

An N x T matrix containing the data on the dependent variables.

Returns

An object of class Forecasts.


Method get_forecasts()

Converts the Forecasts object to a list.

Usage

specify_forecasts$get_forecasts()

Returns

A list containing forecasts, forecast_mean, forecast_covariance, and Y.


Method clone()

The objects of this class are cloneable with this method.

Usage

specify_forecasts$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Details

The class contains the following objects:

forecasts

An N x horizon x S array containing draws from the predictive density.

forecast_mean

An N x horizon x S array containing the conditional means of the predictive density.

forecast_covariance

An N x N x horizon x S array containing the conditional covariance matrices of the predictive density.

Y

An N x T matrix containing the data on the dependent variables used for estimation.

The method as_list() returns the contents of the Forecasts object as a list.

Examples

Run this code
spec = specify_bsvarSIGN$new(optimism * 100)
post = estimate(spec, 5)
fore = forecast(post, 4)
apply(fore$forecasts, 1:2, mean) # compute mean forecasts 

Run the code above in your browser using DataLab