Computing Means and Bands

Computing Means and Bands

Procedure

After running a full-distribution forecast, we are often interested in finding means and density bands of the various forecast outputs. This will allow us to plot our estimation of the full distribution of the forecast outputs.

Main Steps:

Computing means and bands is done by calling compute_meansbands. If desired, you can also write your computed means and bands as matrices by calling meansbands_matrix_all.

For example, to compute means and bands for an unconditional, full-distribution forecast of states and observables:

m = AnSchorfheide()
compute_meansbands(m, :mode, :none, [:forecaststates, forecastobs])
DSGE.compute_meansbands โ€” Function.
compute_meansbands(m, input_type, cond_type, output_vars; forecast_string = "",
    verbose = :low, kwargs...)

compute_meansbands(m, input_type, cond_type, output_var, df; forecast_string = "",
    population_data = DataFrame(), population_forecast = DataFrame(),
    verbose = :none, kwargs...)

compute_meansbands(m, input_type, cond_type, output_var, var_name, df;
    forecast_string = "", population_data = DataFrame(),
    population_forecast = DataFrame(), verbose = :low, kwargs...)

Compute means and bands for pseudo-observables, observables, and shocks, and write the results to a file. Other methods are for one output_var and one var_name respectively.

Keyword Arguments

  • forecast_string::String: forecast identifier string (the value "fcid=value" in the forecast output filename). Required when input_type == :subset

  • density_bands::Vector{Float64}: a vector of percent values (between 0 and 1) for which to compute density bands

  • minimize::Bool: if true, choose shortest interval, otherwise just chop off lowest and highest (percent/2)

  • verbose: level of error messages to be printed to screen. One of :none, :low, :high

source

The MeansBands Type

DSGE.MeansBands โ€” Type.
mutable struct MeansBands

Stores the means and bands of results for a particular set of outputs from the forecast step.

Specifically, forecasts can be made for any element in the Cartesian product of 4 sets:

  1. input_type: some subset of the parameter draws from the estimation step. See forecast_one for all possible options.

  2. cond_type: conditional type. See forecast_one for all possible options.

  3. product: a particular result computed in the forecast. This could be one of the following:

  - `hist`: smoothed histories
  - `forecast`: forecasted values
  - `shockdec`: shock decompositions
  - `irf`: impulse responses
  1. variable class: the category in which a particular variable, like :y_t, falls. Options are:
  - `state`: state (from `m.endogenous_states` or `m.endogenous_states_augmented`)
  - `obs`: observable (from `m.observables`)
  - `pseudo`: pseudoobservable (from `pseudo_measurement` equation)
  - `shock`: shock (from `m.exogenous_shocks`)

Note that the Cartesian product (product x class) is the set of options for output_vars in the forecast_one function signature.

Fields

  • metadata::Dict{Symbol,Any}: Contains metadata keeping track of the input_type, cond_type, product (history, forecast, shockdec, etc), and variable class (observable, pseudoobservable, state, etc) stored in this MeansBands structure.
  • means::DataFrame: a DataFrame of the mean of the time series
  • bands::Dict{Symbol,DataFrame}: a Dict mapping variable names to DataFrames containing confidence bands for each variable. See find_density_bands for more information.
source