Copulas.jl: A fully Distributions.jl-compliant copula package

Copulas are functions that describe dependence structures of random vectors, without describing their univariate marginals. In statistics, the separation is sometimes useful, the quality and/or quantity of available information on these two objects might differ. This separation can be formally stated through Sklar's theorem. Copulas are standard tools in probability and statistics, with a wide range of applications from biostatistics, finance or medicine, to fuzzy logic, global sensitivity and broader analysis. The Julia package \texttt{Copulas.jl} brings most standard copula-related features into native Julia: random number generation, density and distribution function evaluations, fitting, construction of multivariate models through Sklar's theorem, and many more related functionalities. Copulas being fundamentally distributions of random vectors, we fully comply with the \texttt{Distributions.jl} API, the Julian standard for implementation of random variables and random vectors. This compliance allows interoperability with other packages based on this API such as, e.g., \texttt{Turing.jl} and several others.

Copulas are standard tools in probability and statistics, with a wide range of applications from biostatistics, finance or medicine, to fuzzy logic, global sensitivity and broader analysis.A few standard theoretical references on the matter are (Joe, 1997), (Nelsen, 2006), (Joe, 2014), and (Durante & Sempi, 2015).
The Julia package Copulas.jlbrings most standard copula-related features into native Julia: random number generation, density and distribution function evaluations, fitting, construction of multivariate models through Sklar's theorem, and many more related functionalities.Copulas being fundamentally distributions of random vectors, we fully comply with the Distributions.jlAPI (Besançon et al., 2021;Lin et al., 2019), the Julian standard for implementation of random variables and random vectors.This complience allows inter-operability with other packages based on this API such as, e.g., Turing.jl(Ge et al., 2018) and several others.

Statement of need
The R package copula (Hofert et al., 2020;Ivan Kojadinovic & Jun Yan, 2010;Jun Yan, 2007;Marius Hofert & Martin Mächler, 2011) is the gold standard when it comes to sampling, estimating, or simply working around dependence structures.However, in other languages, the available tools are not as developped and/or not as recognised.We bridge the gap in the Julian ecosystem with this Julia-native implementation.Due to the very flexible type system in Julia, our code expressiveness and tidyness will increase its usability and maintenability in the long-run.Type-stability allows sampling in arbitrary precision without requiering more code, and Julia's multiple dispatch yields most of the below-described applications.
There are competing packages in Julia, such as BivariateCopulas.jlwhich only deals with a few models in bivariate settings but has very nice graphs, or DatagenCopulaBased.jl,which only provides sampling and does not have exactly the same models as Copulas.jl.While not fully covering out both of these package's functionality (mostly because the three projects chose different copulas to implement), Copulas.jl is clearly the must fully featured, and brings, as a key feature, the complience with the broader ecosystem.

SklarDist: sampling and fitting examples
The Distributions.jl's API provides a fit function.You may use it to simply fit a compound model to some dataset as follows: # Add the loglikelyhood to the model : Turing.Turing.@addlogprob!loglikelihood(D, dataset) end

The Archimedean API
Archimedean copulas are a huge family of copulas that has seen a lot of theoretical work.Among others, you may take a look at (McNeil & Nešlehová, 2009).We use WilliamsonTransformations.jl's implementation of the Williamson d-transfrom to sample from any archimedean copula, including for example the ClaytonCopula with negative dependence parameter in any dimension, which is a first to our knowledge.
The API is consisting of the folloiwng functions:

Broader ecosystem
The package is starting to get used in several other places of the ecosystem.Among others, we noted: • The package GlobalSensitivity.jlexploit Copulas.jl to provide Shapley effects implementation, see this documentation.• EconomicScenarioGenerators.jl uses depndence structures between financial assets.