This code is being released under a BSD license, which means that you can do pretty much what ever you want with it, including make money by selling it.
Most of my functions use code contained in the econometrics toolbox for Matlab by James P. LeSage. This toolbox contains many useful programs for econometricians. It must be installed before my code will work.
This toolbox contains many useful functions relating to estimating and simulating both univariate and multivariate GARCH models. Some of my programs call some of Kevin's functions, so this also needs to be installed. The GARCH toolbox can be found here.
This zip file contains 5
functions: the pdf, cdf, log-likelihood, inverse cdf and a function to generate random draws from the skewed
Hansen, Bruce E., 1994, Autoregressive Conditional Density Estimation, International Economic Review, 35(3), 705-730.
This Matlab m-file (saved as a “txt” file) returns an estimate of the optimal block size for bootstrap methods (stationary or circular) of estimating the asymptotic variance of the mean of dependent data, given a sample from a univariate time series.
R code for this procedure, written by Jeff Racine and Chris Parmeter is available here, and a PDF help file is here. Alternatively, if you install R and the “np” package you will have access to the function “b.star”.
fixes and updates:
26aug03: updated with suggestions from Kevin Sheppard.
16dec07: major revision: estimate of optimal block length for the stationary bootstrap corrected using recent paper by Nordman (Annals of Statistics, forthcoming). Details in a “correction” paper available here.
9dec08: fixed small bug in choice of “KN”, thanks to Jeff Racine for spotting this.
28oct09: Here is “mlag.m” (saved as a
“txt” file) which is called in my code. (This function is part
of the econometrics toolbox for Matlab by James P. LeSage.)
Politis, Dimitris N., and White, Halbert, 2004, Automatic Block-Length Selection for the Dependent Bootstrap, Econometric Reviews, 23(1), 53-70.
This zip file contains code to compute the exceedence correlations used by Longin
and Solnik (2001) and Ang and
Chen (2002). Code for the test that the exceedence
correlation plot is symmetric recently proposed by Hong, Tu
and Zhou (2003) is also included.
Longin, Francois, and Solnik, Bruno, 2001, Extreme Correlation of International Equity Markets, Journal of Finance, 56, 649-676.
Ang, Andrew, and Chen, Joseph, 2002, Asymmetric Correlations of Equity Portfolios, Journal of Financial Economics, 63(3), 443-494.
Hong, Yongmiao, Tu, Jun, and Zhou, Guofu, 2007, Asymmetries in Stock Returns: Statistical Tests and Economic Evaluation, Review of Financial Studies, 20, 1547-1581.
This zip file contains Matlab code to replicate the empirical section in Patton (2011), on volatility forecast comparison using imperfect volatility proxies. The main program is called "robust_example_code.m", which generates the figures and does the calculations. The data used in the paper is included. The function "robust_loss_1.m" is a function for the parametric family of "robust" loss functions proposed in the paper. Some helper functions are also included.
This zip file
contains a collection of Matlab functions that I
wrote for my research on copulas for financial time
series (Patton 2006a, Patton 2006b, Patton 2004, Granger et al. 2006, Patton 2007). Some simple example
code is given in "copula_example_code.m". A
table of contents is given in "contents.xls". Briefly, the toolbox
contains CDFs, PDFs, log-likelihoods and random number generators for many common
bivariate copulas, including the Clayton, Gumbel, Normal, Student's t, Frank, Plackett and symmetrised
Joe-Clayton (SJC) copulas. Basic code for time-varying Normal, Gumbel and SJC
copulas is included. Some helper functions are also included. If you find any
bugs in this code please let me know: firstname.lastname@example.org.
22aug06: Fixed two small bugs in clayton_pdf.m and tCopula_cdf.m
1aug07: Fixed big bug in sym_jc_rnd.m
19aug07: Fixed small bug in copula_example_code.m
2feb07: Fixed small bug in copula_example_code.m
5feb07: Fixed small bug in copula_example_code.m
This zip file contains Matlab code to replicate the empirical results presented in Patton and Timmermann (2010), on tests of monotonicity in asset returns. The main program is called "sorts_example_code_100.m", which loads the data, computes the t-test and MR test statistics and p-values, and returns the tables and the figure. The data used in the paper is included, as are some helper functions. Also included is a file made for Matlab beginners, “MR_test_for_dummies_100.m”, which goes through each step with explicit instructions. If you have any problems using the functions in this toolbox please feel free to email me: email@example.com .
23may08: Updated toolbox to compute the Wolak test (Journal of Econometrics 1989) for comparison, and to allow for two-way sorted returns.
15jun08: Updated toolbox to include a “MR test for dummies” function, which goes through the implementation of the MR test step-by-step – designed for Matlab beginners.
2may09: Large update, to go with the revision of the paper. Main MR test function was updated, example code to replicate all of the empirical results was extended to reflect the broader selection of empirical applications considered in the paper. Code for the “up” and “down” bootstrap tests was added.
R code for these tests, developed by Siegfried Köstlmeier, is available on his GitHub page here.
This zip file (version 14may13) contains Matlab code to replicate almost all of the empirical results presented in Patton (2013). The main program is called "AAA_empirical_work_CLEAN_14may13.m". This code is broken into blocks to replicated the tables and figures presented in various sections of the chapter. Also included are over 100 helper functions, and the data set used in the chapter (as an Excel file).
1) You will need to install the above "UCSD GARCH" and "LeSage Spatial Econometrics" toolboxes for this code to work.
2) You need to have Matlab's statistics and optimization toolboxes
3) Updated May 2013 to conform to Matlab R2013a (which is case sensitive for function and file names). Please email me if I've missed a correction.
This zip file (16feb14) contains Matlab code to implement the multi-horizon bounds tests of forecast rationality proposed in Patton and Timmermann (2012, JBES). The code is illustrated in "bounds_tests_example_code_1.m", and the main function to conduct the tests is "bounds_tests_function_40nan_simple.m". The function "ineqtest.m" was provided by Raymond Kan, and is much faster than our initial implementation of the Wolak test.
1) You will need to install the above "LeSage Spatial Econometrics" toolboxes for this code to work.
2) You need to have Matlab's statistics and optimization toolboxes
3) Updated Feb 2014 to conform to Matlab R2013a (which is case sensitive for function and file names). Please email me if I've missed a correction.
This zip file (17feb16) contains Matlab code to illustrate the estimation of a skew t-t factor copula with GAS dynamics on a sample of 10 variables. The main file is “AAA_main_GASFacCop_Skewtt_Ngroup.m”.
1) You need to have Matlab's statistics and optimization toolboxes.
2) You probably need to be familiar with the dynamic copula tools in my Handbook of Economic Forecasting chapter (see item 9 above).
This zip file (3july17, 30.4MB) contains all data and Matlab code to replicate the empirical work in Bollerslev, Patton and Quaedvlieg (2015, JoE). The zip file also contains a PDF file of the corrected tables for this paper, which differ slightly from the published tables. Please see the “readme” file for a detailed description of the contents.
Department of Economics
213 Social Sciences Building
Durham NC 27708-0097
Last Updated: 16 February 2014.
Go to Andrew's main page.