MATLAB code associated with our new book Bayesian Econometric Methods (Second Edition) can be found at the book website. MATLAB and R code for Statistical Modeling and Computation is available here.
If you want to download the code associated with a particular paper, it will be easier to locate it at my research page. Below I organize the code by topics.
Please contact me if you find any errors.
Vector Autoregressions and VARMAs
See here for more information about my recent projects on large Bayesian VARs.
- A new hybrid TVP-VAR with SV where each equation can have either constant or time-varying coefficients
- A large order-invariant Bayesian VAR with SV
- A large TVP-VAR with SV where the time-varying parameters and stochastic volatilities are formulated as a singular state space model
- Estimation code of a standard, large reduced-form Bayesian VAR with SV
- A new family of Minnesota-type adaptive hierarchical priors for Large Bayesian VARs with SV
- A large Bayesian VAR with a new asymmetric conjugate prior; the application estimates a 15-variable VAR identified with sign restrictions
- Forecasting using large BVARs with various shrinkage priors
- Large Bayesian VARs with non-Gaussian, heteroscedastic and serially dependent innovations
- Forecasting using time-varying parameter VARMAs with stochastic volatility
- Time-varying parameter VAR with SV and stochastic model specification search
- Time-varying parameter VAR with constant volatility
Stochastic Volatility and GARCH Models
- Seven pairs of SV and GARCH models, including the SV in mean model and the SV model with leverage
- Time-varying parameter VAR with SV and stochastic model specification search
- Three univariate SV models: standard SV, SV with MA(1) Gaussian errors and SV with MA(1) Student's t errors
- Stochastic volatility in mean model with time-varying parameters
- Four stochastic volatility models with moving average errors
Marginal Likelihood and Deviance Information Criterion
- Marginal likelihood computation for large VARs with 4 different types of SV
- Marginal likelihood computation for hybrid TVP-VARs with SV
- Marginal likelihood and DIC computation for 10 VARs, including time-varying parameter VARs with SV and regime-switching VARs
- Bayes factor computation for time-varying coefficients vs constant coefficients
- Observed-data and conditional DICs computation for 7 SV models
- Marginal likelihood computation for 7 SV and 7 GARCH models
- Three variants of the DIC for three latent variable models: static factor model, TVP-VAR and semiparametric regression
- Marginal likelihood computation for 6 models using the cross-entropy method: VAR, dynamic factor VAR, TVP-VAR, probit, logit and t-link
Models for Inflation
See here for more information about my research on trend inflation models.
- A new bivariate UC model for measuring long-run inflation expectations uncertainty using both monthly inflation and daily break-even inflation data.
- A new trend inflation model using both inflation data and long-run inflation expectations
- Stock and Watson (2007) model: unobserved components model with 2 SVs
- Unobserved components model with inflation volatility feedback
- Unobserved components model with a bounded inflation trend and SV
- Bivariate unobserved components model with bounded inflation trend and NAIRU
- Unobserved components models with stochastic volatility and moving average errors
Models for Output Gap
- Output gap from a trivariate unobserved components model using stochastic model specification search
- Output gap from extensions of the HP filter by allowing serial correlation in the cyclical component
- Output gaps from eight unobserved components models, including models with correlated trend and cycle innovations and breaks in trend output growth
Other Models
- A regime switching skew-normal model of contagion
- A partially identified instrumental variable model
Other Sources
A number of econometricians have provided code associated with their books or papers:
- MATLAB code associated with Gary Koop's books, papers and short courses can be found on his website.
- Dimitris Korobilis provides code for estimating a wide variety of models, including Bayesian VARs, TVP-VARs and factor models.
- Jouchi Nakajima provides MATLAB and R code for estimating various stochastic volatility models, including a TVP-VAR with SV.