Learn R Programming

MSBVAR (version 0.3.2)

SZ.prior.evaluation: Sims-Zha Bayesian VAR Prior Specification Search

Description

Estimates posterior and in-sample fit measures for a reduced form vector autoregression model with different specifications of the Sims-Zha hyperparameters values.

Usage

SZ.prior.evaluation(Y, p,
                    lambda0, lambda1, lambda3, lambda4, lambda5,
                    mu5, mu6, z = NULL, nu = ncol(Y) + 1, qm,
                    prior = 0, nstep, y.future)

Arguments

Value

A matrix of the results with columns corresponding to the values of "lambda0", "lambda1", "lambda3", "lambda4", "lambda5", "mu5", "mu6", "RMSE", "MAE", "MargLLF","MargPosterior".

Details

This function fits a series of BVAR models for the combinations of lambda0, lambda1, lambda3, and lambda4 provided. For each possible value of these parameters specified, a Sims-Zha prior BVAR model is fit, posterior fit measures are computed, and forecasts are generated over nsteps. These nstep forecasts are then compared to a new set of data in y.future and root mean sqaured error and mean absolute error measures are computed.

References

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 14(1):1-36.

See Also

szbvar

Examples

Run this code
Y <- EuStockMarkets
results <- SZ.prior.evaluation(window(Y, start=c(1998, 1), end=c(1998,149)), p=3,
                               lambda0=c(1,0.9),
                               lambda1=c(0.1,0.2),
                               lambda3=c(0,1),
                               lambda4=c(0.1,0.25),
                               lambda5=0,
                               mu5=4,
                               mu6=4, z=NULL,
                               nu=ncol(Y)+1, qm=4,
                               prior=0,
                               nstep=20, 
                               y.future=window(Y, start=c(1998,150)))


# Now plot the RMSE and marginal posterior of the data for each of the
# 6 period forecasts as a function of the prior parameters.  This can
# easily be done using a lattice graphic.

library(lattice)

attach(as.data.frame(results))
dev.new()
xyplot(RMSE ~ lambda0 | lambda1 + lambda3)
dev.new()
xyplot(logMDD ~ lambda0 | lambda1 + lambda3)
dev.new()
xyplot(LLF ~ lambda0 | lambda1 + lambda3)

Run the code above in your browser using DataLab