Skip to content

Commit 0afbb1e

Browse files
authored
Revise introduction in documentation for Copulas (#312)
1 parent 29108e3 commit 0afbb1e

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

docs/src/manual/intro.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ You may define a copula object in Julia by simply calling its constructor:
6161

6262
```@example 1
6363
using Copulas
64-
d = 4 # The dimension of the model
64+
d = 3 # The dimension of the model
6565
θ = 7 # Parameter
66-
C = ClaytonCopula(4,7) # A 4-dimensional clayton copula with parameter θ = 7.
66+
C = ClaytonCopula(d,7) # A 3-dimensional clayton copula with parameter θ = 7.
6767
```
6868

6969
This object is a random vector, and behaves exactly as you would expect a random vector from `Distributions.jl` to behave: you may sample it with `rand(C,100)`, compute its pdf or cdf with `pdf(C,x)` and `cdf(C,x)`, etc:
@@ -84,6 +84,18 @@ plot(C, :logpdf)
8484

8585
See [the visualizations page](@ref viz_page) for details on the visualisations tools. It’s often useful to get an intuition by looking at scatter plots.
8686

87+
!!! example "Independence"
88+
To give another example, the function
89+
90+
$\Pi : \boldsymbol x \mapsto \prod_{i=1}^d x_i = \boldsymbol x^{\boldsymbol 1}$ is a copula, corresponding to independent random vectors.
91+
92+
This copula can be constructed using the [`IndependentCopula(d)`](@ref IndependentCopula) syntax as follows:
93+
94+
```@example 1
95+
Π = IndependentCopula(d) # A 4-variate independence structure.
96+
nothing # hide
97+
```
98+
8799
One of the reasons that makes copulas so useful is the bijective map from the Sklar Theorem [sklar1959](@cite):
88100

89101
!!! theorem "Sklar (1959)"
@@ -95,25 +107,14 @@ One of the reasons that makes copulas so useful is the bijective map from the Sk
95107

96108
This result allows to decompose the distribution of $\boldsymbol X$ into several components: the marginal distributions on one side, and the copula on the other side, which governs the dependence structure between the marginals. This object is central in our work, and therefore deserves a moment of attention.
97109

98-
!!! example "Independence"
99-
The function
100-
101-
$\Pi : \boldsymbol x \mapsto \prod_{i=1}^d x_i = \boldsymbol x^{\boldsymbol 1}$ is a copula, corresponding to independent random vectors.
102110

103-
The independence copula can be constructed using the [`IndependentCopula(d)`](@ref IndependentCopula) syntax as follows:
104-
105-
```@example 1
106-
Π = IndependentCopula(d) # A 4-variate independence structure.
107-
nothing # hide
108-
```
109111

110112
We can then leverage the Sklar theorem to construct multivariate random vectors from a copula-marginals specification. The implementation we have of this theorem allows building multivariate distributions by specifying separately their marginals and dependence structures as follows:
111113

112114

113115
```@example 1
114116
X₁, X₂, X₃ = Gamma(2,3), Pareto(), LogNormal(0,1) # Marginals
115-
C = ClaytonCopula(3,0.7) # A 3-variate Clayton Copula with θ = 0.7
116-
D = SklarDist(C, (X₁,X₂,X₃)) # The final distribution
117+
D = SklarDist(C, (X₁,X₂,X₃)) # The final distribution, using the previous copula C.
117118
plot(D, scale=:sklar)
118119
nothing # hide
119120
```
@@ -132,7 +133,7 @@ Sklar's theorem can be used the other way around (from the marginal space to the
132133

133134
!!! info "Independent random vectors"
134135

135-
`Distributions.jl` provides the [`product_distribution`](https://juliastats.org/Distributions.jl/stable/multivariate/#Product-distributions) function to create independent random vectors with given marginals. `product_distribution(args...)` is essentially equivalent to `SklarDist(Π, args)`, but our approach generalizes to other dependence structures.
136+
`Distributions.jl` provides the [`product_distribution`](https://juliastats.org/Distributions.jl/stable/multivariate/#Product-distributions) function to create independent random vectors with given marginals. `product_distribution(args...)` is essentially equivalent to `SklarDist(IndependentCopula(d), args)`, but our approach generalizes to other dependence structures.
136137

137138
Copulas are bounded functions with values in [0,1] since they correspond to probabilities. But their range can be bounded more precisely, and [lux2017](@cite) gives us:
138139

@@ -309,3 +310,5 @@ The documentation of this package aims to combine theoretical information and re
309310
Pages = [@__FILE__]
310311
Canonical = false
311312
```
313+
314+

0 commit comments

Comments
 (0)