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. 
RATS Code
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
Code_&_Software_files/BrandtSandlerReplication.pdfCode_&_Software_files/BrandtSandlerReplication_1.pdfhttp://cran.revolutionanalytics.com/web/packages/MSBVAR/index.htmlhttp://www.utdallas.edu/~pbrandt/code/pests.rhttp://www.utdallas.edu/~pbrandt/pests/pests.htmhttp://www.utdallas.edu/~pbrandt/code/pests-example.rhttp://www.utdallas.edu/~pxb054000/code/count-examples/hostage-example/http://www.utdallas.edu/~pxb054000/code/count-examples/changepoint-example/http://www.utdallas.edu/~pxb054000/code/count-examples/Hydepark-example/http://www.utdallas.edu/~pxb054000/code/count-examples/http://www.utdallas.edu/~pbrandt/code/lagspec.srchttp://www.estima.com/http://www.utdallas.edu/~pbrandt/pests/pests.htmshapeimage_1_link_0shapeimage_1_link_1shapeimage_1_link_2shapeimage_1_link_3shapeimage_1_link_4shapeimage_1_link_5shapeimage_1_link_6shapeimage_1_link_7shapeimage_1_link_8shapeimage_1_link_9shapeimage_1_link_10shapeimage_1_link_11shapeimage_1_link_12