Copula Dependence
Bivariate copulas for modeling tail dependence and asymmetric co-movement
Copulas separate the marginal distributions of two assets from their dependence structure. Linear correlation captures the average co-movement, but copulas capture the shape — whether two markets crash together more than they rally together, or whether their dependence disappears in the tails. Horizon provides four copula families and automatic selection.
API
Rank transform
Before fitting a copula, transform raw returns to uniform marginals on [0, 1]:
python
u = hz.rank_transform(returns_a) # -> array of uniform pseudo-observations
v = hz.rank_transform(returns_b)
Fit the best copula
python
result = hz.best_copula(u, v)
result.family # "gaussian", "clayton", "gumbel", or "frank"
result.param # fitted parameter (theta or rho)
result.aic # Akaike information criterion
result.lower_tail # lower tail dependence coefficient
result.upper_tail # upper tail dependence coefficient
result.log_lik # log-likelihood of the fit
Copula dependence summary
python
dep = hz.copula_dependence()
dep.kendall_tau # rank correlation
dep.spearman_rho # Spearman rank correlation
dep.lower_tail_dep # lambda_L from best-fit copula
dep.upper_tail_dep # lambda_U from best-fit copula
The four families
| Family | Tail behavior | Parameter | Use case |
|---|---|---|---|
| Gaussian | No tail dependence | rho in (-1, 1) | Symmetric, well-behaved pairs |
| Clayton | Lower-tail dependence | theta > 0 | Crash-together dynamics |
| Gumbel | Upper-tail dependence | theta >= 1 | Rally-together dynamics |
| Frank | No tail dependence | theta != 0 | Symmetric dependence, any strength |
hz.best_copula() fits all four and selects by AIC.
Example: tail risk between two prediction markets
python
import horizon as hz
# Two correlated election markets
returns_a = [...] # daily returns, market A
returns_b = [...] # daily returns, market B
u = hz.rank_transform(returns_a)
v = hz.rank_transform(returns_b)
fit = hz.best_copula(u, v)
print(f"Best family: {fit.family}, lower_tail={fit.lower_tail:.3f}")
# If Clayton wins with high lower_tail, these markets crash together
# more than correlation alone would suggest
When to use
- Portfolio construction: two assets with high correlation but zero tail dependence are safer than two with moderate correlation but high lower-tail dependence.
- Pairs trading: Clayton dependence means the spread blows out asymmetrically during crashes — size accordingly.
- Risk management: if your portfolio has concentrated Gumbel dependence, your upside is more correlated than your downside, which changes hedging logic.