Learn R Programming

MSBVAR (version 0.1.1)

szbvar: Sims-Zha Bayesian VAR model estimation

Description

Estimation of the Bayesian VAR model for just identified VARs described in Sims and Zha (1998)

Usage

szbvar(dat, p, z = NULL, lambda0, lambda1, lambda3, lambda4, lambda5,
        mu5, mu6, nu = ncol(dat)+1, qm = 4, prior = 0, posterior.fit = FALSE)

Arguments

Value

Returns a list of multiple elements. This is a workhorse function to get the estimates, so nothing is displayed to the screen. The elements of the list are intended as inputs for the various post-estimation functions (e.g., impulse response analyses, forecasting, decompositions of forecast error variance, etc.)

Returns a list of the class "VARobject" with the following elements:interceptRow vector of the m interceptsar.coefsM x M X P array of the AR coefficients. The first M X M array is for lag 1, the p'th array for lag p.exog.coefs{dim(z)[2] x M matrix of the coefficients for any exogenous variables}Bhat(M*P + dim(z)[2]) x M matrix of the coefficients, where the columns correspond to the variables in the VARvcvM x M matrix of the maximum likelihood estimate of the residual covariancevcv.BhPosterior estimate of the parameter covariance that is conformable with Bhat.mean.SM x M matrix of the posterior residual covariance.St{M x M matrix of the degrees of freedom times the posterior residual covariance.}hstar(M*P + dim(z)[2]) x M prior precision + right hand side variables crossproduct.hstarinv(M*P + dim(z)[2]) x M prior covariance crossproduct (inv(hstar))H0(M*P + dim(z)[2]) x M prior precision for the parametersS0M x M prior error covarianceresiduals(T-P) x M matrix of the residualsXRight hand side variables for the estimation of BVARYLeft hand side variables for the estimation of BVARyInput data (dat)zExogenous variables matrixpLag lengthnum.exogNumber of exogenous variablesqmValue of parameter to match quarterly to monthly lag decay (4 or 12)prior.typeNumeric code for prior type: 0 = Normal-Wishart, 1 = Normal-Flat, 2 = Flat-Flat (approximate MLE)prior{List of the prior parameter: c(lambda0,lambda1,lambda3,lambda4,lambda5, mu5, mu6, nu)}marg.llfValue of the in-sample marginal log-likelihood for the data.marg.postValue of the in-sample marginal log posterior of the data.coef.postValue of the marginal log posterior estimate of the coefficients.

Details

This function estimates the Bayesian VAR (BVAR) model described by Sims and Zha (1998). This BVAR model is based a specification of the dynamic simultaneous equation representation of the model. The prior is constructed for the structural parameters.

References

Sims, C.A. and Tao Zha. 1998. "Bayesian Methods for Dynamic Multivariate Models." International Economic Review. 39(4):949-968.

Brandt, Patrick T. and John R. Freeman. 2006. "Advances in Bayesian Time Series Modeling and the Study of Politics: Theory Testing, Forecasting, and Policy Analysis". Political Analysis.

See Also

reduced.form.var.

Examples

Run this code
data(IsraelPalestineConflict)
    varnames <- colnames(IsraelPalestineConflict)

    fit.BVAR <- szbvar(IsraelPalestineConflict, p=6, z=NULL,
                           lambda0=0.6, lambda1=0.1,
                            lambda3=2, lambda4=0.25, lambda5=0, mu5=0,
                            mu6=0, nu=3, qm=4,
                            prior=0, posterior.fit=FALSE)

    # Draw from the posterior pdf of the impulse responses.
    posterior.impulses <- mc.irf.var(fit.BVAR, nsteps=10, draws=5000)

    # Plot the responses
    plot.mc.irf.var(posterior.impulses, method=c("Sims-Zha2"), component=1,
                     probs=c(0.16,0.84), varnames=varnames)

Run the code above in your browser using DataLab