Learn R Programming

APRScenario (version 0.0.3.0)

scenarios: scenarios function (fully optimized with Rcpp) This function computes the mean and covariances to draw from the conditional forecast The actual draw is done in the simscen function

Description

scenarios function (fully optimized with Rcpp) This function computes the mean and covariances to draw from the conditional forecast The actual draw is done in the simscen function

Usage

scenarios(
  h = 3,
  path = NULL,
  obs = NULL,
  free_shocks = NULL,
  n_sample = NULL,
  data_ = NULL,
  g = NULL,
  Sigma_g = NULL,
  posterior = NULL,
  matrices = NULL
)

Value

list of mu_eps, Sigma_eps, mu_y, Sigma_y, big_b, big_M, draws_used

Arguments

h

forecast horizon

path

conditional path of observables

obs

position of observable(s)

free_shocks

position of non-driving shocks (NA if all driving)

n_sample

Number of draws to sample (<= n_draws)

data_

Optional matrix of data (default taken from matrices$Z)

g

Optional matrix of non-driving shocks

Sigma_g

Optional covariance matrix of non-driving shocks

posterior

Optional posterior object (default taken from calling environment)

matrices

Optional matrices object from gen_mats() (default taken from calling environment)

Examples

Run this code
# \donttest{
library(APRScenario)
data(NKdata)

# Minimal example with a toy specification
spec <- bsvarSIGNs::specify_bsvarSIGN$new(as.matrix(NKdata[,2:4]), p = 1)
posterior <- bsvars::estimate(spec, S = 10)  # Use small S for fast test
matrices<-gen_mats(posterior = posterior, specification = spec)
# and having posterior object
 scenario_result <- scenarios(h = 2, 
                              path = c(1.0, 1.1), 
                              obs = 1, 
                              free_shocks = NA, 
                              posterior = posterior, 
                              matrices = matrices)
# }

Run the code above in your browser using DataLab