File Exchange

image thumbnail


version (3.3 MB) by Jan Gorecki
Version R2018_08_24


Updated 11 Sep 2018

View License on GitHub

*** Hierarchical Archimedean copulas for MATLAB and Octave: The HACopula Toolbox ***
The HACopula toolbox extends the copula modeling provided by MATLAB to modeling with hierarchical Archimedean copulas, which allows for non-elliptical distributions in arbitrary dimensions enabling for asymmetries in the tails. This includes their representation as MATLAB objects, evaluation, sampling, estimation and goodness-of-fit testing, as well as tools for their visual representation or computation of corresponding Kendall's tau and tail dependence coefficients. The toolbox is also compatible with Octave, where no support for copulas in more than two dimensions is currently provided.

Comments and Ratings (5)

Jan Gorecki

Dear Pingjun,

thanks for using the toolbox. To cite it, use the bibtex citation format provided at my personal pages, see (section Journal papers).


Pingjun Deng

Dear Gorecki,
Thanks for providing this powerful toolbox. Could you tell me how to cite your manual "Hierarchical Archimedean Copulas for MATLAB and Octave: The HACopula Toolbox", please?

Jan Gorecki

Hi Stefan,

yes. To get the pdf, HACopula uses Matlab's symbolic toolbox to compute the derivatives of HAC's CDF. The following code does the computation for a bivariate copula:

% 2 rows of data for d=2
U1 = [0.2; 0.5];
U2 = [0.3; 0.8];

% the copula model
theta = 2;
family = 'C';

biCop = HACopula({ {family, theta}, 1, 2}); % get the model
symbPdf = getpdf(biCop); % get symbolic pdf

% get the pdf values
syms u1;
syms u2;
syms theta3;
pdfValues = double(subs(symbPdf, {u1, u2, theta3}, {U1 U2 theta*ones(size(U1))}))

This can be easily extended to more dimensions, however, for HACs in d > 4, I would not recommend to try it, because the pdf is extremely complicated (long).

So, rather
a) to estimate a HAC in large dimensions (with MLE), use the HACopulafit function, which circumvents the problem with high dimensions;
b) to compare the fit of the HAC estimate with other models (e.g. gaussian), use the comparison based on model's CDF, e.g. the one introduced by Genest (the paper on big Monte Carlo study from 2009) (S_n), which is implemented by the method gofdSnE and can be easily adjusted also for gaussian models.

Hopefully this will help you,

Stefan M

Is it possible to compute the pdf values for a sample with this toolbox? (like the function copulapdf does for a gaussian copula)

Powerful extension of Matlab's functionality to d-dimensional Archimedean copulas (exchangeable and hierarchical).
Easy to understand and utilize because of incredibly good manual and example code.


fast Kendall's tau estimate computation, extended numerical stability when computing densities or conditional CDFs, new functionality to simplify access to bivariate margins of a HAC

MATLAB Release Compatibility
Created with R2017a
Compatible with R2013a to R2018a
Platform Compatibility
Windows macOS Linux

MATLAB Online Live Editor Challenge

View the winning live scripts from faculty and students who participated in the recent challenge.

Learn more

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video