Learn R Programming

MSBVAR (version 0.9-2)

plot.gibbs.A0: Plot a parameter density summary for B-SVAR A(0) objects

Description

Generates an $m x m$ matrix of density plots for each free parameter in an szbsvar $A(0)$ object produced by gibbs.A0, with associated highest posterior density (HPD) regions.

Usage

"plot"(x, hpd = 0.68, varnames=attr(x, "eqnames"), ...)

Arguments

x
An $A(0)$ posterior object created by szbsvar.
hpd
Probability width of the highest posterior density region, default is 0.68 or approximately one standard deviation around the mode of the parameter
varnames
List of variable names for labeling the equations and variables. Default are the names of the variables for the input data to szbsvar as fed through gibbs.A0. For an SVAR, users often want to relabel these as economic sectors or groups of actors for the time series and this is the place this can be done.
...
optional graphics arguments

Value

None. Main purposed is to plot density summaries and HPDs for each of the free parameters in an $A(0)$ matrix.

Details

This function plots an $m x m$ matrix of densities for the posterior of the $A(0)$ free parameters for a B-SVAR model. The plot is arranged such that the unrestricted parameters for each contemporaneous effect of each variable on an equation are in the row for that equation. So the first row shows densities for the contemporaneous effects of the column variables (as in an impulse response plot like plot.irf or plot.mc.irf). Elements of $A(0)$ that were restricted to zero are left empty in the matrix of densities. The pattern of the densities will match the *tranpose* of the ident matrix passed to szbsvar.

Highest posterior density regions are plotted using Hyndman's 91996) density quantile algorithm. These HPDs are defined by a set of vertical bars over the HPD interval. The vertical line in each plot measures the value of the density at the boundaries of the HPD region. The HDR is superimposed at the bottom of each density.

References

Hyndman, Rob J. 1996. "Computing and Graphic Highest Density Regions", The American Statistician, 50(2):120--126

HPD code is borrowed from Hyndman's hdrcde package, version 2.07.

See Also

plot.mcmc, summary.mcmc, and A02mcmc.

Examples

Run this code
# SZ, B-SVAR model for the Levant data
data(BCFdata)
m <- ncol(Y)
ident <- diag(m)
ident[1,] <- 1
ident[2,1] <- 1

# estimate the model's posterior moments
set.seed(123)
model <- szbsvar(Y, p=2, z=z2, lambda0=0.8, lambda1=0.1, lambda3=1, lambda4=0.1,
                 lambda5=0.05, mu5=0, mu6=5, ident, qm=12)

# Set length of burn-in and size of posterior.  These are only an
# example.  Production runs should set these much higher.
N1 <- 1000
N2 <- 10000

A0.posterior.obj <- gibbs.A0(model, N1, N2, thin=1)

# Plot the matrix of the densities
dev.new()
plot.gibbs.A0(A0.posterior.obj, hpd=0.68, varnames=colnames(Y))

Run the code above in your browser using DataLab