Skip to content

Commit

Permalink
[Docs] Proof-reading (#154)
Browse files Browse the repository at this point in the history
* Move from exemples to examples

* Anticonomotony -> anticomonotony

* Typo

* one more typo

* Fix first example
  • Loading branch information
lrnv authored Feb 13, 2024
1 parent 4ae6f36 commit 9fd6733
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 25 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ D = SklarDist(C,(X₁,X₂,X₃)) # The final distribution
simu = rand(D,1000) # Generate a dataset

# You may estimate a copula using the `fit` function:
= fit(SklarDist{FrankCopula,Tuple{Gamma,Normal,LogNormal}}, simu)
# Increase the number of observations to get a beter fit (or not?)
= fit(SklarDist{ClaytonCopula,Tuple{Gamma,Normal,LogNormal}}, simu)
```

The list of availiable copula models is *very* large, check it out on our [documentation](https://lrnv.github.io/Copulas.jl/stable) !
Expand Down
6 changes: 3 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ makedocs(;
],
"Dependence measures" => "dependence_measures.md",
"Examples" => [
"exemples/fitting_sklar.md",
"exemples/turing.md",
"exemples/other_usecases.md"
"examples/fitting_sklar.md",
"examples/turing.md",
"examples/other_usecases.md"
],

"Dev Roadmap" => "dev_roadmap.md",
Expand Down
2 changes: 1 addition & 1 deletion docs/src/dependence_measures.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Spearman's Rho can be obtained through `ρ(C::Copula)`. Its value only depends o
There exists several multivariate extensions of Spearman's rho. The one implemented here is the one we just defined what ever the dimension $d$, be careful as the normalization might differ from other places in the literature.

!!! note "Specific values of tau and rho"
Kendall's $\tau$ and Spearman's $\rho$ have values between -1 and 1, and are -1 in case of complete anticonomotony and 1 in case of comonotony. Moreover, they are 0 in case of independence. This is
Kendall's $\tau$ and Spearman's $\rho$ have values between -1 and 1, and are -1 in case of complete anticomonotony and 1 in case of comonotony. Moreover, they are 0 in case of independence. This is
why we say that they measure the 'strength' of the dependency.

!!! tip "More-that-bivariate cases"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
8 changes: 3 additions & 5 deletions docs/src/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,10 @@ X₃ = LogNormal(0,1)
C = ClaytonCopula(3,0.7) # A 3-variate Clayton Copula with θ = 0.7
D = SklarDist(C,(X₁,X₂,X₃)) # The final distribution

# This generates a (3,1000)-sized dataset from the multivariate distribution D
simu = rand(D,1000)
simu = rand(D,1000) # Generate a dataset

# While the following estimates the parameters of the model from a dataset:
= fit(SklarDist{FrankCopula,Tuple{Gamma,Normal,LogNormal}}, simu)
# Increase the number of observations to get a beter fit (or not?)
# You may estimate a copula using the `fit` function:
= fit(SklarDist{ClaytonCopula,Tuple{Gamma,Normal,LogNormal}}, simu)
```

!!! info "About fitting methods"
Expand Down
10 changes: 5 additions & 5 deletions src/ArchimedeanCopula.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ Constructor:
ArchimedeanCopula(d::Int,G::Generator)
For some Archimedean [`Generator`](@ref) `G::Generator` and some dimenson `d`, this class models the archimedean copula wich has this generator. The constructor checks for validity by ensuring that `max_monotony(G) ≥ d`. The ``d``-variate archimedean copula with generator ``\\phi`` writes:
For some Archimedean [`Generator`](@ref) `G::Generator` and some dimenson `d`, this class models the archimedean copula which has this generator. The constructor checks for validity by ensuring that `max_monotony(G) ≥ d`. The ``d``-variate archimedean copula with generator ``\\phi`` writes:
```math
C(\\mathbf u) = \\phi^{-1}\\left(\\sum_{i=1}^d \\phi(u_i)\\right)
```
The default sampling method is the Radial-simplex decomposition using the williamson transformation of ``\\phi``.
The default sampling method is the Radial-simplex decomposition using the Williamson transformation of ``\\phi``.
There exists several known parametric generators that are implement in the package. For every `NamedGenerator <: Generator` implemented in the package, we provide a type alias ``NamedCopula{d,...} = ArchimedeanCopula{d,NamedGenerator{...}}` to be able to manipulate the classic archimedean copulas without too much hassle for known and usefull special cases.
Expand All @@ -35,7 +35,7 @@ pdf(C,spl) # pdf
loglikelihood(C,spl) # llh
```
Bonus: If you know the williamson d-transform of your generator and not your generator itself, you may take a look at [`WilliamsonGenerator`](@ref) that implements them. If you rather know the frailty distribution, take a look at `WilliamsonFromFrailty`.
Bonus: If you know the Williamson d-transform of your generator and not your generator itself, you may take a look at [`WilliamsonGenerator`](@ref) that implements them. If you rather know the frailty distribution, take a look at `WilliamsonFromFrailty`.
References:
* [williamson1955multiply](@cite) Williamson, R. E. (1956). Multiply monotone functions and their Laplace transforms. Duke Math. J. 23 189–207. MR0077581
Expand Down Expand Up @@ -94,7 +94,7 @@ end
# end

function Distributions._rand!(rng::Distributions.AbstractRNG, C::CT, x::AbstractVector{T}) where {T<:Real, CT<:ArchimedeanCopula}
# By default, we use the williamson sampling.
# By default, we use the Williamson sampling.
Random.randexp!(rng,x)
r = rand(rng,williamson_dist(C))
sx = sum(x)
Expand All @@ -104,7 +104,7 @@ function Distributions._rand!(rng::Distributions.AbstractRNG, C::CT, x::Abstract
return x
end
function Distributions._rand!(rng::Distributions.AbstractRNG, C::CT, A::DenseMatrix{T}) where {T<:Real, CT<:ArchimedeanCopula}
# More efficient version that precomputes the williamson transform on each call to sample in batches:
# More efficient version that precomputes the Williamson transform on each call to sample in batches:
Random.randexp!(rng,A)
n = size(A,2)
r = rand(rng,williamson_dist(C),n)
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/UnivariateGenerator/InvGaussianGenerator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Constructor
The Inverse Gaussian copula in dimension ``d`` is parameterized by ``\\theta \\in [0,\\infty)``. It is an Archimedean copula with generator :
```math
\\phi(t) = \\exp{\\frac{(1-\\sqrt{1+2θ^{2}t}}{θ}}.
\\phi(t) = \\exp{\\frac{1-\\sqrt{1+2θ^{2}t}}{θ}}.
```
More details about Inverse Gaussian Archimedean copula are found in :
Expand Down
4 changes: 2 additions & 2 deletions src/Generator/WilliamsonGenerator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
i𝒲{TX}
Fields:
* `X::TX` -- a random variable that represents its williamson d-transform
* `X::TX` -- a random variable that represents its Williamson d-transform
* `d::Int` -- the dimension of the transformation.
Constructor
WilliamsonGenerator(X::Distributions.UnivariateDistribution, d)
i𝒲(X::Distributions.UnivariateDistribution,d)
The `WilliamsonGenerator` (alias `i𝒲`) allows to construct a d-monotonous archimedean generator from a positive random variable `X::Distributions.UnivariateDistribution`. The transformation, wich is called the inverse williamson transformation, is implemented in [WilliamsonTransforms.jl](https://www.github.com/lrnv/WilliamsonTransforms.jl).
The `WilliamsonGenerator` (alias `i𝒲`) allows to construct a d-monotonous archimedean generator from a positive random variable `X::Distributions.UnivariateDistribution`. The transformation, which is called the inverse Williamson transformation, is implemented in [WilliamsonTransforms.jl](https://www.github.com/lrnv/WilliamsonTransforms.jl).
For a univariate non-negative random variable ``X``, with cumulative distribution function ``F`` and an integer ``d\\ge 2``, the Williamson-d-transform of ``X`` is the real function supported on ``[0,\\infty[`` given by:
Expand Down
2 changes: 1 addition & 1 deletion src/MiscellaneousCopulas/EmpiricalCopula.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Constructor
EmpiricalCopula(u;pseudos=true)
The EmpiricalCopula in dimension ``d`` is parameterized by a pseudo-data matrix wich should have shape (d,N). Its expression is given as :
The EmpiricalCopula in dimension ``d`` is parameterized by a pseudo-data matrix which should have shape (d,N). Its expression is given as :
```math
C(\\mathbf x) = \\frac{1}{N}\\sum_{i=1}^n \\mathbf 1_{\\mathbf u_i \\le \\mathbf x}
Expand Down
8 changes: 3 additions & 5 deletions src/SklarDist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ X₃ = LogNormal(0,1)
C = ClaytonCopula(3,0.7) # A 3-variate Clayton Copula with θ = 0.7
D = SklarDist(C,(X₁,X₂,X₃)) # The final distribution
# This generates a (3,1000)-sized dataset from the multivariate distribution D
simu = rand(D,1000)
simu = rand(D,1000) # Generate a dataset
# While the following estimates the parameters of the model from a dataset:
D̂ = fit(SklarDist{FrankCopula,Tuple{Gamma,Normal,LogNormal}}, simu)
# Increase the number of observations to get a beter fit (or not?)
# You may estimate a copula using the `fit` function:
D̂ = fit(SklarDist{ClaytonCopula,Tuple{Gamma,Normal,LogNormal}}, simu)
```
References:
Expand Down

0 comments on commit 9fd6733

Please sign in to comment.