Code & Software

Code and software for specific papers can be found on the Research or Replication Pages link above.
R/Splus Code
Bayesian Poisson Vector Autoregression model code / examples.  This replication code fits the models in Brandt and Sandler (2012).  It uses R and JAGS.  See the documentation inside the replication materials for details.
MSBVAR R Package  MS-BVAR = Markov-switching and Bayesian Vector Autoregression package for R.  Provides methods for estimating frequentist, Bayesian Vector Autoregression (BVAR), Bayesian structural vector autoregression (B-SVAR) and some Markov-switching Bayesian vector autoregression (MS-BVAR) models. Includes methods for the generating posterior inferences for these (MS)BVAR models and their forecasts, impulse responses (using likelihood-based error bands), and forecast error decompositions. Also includes utility functions for plotting forecasts and impulse responses, and generating draws from Wishart and singular multivariate normal densities. This package is also available on CRAN, so try “install.packages(“MSBVAR”) in R!
PESTS: Poisson Estimators for State-Space Time Series R version 1.1.5 (UPDATED 2009-09-07) This is a R implementation of the Gauss PESTS code. This code will allow you to estimate the model in Brandt et al. 2000 and Brandt and Williams 2001. This is a major rewrite from the GAUSS version, since it now uses the standard R model specification. Also included are some new functions computing impact multipliers and impulse responses for the PAR(p) model. See the examples of how to use this file below.
PESTS - R version sample program. This program illustrates how to simulate PEWMA and PAR(p) data and estimate the models in R using the pests.r file that is linked above.
Additional example files for fitting different event count time series models in R:
    Transnational hostage taking example based on Brandt and Sandler (2009).
    Poisson Changepoint modeling in R based on both simlulated data and Brandt and Sandler (2009).
    Hyde park purse snatching example for the PAR(p) model based on Brandt and Williams (2001).
    See also the examples at this link. 
LAGSPEC.SRC -- RATS source code to automate VAR lag selection tests Computes AIC, BIC and likelihood ratio test for a VAR from LAGMAX to 1 lags. The first part of this procedure is based on the ESTIMA code for computing the AIC and BIC for a set of lags. It is modified to save the log determinants and then use these to compute the various likelihood ratio statistics to test for lag length.  Similar functionality is included in my MSBVAR package above.
Gauss Code
PESTS: Poisson Estimators for State-Space Time Series The software in PESTS is intended for to estimate two different time series models: a Poisson exponentially weighted moving average model (PEWMA) and a Poisson autoregressive model (PAR(p)).
PESTS is a series of GAUSS programs that work together as library. The library is easy to install in your existing installation of GAUSS. The only requirement is that you also have a copy of MAXLIK, the GAUSS add-on module for maximum likelihood estimation.  This code has not been updated since 2002, so use at your own risk (and try the R code, which is what I currently maintain and use).

All source code available here is distributed WITHOUT ANY WARRANTY for NONCOMMERCIAL USE; There is no implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. USE AT YOUR OWN RISK.
If you find what you think is a problem in the code above please contact me at pbrandt_at_utdallas_dot_edu