specify_forecasts: R6 Class Representing Forecasts

specify_forecastsR Documentation

R6 Class Representing Forecasts

Description

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

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.

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

Public methods


Forecasts$new()

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

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


Forecasts$get_forecasts()

Converts the Forecasts object to a list.

Usage
Forecasts$get_forecasts()
Returns

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


Forecasts$clone()

The objects of this class are cloneable with this method.

Usage
Forecasts$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

spec = specify_bsvar$new(us_fiscal_lsuw)
burn = estimate(spec, 5)
post = estimate(burn, 5)
fore = forecast(post, 4)
apply(fore$forecasts, 1:2, mean) # compute mean forecasts 


bsvars documentation built on Aug. 22, 2026, 5:09 p.m.