diff --git a/README.md b/README.md index 17f2ba75..b9381e5f 100644 --- a/README.md +++ b/README.md @@ -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: -D̂ = fit(SklarDist{FrankCopula,Tuple{Gamma,Normal,LogNormal}}, simu) -# Increase the number of observations to get a beter fit (or not?) +D̂ = 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) ! diff --git a/docs/make.jl b/docs/make.jl index e10ec98e..344f0fea 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -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", diff --git a/docs/src/dependence_measures.md b/docs/src/dependence_measures.md index c9647c48..5a15946a 100644 --- a/docs/src/dependence_measures.md +++ b/docs/src/dependence_measures.md @@ -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" diff --git a/docs/src/exemples/fitting_sklar.md b/docs/src/examples/fitting_sklar.md similarity index 100% rename from docs/src/exemples/fitting_sklar.md rename to docs/src/examples/fitting_sklar.md diff --git a/docs/src/exemples/other_usecases.md b/docs/src/examples/other_usecases.md similarity index 100% rename from docs/src/exemples/other_usecases.md rename to docs/src/examples/other_usecases.md diff --git a/docs/src/exemples/turing.md b/docs/src/examples/turing.md similarity index 100% rename from docs/src/exemples/turing.md rename to docs/src/examples/turing.md diff --git a/docs/src/exemples/turing_plot.png b/docs/src/examples/turing_plot.png similarity index 100% rename from docs/src/exemples/turing_plot.png rename to docs/src/examples/turing_plot.png diff --git a/docs/src/getting_started.md b/docs/src/getting_started.md index f0e5d038..2139d9d4 100644 --- a/docs/src/getting_started.md +++ b/docs/src/getting_started.md @@ -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: -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) ``` !!! info "About fitting methods" diff --git a/src/ArchimedeanCopula.jl b/src/ArchimedeanCopula.jl index 9d6f8952..e0532620 100644 --- a/src/ArchimedeanCopula.jl +++ b/src/ArchimedeanCopula.jl @@ -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. @@ -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 @@ -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) @@ -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) diff --git a/src/Generator/UnivariateGenerator/InvGaussianGenerator.jl b/src/Generator/UnivariateGenerator/InvGaussianGenerator.jl index 5ae2206d..cd4f13b8 100644 --- a/src/Generator/UnivariateGenerator/InvGaussianGenerator.jl +++ b/src/Generator/UnivariateGenerator/InvGaussianGenerator.jl @@ -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 : diff --git a/src/Generator/WilliamsonGenerator.jl b/src/Generator/WilliamsonGenerator.jl index 6b2feb59..178579b8 100644 --- a/src/Generator/WilliamsonGenerator.jl +++ b/src/Generator/WilliamsonGenerator.jl @@ -3,7 +3,7 @@ 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 @@ -11,7 +11,7 @@ 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: diff --git a/src/MiscellaneousCopulas/EmpiricalCopula.jl b/src/MiscellaneousCopulas/EmpiricalCopula.jl index e91b6917..3830d27e 100644 --- a/src/MiscellaneousCopulas/EmpiricalCopula.jl +++ b/src/MiscellaneousCopulas/EmpiricalCopula.jl @@ -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} diff --git a/src/SklarDist.jl b/src/SklarDist.jl index 76f5b565..36c70647 100644 --- a/src/SklarDist.jl +++ b/src/SklarDist.jl @@ -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: