Copulas: Theory, Generation, and Applications

Copula function, Sklar's theorem, four fundamental copulas, dependence coefficients, and three copula generation methods — rotation, the Khoudraji device, and mixtures

Dr Krzysztof Ozimek, PRM  ·  30 years in quantitative finance education
Section 1

Introduction

Copulas are mathematical functions that join multiple one-dimensional distribution functions into a full multivariate distribution function. They allow us to separate the dependency structure from the marginal distributions of each variable — giving the freedom to model margins and dependencies independently.

This separation is crucial in quantitative finance, where marginal distributions may be heavy-tailed (for example, stock returns) while the dependency structure between variables requires its own careful modeling. Copulas, and especially their generated forms, offer a flexible way to describe complex dependencies between variables.

This reference guide covers three major methods for generating new copulas from existing ones:

  • Rotation — transforms the dependence structure by rotating within the unit square
  • The Khoudraji device — constructs new copulas by multiplying two component copulas at transformed arguments
  • Mixtures of copulas — combines different copula families using weighted combinations

Beyond these, other notable methods in copula generation include elliptical copulas derived from elliptical distributions, Archimedean copulas constructed via special generator functions, nested copulas built through hierarchical tree structures, vine copulas based on edge connections in sequences of dependency trees, and extreme-value copulas defined through the Pickands dependence function.

The four canonical copula families used throughout this guide — Gaussian, Student-t, Clayton, and Gumbel — have been selected for their ability to effectively illustrate the fundamental concepts of copula modeling. These copulas serve as the building blocks for all three generation methods described in this guide.

Section 2

Copula function

Definition — d-dimensional copula function

A \(d\)-dimensional (\(d \geq 2\)) copula function is a multivariate cumulative distribution function (CDF):

\[ C(u_1, u_2, \ldots, u_d) \]

where \(u_i \in [0,1]\) for all \(i = 1, \ldots, d\), which satisfies (most simple properties):

  • \(C:[0,1]^d \to [0,1]\)
  • \(C(1, \ldots, 1, u_i, 1, \ldots, 1) = u_i\)
  • \(C(u_1, \ldots, u_{i-1}, 0, u_{i+1}, \ldots, u_d) = 0\)  (at least one 0)
  • \(C(1, \ldots, 1) = 1\)
  • \(d\)-increasingness: The volume of any rectangle in \([0,1]^d\) is non-negative
Copula CDF viewed from four different angles in 3D — illustrating basic properties of a bivariate copula. © Dr Krzysztof Ozimek
Copula CDF: Views from Different Angles
Section 3

Sklar's theorem

Sklar's Theorem

For any joint CDF \(F(x_1, x_2, \ldots, x_d)\) with marginals \(F_1(x_1), F_2(x_2), \ldots, F_d(x_d)\), there exists a copula \(C\) such that:

\[ F(x_1, x_2, \ldots, x_d) = C(F_1(x_1), F_2(x_2), \ldots, F_d(x_d)) \]

Conversely, for any copula \(C\) and marginals, the following holds:

\[ C(u_1, \ldots, u_d) = F(F_1^{-1}(u_1), \ldots, F_d^{-1}(u_d)) \]

where \(u_i \in [0,1]\). Each \(u_i\) represents a realization of a uniformly distributed random variable \(U_i\) on \([0,1]\). Here, \(F_i^{-1}\) denotes the generalized inverse (quantile function) of \(F_i\). If the marginal distributions are continuous, the copula \(C\) is unique.

CDF and PDF of a bivariate random variable with respect to the bivariate copula CDF and PDF

Relationship between the CDF of a bivariate random variable and the corresponding copula CDF:

\[ F(x_1, x_2) = C(F_1(x_1), F_2(x_2)) = C(u_1, u_2) \]

where \(F(x_1, x_2)\) is the joint CDF of a bivariate random variable, and \(C(u_1, u_2)\) is the bivariate copula CDF.

Relationship between the PDF of a bivariate random variable and the corresponding bivariate copula PDF:

\[ f(x_1, x_2) = c(F_1(x_1), F_2(x_2)) \cdot f_1(x_1) \cdot f_2(x_2) = c(u_1, u_2) \cdot f_1(x_1) \cdot f_2(x_2) \]

where \(f(x_1, x_2)\) is the joint PDF of a bivariate random variable, and \(c(u_1, u_2) = \dfrac{\partial^2 C(u_1, u_2)}{\partial u_1 \partial u_2}\) is the bivariate copula PDF.

Section 4

Bivariate Gaussian copula (elliptical copula)

Definition
\[ C(u_1, u_2;\, \rho) = \Phi_\rho\!\left(\Phi^{-1}(u_1),\, \Phi^{-1}(u_2)\right) \]

where:

  • \(\Phi^{-1}\): the inverse of the univariate standard normal CDF \(\Phi\)
  • \(\Phi_\rho\): the joint bivariate standard normal CDF with correlation coefficient \(\rho \in [-1,1]\)

The Gaussian copula has zero lower tail dependence and zero upper tail dependence: \(\lambda_L = 0\) and \(\lambda_U = 0\) for \(\rho \in (-1,1)\).

Scatter plots of the bivariate Gaussian copula for correlation parameters rho = 0.9, 0.1, -0.1, -0.9. © Dr Krzysztof Ozimek
Gaussian Copula: scatter plots for \(\rho \in \{0.9,\, 0.1,\, -0.1,\, -0.9\}\)
Section 5

Bivariate Student-t copula (elliptical copula)

Definition
\[ C(u_1, u_2;\, \rho, \nu) = T_{\rho,\nu}\!\left(T_\nu^{-1}(u_1),\, T_\nu^{-1}(u_2)\right) \]

where:

  • \(T_\nu^{-1}\): the inverse of the univariate standard Student's \(t\) CDF \(T_\nu\) with \(\nu > 0\) degrees of freedom (df)
  • \(T_{\rho,\nu}\): the joint bivariate standard Student's \(t\) CDF with correlation coefficient \(\rho \in [-1,1]\) and \(\nu > 0\) degrees of freedom (df)

Unlike the Gaussian copula, the Student-t copula exhibits symmetric tail dependence in both directions: \(\lambda_L = \lambda_U > 0\) for \(\rho > -1\). This makes it suitable for modeling joint extreme events.

Scatter plots of the bivariate Student-t copula for rho = 0.9, 0.1, -0.1, -0.9 with df = 10. © Dr Krzysztof Ozimek
Student-t Copula: scatter plots for \(\rho \in \{0.9,\, 0.1,\, -0.1,\, -0.9\}\), \(\nu = 10\)
t-Copula: Spearman's Rho vs Correlation Parameter with df = 10 (simulation). © Dr Krzysztof Ozimek
t-Copula: Spearman's \(\rho_S\) vs correlation parameter \(\rho\), \(\nu = 10\) (simulation)
Section 6

Bivariate Clayton copula (Archimedean copula)

Definition
\[ C(u_1, u_2;\, \theta) = \left(u_1^{-\theta} + u_2^{-\theta} - 1\right)^{-1/\theta} \]

where \(\theta \in (0, +\infty)\).

The Clayton copula models strong lower tail dependence (\(\lambda_L = 2^{-1/\theta} > 0\)) and has zero upper tail dependence (\(\lambda_U = 0\)). It is therefore well suited for modeling simultaneous extreme low values.

Applications in quantitative finance

Lower tail dependence — where extreme adverse outcomes occur together — is particularly critical in many real-world financial contexts. The Clayton copula is well suited to model such scenarios:

  • Credit risk and loan portfolios During a recession, multiple borrowers may default simultaneously. These joint defaults are not independent events — strong lower tail dependence must be modeled to correctly assess the risk of portfolio collapse.
  • Insurance claims during natural disasters After a major hurricane or earthquake, many insurance policies may experience very large claims at the same time. These are extreme losses corresponding to small CDF values — making lower tail dependence the right way to model the risk of aggregated catastrophic payouts.
  • Joint asset crashes in financial crises During sudden market crashes, different asset classes (e.g., equities, commodities) may simultaneously plummet. Simple correlation models often underestimate this co-movement. The Clayton copula better captures the true joint crash risk.
  • Operational risk aggregation During systemic events such as financial crises or pandemics, multiple operational risk sources can simultaneously generate extreme losses. Proper modeling prevents underestimation of capital requirements.
Read more: Sklar's Theorem and Clayton Copula in Action →
Scatter plots of the bivariate Clayton copula for theta = 0.2, 1.5, 3, 8. © Dr Krzysztof Ozimek
Clayton Copula: scatter plots for \(\theta \in \{0.2,\, 1.5,\, 3,\, 8\}\)
Clayton Copula: Spearman's Rho vs Clayton Copula Parameter theta. © Dr Krzysztof Ozimek
Clayton Copula: Spearman's \(\rho_S\) vs \(\theta\)
Section 7

Bivariate Gumbel copula (Archimedean copula)

Definition
\[ C(u_1, u_2;\, \theta) = \exp\!\left[-\left((-\ln u_1)^\theta + (-\ln u_2)^\theta\right)^{1/\theta}\right] \]

where \(\theta \in [1, +\infty)\).

The Gumbel copula models strong upper tail dependence (\(\lambda_U = 2 - 2^{1/\theta} \geq 0\)) and has zero lower tail dependence (\(\lambda_L = 0\)). It is therefore well suited for modeling simultaneous extreme high values.

Scatter plots of the bivariate Gumbel copula for theta = 1.1, 1.8, 2.5, 5. © Dr Krzysztof Ozimek
Gumbel Copula: scatter plots for \(\theta \in \{1.1,\, 1.8,\, 2.5,\, 5\}\)
Gumbel Copula: Spearman's Rho vs Gumbel Copula Parameter theta. © Dr Krzysztof Ozimek
Gumbel Copula: Spearman's \(\rho_S\) vs \(\theta\)
Section 8

Dependence coefficients

Kendall's tau

\[ \tau = 4\iint_{[0,1]^2} C(u_1, u_2)\, dC(u_1, u_2) - 1 = 4 \cdot \mathbb{E}[C(U_1, U_2)] - 1 \]

where \(\tau \in [-1,1]\). Here, \(\mathbb{E}[C(U_1,U_2)]\) represents the expected value of the copula CDF, where \(U_1\) and \(U_2\) are uniformly distributed on \([0,1]\).

Spearman's rho

\[ \rho_S = 12\iint_{[0,1]^2} u_1 u_2\, dC(u_1, u_2) - 3 = 12 \cdot \mathbb{E}[U_1 U_2] - 3 \]

where \(\rho_S \in [-1,1]\), and \(\mathbb{E}[U_1 U_2]\) denotes the expected value of the product of two uniformly distributed random variables on \([0,1]\).

Lower tail dependence

\[\begin{aligned} \lambda_L &= \lim_{u \to 0^+} P\!\left(X_2 \leq F_2^{-1}(u) \mid X_1 \leq F_1^{-1}(u)\right) \\ &= \lim_{u \to 0^+} \frac{C(u,u)}{u} \end{aligned}\]

where \(\lambda_L\) is the lower tail dependence coefficient.

Upper tail dependence

\[\begin{aligned} \lambda_U &= \lim_{u \to 1^-} P\!\left(X_2 > F_2^{-1}(u) \mid X_1 > F_1^{-1}(u)\right) \\ &= \lim_{u \to 1^-} \frac{1 + C(u,u) - 2u}{1 - u} \end{aligned}\]

where \(\lambda_U\) is the upper tail dependence coefficient.

Section 9

Reference tables

The following two tables provide copula-specific formulas for Kendall's \(\tau\), Spearman's \(\rho_S\), and tail dependence coefficients \(\lambda_L\) and \(\lambda_U\). These tables are an original compilation by Dr Krzysztof Ozimek, PRM.

Table 1 — Kendall's \(\tau\) and Spearman's \(\rho_S\)

CopulaParameter rangeKendall's \(\tau\)Spearman's \(\rho_S\)
EllipticalGaussian\(\rho \in [-1,1]\)\(\tau = \dfrac{2}{\pi}\arcsin(\rho)\)\(\rho_S = \dfrac{6}{\pi}\arcsin\!\left(\dfrac{\rho}{2}\right)\)
Student-t\(\rho \in [-1,1]\)\(\tau = \dfrac{2}{\pi}\arcsin(\rho)\)It is not easy to exhibit \(\rho_S\)
ArchimedeanClayton\(\theta \in (0,+\infty)\)\(\tau = \dfrac{\theta}{\theta+2}\)It is not easy to exhibit \(\rho_S\)
Gumbel\(\theta \in [1,+\infty)\)\(\tau = 1 - \dfrac{1}{\theta}\)It is not easy to exhibit \(\rho_S\)

Table 2 — Lower and upper tail dependence coefficients

CopulaLower tail dependence \(\lambda_L\)Upper tail dependence \(\lambda_U\)
EllipticalGaussian\(\lambda_L = 0\)\(\lambda_U = 0\)
Student-t
\(\lambda_{L,U} \in (0,1]\)
\(\rho \neq-1\)
\(\lambda_L = 2T_{\nu+1}\!\left(-\sqrt{\dfrac{(\nu+1)(1-\rho)}{1+\rho}}\right)\)\(\lambda_U = 2T_{\nu+1}\!\left(-\sqrt{\dfrac{(\nu+1)(1-\rho)}{1+\rho}}\right)\)
ArchimedeanClayton
\(\lambda_L \in (0,1)\)
\(\lambda_L = 2^{-1/\theta}\)\(\lambda_U = 0\)
Gumbel
\(\lambda_U \in [0,1)\)
\(\lambda_L = 0\)\(\lambda_U = 2 - 2^{1/\theta}\)

\(T_{\nu+1}\) is the CDF of the Student-t distribution with \(df = \nu+1\).

Section 10

Interactive dashboards

The following interactive tools allow hands-on exploration of copula properties and generation methods. Each dashboard was developed by Dr Krzysztof Ozimek, PRM, as a companion to the course Copula Generation: Theory and Visualization.

These tools are optimized for desktop. On mobile, use the Launch Tool button to open in full screen.
Interactive dashboard showing 3D and 2D density plots of Gaussian, Student-t, Clayton, and Gumbel copulas with live dependence coefficients. © Dr Krzysztof Ozimek
Copulas — fundamental properties
3D and 2D density plots for Gaussian, Student-t, Clayton, and Gumbel copulas. Live display of Kendall's \(\tau\), Spearman's \(\rho_S\), \(\lambda_L\), and \(\lambda_U\).
Best experienced on desktop
Launch Tool →
Interactive dashboard showing copula generation theory: rotation formula with live visualization, Khoudraji device, and mixture construction. © Dr Krzysztof Ozimek
Copula generation — theory
Interactive visualizations of three generation methods: rotation (with live rotation formula and point visualization), the Khoudraji device, and mixtures of copulas.
Best experienced on desktop
Launch Tool →
Interactive dashboard showing contour and scatter plots for rotated, Khoudraji, and mixture copulas applied to Gaussian, Student-t, Clayton, and Gumbel. © Dr Krzysztof Ozimek
Copula generation — examples
Contour and scatter plots for all three generation methods applied to specific copulas: rotation, Khoudraji, and mixtures. Adjustable parameters and weights.
Best experienced on desktop
Launch Tool →
Section 11

Copula generation: rotation

Rotation is one of three methods of copula generation covered in this guide. It transforms an existing copula by rotating its dependence structure within the unit square.

General rotation formula for a point in \(\mathbb{R}^2\)
\[ \begin{bmatrix} x_R \\ y_R \end{bmatrix} = R \cdot \begin{bmatrix} x \\ y \end{bmatrix} - (R - I) \cdot \begin{bmatrix} a \\ b \end{bmatrix} \]

where:

  • \(R = \begin{bmatrix} \cos\alpha & -\sin\alpha \\ \sin\alpha & \cos\alpha \end{bmatrix}\) is a rotation matrix, \(\alpha\) is a rotation angle
  • \(\begin{bmatrix} x \\ y \end{bmatrix}\) is the original point
  • \(I = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}\) is the \(2 \times 2\) identity matrix
  • \(\begin{bmatrix} a \\ b \end{bmatrix}\) is the rotation center

In the context of bivariate copulas, \(\alpha\) should be a multiple of \(90°\), \(a = b = 0.5\), and \(x\) and \(y\) are within the interval \([0,1]\).

Rotated copula PDFs

  • \(c_{0°}(u_1, u_2) = c(u_1, u_2)\)
  • \(c_{90°}(u_1, u_2) = c(1-u_2,\, u_1)\)
  • \(c_{180°}(u_1, u_2) = c(1-u_1,\, 1-u_2)\)
  • \(c_{270°}(u_1, u_2) = c(u_2,\, 1-u_1)\)
  • \(c_{360°}(u_1, u_2) = c(u_1, u_2)\)

Rotation changes the direction of dependence. For many positively dependent copulas (e.g., the Clayton copula), a \(90°\) rotation leads to negative dependence, reflected in negative values of Kendall's \(\tau\) and Spearman's \(\rho_S\).
For the Clayton copula, a \(90°\) rotation eliminates lower tail dependence (\(\lambda_L = 0\)).

Applications in quantitative finance: rotated Clayton copulas

Rotated Clayton copulas find direct applications in financial modeling where asymmetric risks are present:

  • 90° rotation — upper tail of \(X_1\) and lower tail of \(X_2\) Example: a strong positive return in a stock (\(X_1\)) could be associated with a sharp drop in a derivative's value (\(X_2\)).
  • 180° rotation — upper tails of both \(X_1\) and \(X_2\) Example: simultaneous large gains in two correlated assets, such as two tech stocks during a market rally.
  • 270° rotation — lower tail of \(X_1\) and upper tail of \(X_2\) Example: a major loss in a bank's loan portfolio (\(X_1\)) could correspond to soaring credit spreads (\(X_2\)).
Read more: Copula Rotation in Quantitative Finance →
Section 12

Copula generation: Khoudraji device

The Khoudraji device constructs a new copula by multiplying two component copulas evaluated at transformed arguments. The transformation is controlled by a vector of shape parameters.

Khoudraji copula — general form, dimension \(d \geq 2\), \(\pmb{u} \in [0,1]^d\)
\[ C_{\text{KHO}}(\pmb{u}) = C_1\!\left(\pmb{u}^{1-\pmb{s}}\right) \cdot C_2\!\left(\pmb{u}^{\pmb{s}}\right) \]

where \(C_1\) and \(C_2\) are arbitrary copula CDFs, \(\pmb{s} = (s_1, \ldots, s_d)\) is a vector of shape parameters with \(s_i \in [0,1]\), and \(\pmb{u}^{\pmb{p}} = (u_1^{p_1}, u_2^{p_2}, \ldots, u_d^{p_d})\).

Khoudraji copula — bivariate case, dimension \(d = 2\), \(\pmb{u} \in [0,1]^2\)
\[ C_{\text{KHO}}(u_1, u_2) = C_1\!\left(u_1^{1-s_1},\, u_2^{1-s_2}\right) \cdot C_2\!\left(u_1^{s_1},\, u_2^{s_2}\right) \]

where \(s_1\) and \(s_2\) are shape parameters in \([0,1]\).

When both shape parameters \(s_1\) and \(s_2\) are set to zero, the resulting copula is identical to the first component copula \(C_1\). When both are set to one, the result reduces to the second component copula \(C_2\). Setting \(s_1 = 1\) and \(s_2 = 0\) yields the independence copula, regardless of the choice of component copulas. The Khoudraji device can introduce complex, nonlinear patterns of dependence — including a curved, band-like structure of high density — even when both components are relatively simple copulas.

Section 13

Copula generation: mixtures

A mixture of copulas is a convex combination of copula CDFs. It enables combining diverse dependence structures — such as lower-tail and upper-tail dependence — by using different copula families in the same model.

Mixture of copulas — general form, dimension \(d \geq 2\), \(\pmb{u} \in [0,1]^d\)
\[ C_{\text{MIX}}(\pmb{u}) = \sum_{k=1}^{m} w_k \cdot C_k(\pmb{u}) \]

where \(C_1, \ldots, C_m\) are arbitrary copulas, \(w_k \in [0,1]\), \(\displaystyle\sum_{k=1}^{m} w_k = 1\), and \(m \geq 2\).

Mixture of copulas — bivariate case, dimension \(d = 2\), \(\pmb{u} \in [0,1]^2\)
\[ C_{\text{MIX}}(u_1, u_2) = w_1 \cdot C_1(u_1, u_2) + w_2 \cdot C_2(u_1, u_2) \]

where \(w_1 \in [0,1]\) and \(w_2 = 1 - w_1\).

The weights must lie in the interval \([0,1]\) and their total must equal exactly 1 to maintain the validity of the resulting copula as a distribution function. When the Gumbel weight is high, upper tail dependence dominates the overall dependence structure. When the Clayton weight is high, lower tail dependence dominates. Tail dependence coefficients \(\lambda_L\) and \(\lambda_U\) are more sensitive to weight changes than rank correlation measures, especially when combining copulas with differing tail behaviors.

Section 14

Probability formulas

The following formulas express marginal, joint, and conditional probabilities using the bivariate copula \(C(u_1, u_2)\), where \(u_1 = F_1(a)\) and \(u_2 = F_2(b)\).

1. Marginal probabilities

  • 1.1
    \(P(X_1 \leq a) = F_1(a) = C(u_1, 1) = u_1\)
  • 1.2
    \(P(X_2 \leq b) = F_2(b) = C(1, u_2) = u_2\)
  • 1.3
    \(P(X_1 > a) = 1 - u_1\)
  • 1.4
    \(P(X_2 > b) = 1 - u_2\)

2. Joint probabilities

  • 2.1
    \(P(X_1 \leq a,\, X_2 \leq b) = C(u_1, u_2)\)
  • 2.2
    \(P(X_1 \leq a,\, X_2 > b) = u_1 - C(u_1, u_2)\)
  • 2.3
    \(P(X_1 > a,\, X_2 \leq b) = u_2 - C(u_1, u_2)\)
  • 2.4
    \(P(X_1 > a,\, X_2 > b) = 1 + C(u_1, u_2) - u_1 - u_2\)

3. Conditional probabilities

  • 3.1
    \(P(X_1 \leq a \mid X_2 \leq b) = \dfrac{C(u_1, u_2)}{u_2}\)
  • 3.2
    \(P(X_1 \leq a \mid X_2 > b) = \dfrac{u_1 - C(u_1, u_2)}{1 - u_2}\)
  • 3.3
    \(P(X_1 > a \mid X_2 \leq b) = \dfrac{u_2 - C(u_1, u_2)}{u_2}\)
  • 3.4
    \(P(X_1 > a \mid X_2 > b) = \dfrac{1 + C(u_1, u_2) - u_1 - u_2}{1 - u_2}\)
  • 3.5
    \(P(X_2 \leq b \mid X_1 \leq a) = \dfrac{C(u_1, u_2)}{u_1}\)
  • 3.6
    \(P(X_2 \leq b \mid X_1 > a) = \dfrac{u_2 - C(u_1, u_2)}{1 - u_1}\)
  • 3.7
    \(P(X_2 > b \mid X_1 \leq a) = \dfrac{u_1 - C(u_1, u_2)}{u_1}\)
  • 3.8
    \(P(X_2 > b \mid X_1 > a) = \dfrac{1 + C(u_1, u_2) - u_1 - u_2}{1 - u_1}\)
Section 15

Copula modeling workflow in R

The following workflow describes a complete copula modeling project implemented in R using the copula package. It covers data import, transformation, parameter estimation, model selection, visualization, simulation, and probability calculation. All materials — datasets, R script, and reference PDFs — are available on the Copulas – Theory & Project with R course page.

R version 4.4.2. Required package: copula (ver. 1.1-4). Optional packages: gridExtra, kde1d, rio.

Step 1 — R Packages

Before running the study, ensure that the required and proposed R packages are loaded. Required packages are essential for proceeding the script, while proposed packages provide additional functionalities that may be useful but are not strictly necessary. If any package is missing, install it first using install.packages("package_name"), then load it using library(package_name). The required and proposed packages are:

  • copula  (required)
  • gridExtra
  • kde1d
  • rio

library(copula)
library(gridExtra)
library(kde1d)
library(rio)

Step 2 — Data Import

Import data into R (copula_data_03.xlsx) and store it in a data frame.

# Datasets available at: drkrzysztofozimek.com/copulas-theory-project-r/
data <- rio::import("copulas_data\\copula_data_03.xlsx")

Step 3 — Data Visualization

Generate a scatter plot of \((x_1, x_2)\) contained in the data frame. This initial visualization allows a preliminary assessment of the dependence structure.

plot(data,
  main = bquote(bold("Scatter plot of (" * x[1] * "," * x[2] * ") from the dataset in " * italic("copula_data_03.xlsx"))),
  xlab = quote(x[1]),
  ylab = quote(x[2]), pch = 21, col = "#12147e", bg = adjustcolor("#12147e", alpha.f = 0.5)
)
grid()

Step 4 — Independence Test of Random Variables

Use the appropriate function from the copula package to formally test the null hypothesis of independence between \(X_1\) and \(X_2\).

d <- copula::indepTestSim(nrow(data), ncol(data))
copula::indepTest(data, d)

Step 5 — Data Transformation

Transform the data frame into a matrix format so that the values in the resulting matrix fall within the range \([0,1]\)

data_u <- as.matrix(copula::pobs(data))
colnames(data_u) <- c("u1", "u2")

Step 6 — Copula Parameter Estimation

Using the matrix obtained in step 5, estimate the parameters of the following copulas:

  • Gaussian
  • Student-t
  • Clayton
  • Gumbel
# a. Gaussian
gauss_cop <- copula::normalCopula(dim = 2)
fit_gauss <- copula::fitCopula(copula = gauss_cop, data = data_u, method = "mpl")
summary(fit_gauss)
# b. t-Student
t_cop <- copula::tCopula(dim = 2)
fit_t <- copula::fitCopula(copula = t_cop, data = data_u, method = "ml")
summary(fit_t)
# c. Clayton
clayton_cop <- copula::claytonCopula(dim = 2)
fit_clayton <- copula::fitCopula(copula = clayton_cop, data = data_u, method = "mpl")
summary(fit_clayton)
# d. Gumbel
gumbel_cop <- copula::gumbelCopula(dim = 2)
fit_gumbel <- copula::fitCopula(copula = gumbel_cop, data = data_u, method = "mpl")
summary(fit_gumbel)

Step 7 — Analysis of Estimated Parameters

Create a data frame containing the estimated parameters.

copula_param <- data.frame(
  Copula = c("Gaussian", "t-Student", "Clayton", "Gumbel"),
  Parameter1 = c(fit_gauss@estimate, fit_t@estimate[1], fit_clayton@estimate, fit_gumbel@estimate),
  Parameter2 = c(NA, fit_t@estimate[2], NA, NA) # Only t-Copula has a second parameter
)
copula_param

Step 8 — Verification of Fit Quality of Parameters

Create a data frame containing the values of the log-likelihood function, the Akaike Information Criterion (AIC), and the Bayesian Criterion (BIC) for the estimated copulas.

gof_results <- data.frame(
  Copula = c(
    "Gaussian", "t-Student",
    "Clayton", "Gumbel"
  ),
  LogLik = c(
    logLik(fit_gauss), logLik(fit_t),
    logLik(fit_clayton), logLik(fit_gumbel)
  ),
  AIC = c(
    AIC(fit_gauss), AIC(fit_t),
    AIC(fit_clayton), AIC(fit_gumbel)
  ),
  BIC = c(
    BIC(fit_gauss), BIC(fit_t),
    BIC(fit_clayton), BIC(fit_gumbel)
  )
)
gof_results

Step 9 — Selection of the Best Copula

Select the copula with the lowest BIC value and generate a copula-class object.

copula_picked <- copula::claytonCopula(param = fit_clayton@estimate, dim = 2)

Step 10 — Visual Analysis of the Copula

Create a panel of four plots for the copula selected in point 9:

  • (a) 3D plot of the probability density function (PDF)
  • (b) Contour plot of the PDF
  • (c) 3D plot of the cumulative distribution function (CDF)
  • (d) Contour plot of the CDF
my_colors <- colorRampPalette(c("blue", "green", "yellow", "red"))
# a. 3D plot of the probability density function (PDF)
p1 <- copula::wireframe2(copula_picked,
  FUN = dCopula, delta = 0.025,
  main = "a. PDF (Clayton)",
  zlab = list("PDF", rot = 90, cex = 0.5),
  drape = TRUE, colorkey = TRUE,
  col.regions = my_colors(100)
)
# b. Contour plot of the PDF
p2 <- copula::contourplot2(copula_picked,
  FUN = dCopula,
  main = "b. PDF (Clayton)",
  col.regions = my_colors(100)
)
# c. 3D plot of the cumulative distribution function (CDF)
p3 <- copula::wireframe2(copula_picked,
  FUN = pCopula, delta = 0.025,
  main = "c. CDF (Clayton)",
  zlab = list("CDF", rot = 90, cex = 0.5),
  drape = TRUE, colorkey = TRUE,
  col.regions = my_colors(100)
)
# d. Contour plot of the CDF
p4 <- copula::contourplot2(copula_picked,
  FUN = pCopula,
  main = "d. CDF (Clayton)",
  n.grid = 42, cuts = 33, lwd = 1 / 2,
  col.regions = my_colors(100)
)
gridExtra::grid.arrange(p1, p2, p3, p4, nrow = 2)

Step 11 — Analysis of Correlation Dependencies

Using the copula from point 9, calculate the following coefficients:

  • (a) Kendall's \(\tau\)
  • (b) Spearman's \(\rho_S\)
  • (c) Lower tail dependence \(\lambda_L\), and upper tail dependence \(\lambda_U\)

# a) Kendall's Tau
copula::tau(copula_picked)
# b) Spearman's Rho
copula::rho(copula_picked)
# c) Lower tail and upper tail dependence coefficients
copula::lambda(copula_picked)

Step 12 — Data Simulation

Using the copula generated in point 9, draw a sample of 100 points \((x_1, x_2)\) and generate scatter plots for two cases where the marginal CDF used to obtain the sample is:

  • (a) Empirical (CDF)
  • (b) Estimated (CDF)
# a. Empirical (CDF)
sample_u <- copula::rCopula(100, copula_picked)
sample_x1 <- quantile(data[, 1], probs = sample_u[, 1], type = 6)
sample_x2 <- quantile(data[, 2], probs = sample_u[, 2], type = 6)
plot(sample_x1, sample_x2,
  main = bquote(bold("Scatter plot of (" * x[1] * "," * x[2] * ") Sampled from Fitted Clayton Copula")),
  xlab = quote(x[1]), ylab = quote(x[2]), pch = 21, col = "#12147e", bg = adjustcolor("#12147e", alpha.f = 0.5)
)
grid()
mtext("(Using Empirical Marginal CDFs)", side = 3, line = 0.3, cex = 1, col = "dimgrey")
# b. Estimated (CDF)
cdf_fit_x1 <- kde1d::kde1d(data[, 1])
cdf_fit_x2 <- kde1d::kde1d(data[, 2])
sample_u <- copula::rCopula(100, copula_picked)
sample_x1 <- kde1d::qkde1d(sample_u[, 1], cdf_fit_x1)
sample_x2 <- kde1d::qkde1d(sample_u[, 2], cdf_fit_x2)
plot(sample_x1, sample_x2,
  main = bquote(bold("Scatter plot of (" * x[1] * "," * x[2] * ") Sampled from Fitted Clayton Copula")),
  xlab = quote(x[1]), ylab = quote(x[2]), pch = 21, col = "#12147e", bg = adjustcolor("#12147e", alpha.f = 0.5)
)
grid()
mtext("(Using Estimated Marginal CDFs)", side = 3, line = 0.3, cex = 1, col = "dimgrey")

Step 13 — Probability Calculations

Using the copula generated in point 9 and the estimated marginal CDFs obtained in point 12(b), calculate the following probabilities:

  • (a) \(P(X_1 \leq 0)\)
  • (b) \(P(X_2 > 0)\)
  • (c) \(P(X_1 \leq 0.5,\, X_2 \leq -1)\)
  • (d) \(P(X_1 > 0.2,\, X_2 \leq 2.5)\)
  • (e) \(P(X_1 \leq -1.23 \mid X_2 > 0.64)\)
# a. P(x1 <= 0)
u1 <- kde1d::pkde1d(0, cdf_fit_x1)
pr <- copula::pCopula(c(u1, 1), copula_picked)
pr
# b. P(x2 > 0)
u2 <- kde1d::pkde1d(0, cdf_fit_x2)
pr2 <- 1 - copula::pCopula(c(1, u2), copula_picked)
pr2
# c. P(X1 <= 0.5, X2 <= -1)
u1 <- kde1d::pkde1d(0.5, cdf_fit_x1)
u2 <- kde1d::pkde1d(-1, cdf_fit_x2)
pr <- copula::pCopula(c(u1, u2), copula_picked)
pr
# d. P(X1 > 0.2, X2 <= 2.5)
u1 <- kde1d::pkde1d(0.2, cdf_fit_x1)
u2 <- kde1d::pkde1d(2.5, cdf_fit_x2)
pr <- u2 - copula::pCopula(c(u1, u2), copula_picked)
pr
# e. P(X1 <= -1.23 | X2 > 0.64)
u1 <- kde1d::pkde1d(-1.23, cdf_fit_x1)
u2 <- kde1d::pkde1d(0.64, cdf_fit_x2)
pr <- (u1 - copula::pCopula(c(u1, u2), copula_picked)) / (1 - u2)
pr
© Dr Krzysztof Ozimek, PRM. Source: Copulas – Theory & Project with R. All materials available at drkrzysztofozimek.com/copulas-theory-project-r/.
Section 16

Frequently asked questions

A copula is a multivariate cumulative distribution function defined on the unit hypercube \([0,1]^d\). It joins multiple one-dimensional distribution functions into a full multivariate distribution, capturing the dependence structure between random variables independently of their marginal distributions.

Sklar's theorem states that for any joint CDF \(F(x_1, \ldots, x_d)\) with marginals \(F_1, \ldots, F_d\), there exists a copula \(C\) such that \(F(x_1, \ldots, x_d) = C(F_1(x_1), \ldots, F_d(x_d))\). This means any joint distribution can be decomposed into its marginal distributions and a copula that encodes the dependence structure between them.

Tail dependence measures the probability that extreme values in one variable coincide with extreme values in another. Lower tail dependence \(\lambda_L\) captures the tendency for simultaneous extreme low values; upper tail dependence \(\lambda_U\) captures simultaneous extreme high values. The Gaussian copula has zero tail dependence (\(\lambda_L = \lambda_U = 0\)), the Student-t copula has symmetric tail dependence (\(\lambda_L = \lambda_U > 0\) for \(\rho > -1\)), the Clayton copula has only lower tail dependence (\(\lambda_L = 2^{-1/\theta}\), \(\lambda_U = 0\)), and the Gumbel copula has only upper tail dependence (\(\lambda_L = 0\), \(\lambda_U = 2 - 2^{1/\theta}\)).

Both are elliptical copulas with the same formula for Kendall's \(\tau = \frac{2}{\pi}\arcsin(\rho)\). The key difference is tail dependence. The Gaussian copula has zero tail dependence for \(\rho \in (-1,1)\). The Student-t copula has symmetric tail dependence in both directions: \(\lambda_L = \lambda_U = 2T_{\nu+1}\!\left(-\sqrt{\frac{(\nu+1)(1-\rho)}{1+\rho}}\right)\). This makes the Student-t copula better suited for modeling joint extreme events.

Both are Archimedean copulas parameterized by \(\theta\), but they capture opposite types of tail behavior. The Clayton copula (\(\theta \in (0, +\infty)\)) models lower tail dependence (\(\lambda_L = 2^{-1/\theta}\)) with zero upper tail dependence. The Gumbel copula (\(\theta \in [1, +\infty)\)) models upper tail dependence (\(\lambda_U = 2 - 2^{1/\theta}\)) with zero lower tail dependence. Clayton is suited for modeling simultaneous extreme low values (e.g., joint crashes); Gumbel is suited for simultaneous extreme high values.

Copula rotation is a method of generating a new copula by rotating the dependence structure within the unit square, centered at \((0.5, 0.5)\). Rotations should be multiples of \(90°\). A \(90°\) rotation of a copula with positive dependence produces negative dependence. For the Clayton copula, rotation allows modeling different combinations of tail behavior: \(90°\) captures upper tail of \(X_1\) and lower tail of \(X_2\), \(180°\) captures upper tails of both variables, and \(270°\) captures lower tail of \(X_1\) and upper tail of \(X_2\). This makes rotated copulas highly useful in asymmetric financial risk modeling.

The Khoudraji device constructs a new copula by multiplying two component copulas evaluated at transformed arguments: \(C_{\text{KHO}}(u_1, u_2) = C_1(u_1^{1-s_1}, u_2^{1-s_2}) \cdot C_2(u_1^{s_1}, u_2^{s_2})\), where \(s_1, s_2 \in [0,1]\) are shape parameters. When \(s_1 = s_2 = 0\) the result is \(C_1\); when \(s_1 = s_2 = 1\) the result is \(C_2\); when \(s_1 = 1\) and \(s_2 = 0\) the result is the independence copula, regardless of the component copulas used. The Khoudraji device can introduce complex, nonlinear dependence patterns even when both components are simple copulas.

A mixture of copulas is a convex combination of copula CDFs: \(C_{\text{MIX}}(u_1, u_2) = w_1 \cdot C_1(u_1, u_2) + w_2 \cdot C_2(u_1, u_2)\), where \(w_1, w_2 \in [0,1]\) and \(w_1 + w_2 = 1\). Mixtures allow combining different types of dependence into one model — for example, lower-tail and upper-tail dependence simultaneously. Tail dependence coefficients \(\lambda_L\) and \(\lambda_U\) are more sensitive to weight changes than rank correlation measures when combining copulas with differing tail behaviors.

Given a copula \(C(u_1, u_2)\) with \(u_1 = F_1(a)\) and \(u_2 = F_2(b)\), joint and conditional probabilities can be computed directly. For example: \(P(X_1 \leq a,\, X_2 \leq b) = C(u_1, u_2)\), \(P(X_1 > a,\, X_2 > b) = 1 + C(u_1, u_2) - u_1 - u_2\), and \(P(X_1 \leq a \mid X_2 \leq b) = C(u_1, u_2) / u_2\). A complete set of 12 formulas covering all marginal, joint, and conditional combinations is provided in Section 14 of this guide.

The independence copula is defined as \(C(u_1, u_2) = u_1 \cdot u_2\). It represents the case where the two random variables are statistically independent. In the context of the Khoudraji device, setting \(s_1 = 1\) and \(s_2 = 0\) yields the independence copula regardless of the choice of component copulas — a structural result of the Khoudraji formulation.

Section 17

Courses

The theoretical content and formulas on this page are covered in two open educational courses by Dr Krzysztof Ozimek, PRM. All companion materials for both courses — including PDF guides, datasets, quizzes, and R scripts — are freely available on the respective course pages.

Free video course

Copula Generation: Theory and Visualization

Copula construction via rotation, the Khoudraji device, and mixtures of copulas. Visualization-driven, no coding required. Companion materials include introductory notes, a concise course companion, and quizzes — all available on the course page.

No code Visual YouTube Free materials
View course & materials →
Free video course

Copulas – Theory & Project with R

Copula theory and hands-on implementation in R. Covers parameter estimation, model selection via AIC/BIC, simulation, and probability calculation. Companion materials include datasets, R script, project PDF, and probabilistic formulas — all available on the course page.

R Hands-on YouTube Free materials
View course & materials →
© Dr Krzysztof Ozimek, PRM — Eduinn Krzysztof Ozimek.
© Dr Krzysztof Ozimek, PRM — Eduinn Krzysztof Ozimek. Sources: Copula Generation. A Concise Course Companion; Copulas – Theory & Project with R; blog posts at drkrzysztofozimek.com.