# \[ANN\] VineCopulas.jl: C-vines, D-vines, and experimental R-vines in Julia

**URL:** <https://discourse.julialang.org/t/ann-vinecopulas-jl-c-vines-d-vines-and-experimental-r-vines-in-julia/137930>\
**Category:** Package Announcements\
**Tags:** announcement, statistics, packages, probability, copula\
**Created:** [July 3, 2026, 9:11pm UTC](https://discourse.julialang.org/t/ann-vinecopulas-jl-c-vines-d-vines-and-experimental-r-vines-in-julia/137930 "2026-07-03T21:11:24Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![dcelisgarza](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dcelisgarza/32/215951_2.png) [@dcelisgarza](https://discourse.julialang.org/u/dcelisgarza)\
**Post date:** [September 12, 2026, 12:40pm UTC](https://discourse.julialang.org/t/ann-vinecopulas-jl-c-vines-d-vines-and-experimental-r-vines-in-julia/137930/23 "2026-09-12T12:40:47Z")

</div>

I want to implement a way to generate scenarios which keep the relational structure between stocks. But in a way that lets me test these relations under extreme conditions.

So for example say A and B. And i want to generate a distribution where B shows extreme tail behaviour, for example it only ever returns losses less than 10% or gains greater than 10%

B \leq -0.1 \cup B \geq 0.1.

It’s unrealistic for actual assets, but for stuff like crypto on ~~longer timescales~~ lower frequencies (like daily returns or longer) this is not too wild.

Having a way to generate prior distributions that keep these relations under extreme events can help in the callibration of optimisations to make them less sensitive to such events.

---

<div class="post-metadata">

**Author:** ![lrnv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lrnv/32/19373_2.png) [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Post date:** [September 12, 2026, 12:57pm UTC](https://discourse.julialang.org/t/ann-vinecopulas-jl-c-vines-d-vines-and-experimental-r-vines-in-julia/137930/24 "2026-09-12T12:57:20Z")

</div>

```julia
using Copulas, Distributions

a = 0.1 # evaluation point

A = LogNormal(0,1)
B = Normal(0,1)
cop = ClaytonCopula{2}(0.7)
X = SklarDist(cop, (A,B))
Y = SklarDist(SurvivalCopula(cop, 2), (A,B)) # flips the second dimension.

x = cdf(X, [a,-0.1]) # this is P(A <= a, B <= -0.1)
y = cdf(Y, [t,0.1]) # this is P(A <= a, B >= 0.1)
z = cdf(B, -0.1) + ccdf(B, 0.1) # this is P(B \le -0.1 OR B \ge 0.1)

rez = (x+y) / z # this is therefore P(A <= a | B \le -0.1 OR B \ge 0.1)

```

Here i have the cdf, I think you can also get the pdf by being a bit clever. For sampling i would use truncation or even importance sampling looks the easiest.

---

<div class="post-metadata">

**Author:** ![dcelisgarza](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dcelisgarza/32/215951_2.png) [@dcelisgarza](https://discourse.julialang.org/u/dcelisgarza)\
**Post date:** [September 12, 2026, 1:01pm UTC](https://discourse.julialang.org/t/ann-vinecopulas-jl-c-vines-d-vines-and-experimental-r-vines-in-julia/137930/25 "2026-09-12T13:01:55Z")

</div>

Brother, this is it. I think that’s all i need to finally add this feature that’s been a thorn in my side for so long.

The extra dependence structures on the vines would be nice, but i might even be able to make that PR myself later down the road. Probably as an extension as it would probably take Clustering.jl as a dependency.

Thank you.

---

<div class="post-metadata">

**Author:** ![lrnv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lrnv/32/19373_2.png) [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Post date:** [September 12, 2026, 1:02pm UTC](https://discourse.julialang.org/t/ann-vinecopulas-jl-c-vines-d-vines-and-experimental-r-vines-in-julia/137930/26 "2026-09-12T13:02:52Z")

</div>

Happy to help 🙂

[Previous page](https://discourse.julialang.org/t/ann-vinecopulas-jl-c-vines-d-vines-and-experimental-r-vines-in-julia/137930.md?page=1)
