Post Estimation Commands

The PostEstimation submodule provides a set of functions for post-estimation analysis. These functions are designed to work with the output of the model estimation process and provide further insights into the model's behavior. The functions provide plots of impulse responses, variance decompositions and historical decompositions, as well as tables in form of dataframes, where appropriate.

Usage

You can use these functions by importing the PostEstimation module. Here's an example:

using .BASEforHANK.PostEstimation

# Now you can call the functions
compute_hist_decomp(...)

Functions

Impulse Responses

BASEforHANK.PostEstimation.compute_irfs_vardecompFunction
compute_irfs_vardecomp(models, select_variables)

This function calculates a variance decomposition of the given models for selected variables. It returns four outputs: the impulse responses, the fixed horizon decompositions, the list of shocks that drive the model, and finally the variance decomposition based on the method proposed by Uhlig (2001).

Arguments

  • models: The models for which the variance decomposition will be calculated. This should be a collection of models.
  • select_variables: The variables selected for the variance decomposition. This should be a collection of variable names.

Returns

  • IRFs: The impulse responses of the models.
  • VDs: The fixed horizon decompositions of the models.
  • SHOCKs: The shocks applied to the models.
  • VD_bc_s: The variance decomposition based on the method proposed by Harald Uhlig (2001).

Examples

IRFs, VDs, SHOCKs, VD_bc_s = compute_irfs_vardecomp(models, select_variables)
source
BASEforHANK.PostEstimation.plot_irfsFunction
plot_irfs(IRFs, SHOCKs, select_variables, nice_var_names, nice_s_names, horizon, model_names, n_plotcol; savepdf = false, disp_switch = true, suffix = "")

This function is designed to plot impulse response functions (IRFs). It takes as input the impulse responses, shocks, selected variables, nice variable names, nice shock names, horizon, model names, and number of plot columns, and generates a plot.

Arguments

  • IRFs: The impulse responses to be plotted. This should be a collection of impulse responses (an Array).
  • SHOCKs: The symbols of the shocks applied to the models.
  • select_variables: The variables to be displayed in the plot. This should be a collection of variable names, a collection of strings.
  • nice_var_names: The readable names of the variables to be displayed in the plot. This should be a collection of strings.
  • nice_s_names: The readable names of the shocks to be displayed in the plot. This should be a collection of strings.
  • horizon: The horizon over which to plot the impulse response functions.
  • model_names: The names of the models. This should be an array of strings.
  • n_plotcol: The number of plot columns.

Optional Arguments

  • savepdf: A boolean indicating whether to save the plot as a PDF. Default is false.
  • disp_switch: A boolean indicating whether to display the switch. Default is true.
  • suffix: A string to be appended to the end of the file name when saving the plot as a PDF.

Returns

  • This function returns a vector of plots.

Examples

plot_irfs(IRFs, SHOCKs, select_variables, nice_var_names, nice_s_names, horizon, model_names, n_plotcol)
source

Variance Decomposition

BASEforHANK.PostEstimation.compute_bcfreq_vardecompFunction
compute_bcfreq_vardecomp(sr, lr, e_set, m_par; passband = (6, 32), ngrid = 512)

This function is designed to produce a variance decomposition at business cycle frequencies. It produces a variance decomposition of the linearized solution. It returns the variance decomposition at business cycle frequencies based on Uhlig (2001) and the unconditional variance.

Arguments

  • sr: Steady state.
  • lr: Linearized Solution.
  • e_set: Estimation parameters.
  • m_par: Model parameters.
  • passband: A tuple specifying the horizons associated with the business cycle. Default is (6, 32).
  • ngrid: The number of grid points for the computation of the band pass filter. Default is 512.

Returns

  • var_decomp: This function returns a variance decomposition.

Examples

var_decomp = compute_bcfreq_vardecomp(sr, lr, e_set, m_par)
source
BASEforHANK.PostEstimation.plot_vardecompFunction
plot_vardecomp(VDs, VD_bc_s, select_vd_horizons, model_names, SHOCKs, select_variables; savepdf = false, suffix = "", legend_switch = true, disp_switch = true)

This function is designed to plot variance decompositions. It takes as input the variance decompositions. These are the variance decomposition based on the method proposed by Harald Uhlig (2001) as well as variance decomposition at fixed horizons. It further expects as inputs model names, shocks as symbols, and the variables selected to be displayed. It generates a plot.

Arguments

  • VDs: The variance decompositions to be plotted. This should be a collection of variance decompositions at fixed horizons.
  • VD_bc_s: The variance decomposition based on the method proposed by Harald Uhlig (2001).
  • select_vd_horizons: The horizons of the variance decompositions to be displayed in the plot. This should be a collection of integers.
  • model_names: The names of the models for which the varaiance decompositions are provided. This should be an array of strings.
  • SHOCKs: The symbols of the shocks applied to the models.
  • select_variables: The variables to be displayed in the plot. This should be a collection of variable names.

Optional Arguments

  • savepdf: A boolean indicating whether to save the plot as a PDF. Default is false.
  • suffix: A string to be appended to the end of the file name when saving the plot as a PDF.
  • legend_switch: A boolean indicating whether to display the legend. Default is true.
  • disp_switch: A boolean indicating whether to display the switch. Default is true.

Returns

  • This function returns the plotted variance decompositions as data frames.

Examples

plot_vardecomp(VDs, VD_bc_s, select_vd_horizons, model_names, SHOCKs, select_variables)
source
BASEforHANK.PostEstimation.compute_vardecomp_boundsFunction
compute_vardecomp_bounds(models, select_variables, model_names; n_replic = 1000, percentile_bounds = (0.05, 0.95))

This function uses a Monte Carlo method to determine the credible bounds for the variance decomposition of the given models for selected variables, based on the method proposed by Uhlig (2001).

Arguments

  • models: The models for which the variance decomposition will be calculated. This should be a collection of models .
  • select_variables: The variables selected for the variance decomposition. This should be a collection of variable names.
  • model_names: The names of the models. This should be a collection of strings.
  • n_replic: The number of replications for the Monte Carlo method. Default is 1000.
  • percentile_bounds: A tuple specifying the lower and upper percentile bounds for the credible interval. Default is (0.05, 0.95).

Returns

  • bounds: This function returns the credible bounds for the variance decomposition of the models.

Examples

bounds = compute_vardecomp_bounds(models, select_variables, model_names)
source

Historical Decomposition

BASEforHANK.PostEstimation.compute_hist_decompFunction
compute_hist_decomp(sr, lr, e_set, m_par, smoother_output, select_variables, timeline; savepdf = false, prefix = "")

This function is designed to compute historical decompositions. It takes as input the steady state structures (sr), linearized solutions (lr), the estimation settings (eset), model parameters (mpar), smoother output, selected variables, and timeline.

Arguments

  • sr: The steady state of the model.
  • lr: The linearized solution of the model.
  • e_set: The estimation settings.
  • m_par: The parameters of the model.
  • smoother_output: The output of the smoother.
  • select_variables: The variables to be included in the historical decomposition. This should be a collection of variable names.
  • timeline: The timeline for the historical decomposition.

Optional Arguments

  • savepdf: A boolean indicating whether to save the output as a PDF. Default is false.
  • prefix: A string to be prepended to the file name when saving the output as a PDF.

Returns

  • ShockContribution: the series of shock contribution for each variable and each shock.
  • HistDecDF: the historical decomposition as a data frame,
  • p: and the plot as a vector of plots.

Examples

compute_hist_decomp(sr, lr, e_set, m_par, smoother_output, select_variables, timeline)
source