Free data and software



Data and software from various studies can be downloaded from this site. This material has been developed under NSF grants SES-8720731, SES-8920752, SBR-9308301, SBR-9707771, and SES-0076072, and is freely available to the public.

Note that in order to download a file, your own server needs to be registered for reverse name lookup. If you are unsuccessful, email your request to jhamilton@ucsd.edu .

Available data and programs


Other data and programs

Regional business cycles. Data and software to replicate results in The Propagation of Regional Recessions, coauthored with Michael Owyang, forthcoming in Review of Economics and Statistics.

Oil shock of 2007-08. Data and software to replicate any of the results in my paper, Causes and Consequences of the Oil Shock of 2007-08.

Normalization. Download software to reproduce results from the paper Normalization in Econometrics coauthored with Dan Waggoner and Tao Zha.

Flexible nonlinear inference. Download data and software to reproduce results from the papers "A Parametric Approach to Flexible Nonlinear Inference" and "What is an Oil Shock?" Click here to download copies of the working papers. Click here for updated estimation results and tests for coefficient stability of regression of real GDP on net oil price increase using data through 2019.

Updated data for net oil price increase

Kalman filter. Programs for the Kalman filter and smoother and the real interest rate data analyzed in the Handbook of Econometrics, Vol. 4.

Index of leading indicators. Data and software used in "What Do the Leading Indicators Lead?", Journal of Business January 1996. Includes real-time releases of the index of leading indicators.

Analysis of futures prices during the Great Depression. Data and software used in the study from American Economic Review, March 1992.


Bayesian vector autoregressions

Data and MATLAB code to implement the examples in Sign Restrictions, Structural Vector Autoregressions, and Useful Prior Information, Econometrica, Sept 2015, by Christiane Baumeister and James Hamilton.

Data and MATLAB code to implement the examples in Inference in Structural Vector Autoregressions When the Identifying Assumptions are Not Fully Believed: Re-evaluating the Role of Monetary Policy in Economic Fluctuations, Journal of Monetary Economics, Dec 2018, by Christiane Baumeister and James Hamilton.

Data and code for Structural Interpretation of Vector Autoregressions with Incomplete Identification: Revisiting the Role of Oil Supply and Demand Shocks, American Economic Review, forthcoming 2019, by Christiane Baumeister and James Hamilton.

Paul Richardson's R code and documentation.


Alternatives to Hodrick-Prescott Filter

James Hamilton's data with Matlab and RATS code

Description of Matlab command hfilter

Justin Shea's R code

Diallo Ibrahima Amadou's Stata code


Affine term structure and commodity futures models

Software for implementation of procedures described in James D. Hamilton and Jing Cynthia Wu, Identification and Estimation of Gaussian Affine Term Structure Models, Journal of Econometrics, 168, no. 2 (June 2012), pp. 315-331:

Maturity structure of publicly held debt. Data archive for James D. Hamilton and Jing Cynthia Wu, The Effectiveness of Alternative Monetary Policy Tools in a Zero Lower Bound Environment, Journal of Money, Credit, and Banking, 44, no. 1 (Supplement, February 2012): 3-46.

Data and replication code for James D. Hamilton and Jing Cynthia Wu, Risk Premia in Crude Oil Futures Prices, Journal of International Money and Finance, 42 (April 2014): 9-37.


Federal funds rate and monetary policy

Analysis of daily federal funds rate. Data and programs used in J. Political Economy, Feb. 1996.

Measuring the liquidity effect. Data and programs used in American Economic Review, March 1997.

Dynamic analysis of the daily balance sheet of the Federal Reserve. Data and programs used in James D. Hamilton, "The Supply and Demand for Federal Reserve Deposits," Carnegie-Rochester Conference Series on Public Policy, December 1998, vol. 49.

Yield spread and economic activity. Data and programs used in the paper, "A Re-Examination of the Predictability of Economic Activity Using the Yield Spread," Journal of Money, Credit, and Banking, 2001.

Forecasting the Fed funds target using the ACH model. Data and programs used in the paper, James D. Hamilton and Oscar Jorda, "A Model for the Federal Funds Rate Target," Journal of Political Economy, October 2002, vol. 110, pp. 1135-1167. Click here to download copy of the working paper.


Examples from the book Time Series Analysis

Code in the RATS programming language.

R code developed by Robert Bell and Matthieu Stigler. [Incomplete: If you have additions or improvements please contact Robert Bell (robertkevinbell@yahoo.com)].


Markov switching models

Programs for estimation of Markov switching models by numerical optimization. These are written in the GAUSS programming language and require use of the GAUSS numerical optimization procedures. They are written for the numerical optimization protocols from GAUSS version 2.0; other versions of GAUSS use slightly different protocols and you may need to consult your GAUSS manual to make slight changes in the lines that call the numerical optimizers. Note that the GAUSS routines should also run on Ox with the Ox Maximizer. The GAUSS code here estimates a pth-order autoregression with K states. Data are provided for reproducing the analysis of U.S. GNP as in Econometrica, March 1989, and 3-month Treasury bill rates as in J. of Econ. Dynamics and Control, June/Sept. 1988.

Programs for estimation of Markov switching models using the EM algorithm. These are written in the GAUSS programming language. They do not require use of the GAUSS numerical optimization procedures and should work with little or no change on any version of GAUSS, and again can also be run in Ox programming language. This code estimates an N-dimensional vector whose mean and covariance matrix change with the state. Data are provided for reproducing the analysis of exchange rates as in American Economic Review, Sept. 1990.

Programs for specification testing of Markov switching models. These files include specification tests described in Journal of Econometrics, Jan. 1996 and Journal of Business Jan. 1996.

Estimation of Markov-switching ARCH models. Data and software for methods used in J. Econometrics, Sept./Oct. 1994.

Bivariate analysis of SWARCH and Markov-switching autoregression. Data and software for methods used in J. Applied Econometrics, Sept./Oct. 1996.

Algorithms for real-time recession dating. Data and software for methods used in Calling Recessions in Real Time, International Journal of Forecasting 27, no. 4 (October-December 2011): 1006-1026.

The data and software provided above have been developed under research supported by the National Science Foundation under grants SBR-97-07771, SBR-93-08301, SES-89-20752, SES-87-20731. Any opinions, findings and conclusions or recommendations expressed in this material are those of James D. Hamilton and do not necessarily reflect the views of the National Science Foundation.

Software for estimating regime-switching models written by third parties

Return to James D. Hamilton's Home Page