Skip to content

Commit

Permalink
Convert docstring references to the right format and add a few more
Browse files Browse the repository at this point in the history
Fixes #88
  • Loading branch information
lrnv committed Feb 7, 2024
1 parent 8db1a09 commit 43133de
Show file tree
Hide file tree
Showing 19 changed files with 66 additions and 17 deletions.
11 changes: 10 additions & 1 deletion joss/paper.bib
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ @book{joe2014
file = {C:\Users\lrnv\Zotero\storage\VMB6EMI8\Joe - 2014 - Dependence modeling with copulas.pdf}
}
@book{johnson1987multivariate,
title={Multivariate statistical simulation: A guide to selecting and generating continuous multivariate distributions},
author={Johnson, Mark E},
volume={192},
year={1987},
publisher={John Wiley \& Sons}
}
@book{durantePrinciplesCopulaTheory2015,
title = {Principles of Copula Theory},
author = {Durante, Fabrizio and Sempi, Carlo},
Expand Down Expand Up @@ -222,4 +230,5 @@ @software{BivariateCopulas
version = {v0.1.5},
doi = {10.5281/zenodo.10412898},
url = {https://doi.org/10.5281/zenodo.10412898}
}
}
3 changes: 3 additions & 0 deletions src/EllipticalCopula.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ Recall that spherical random vectors are random vectors which characteristic fun
We can therefore express this characteristic function as ``\\phi(\\bm t) = \\psi(\\lVert \\bm t \\rVert_2^2)``, where ``\\psi`` is a function that characterizes the spherical family, called the *generator* of the family. Any characteristic function that can be expressed as a function of the norm of its argument is the characteristic function of a spherical random vector, since ``\\lVert \\bm A \\bm t \\rVert_2 = \\lVert \\bm t \\rVert_2`` for any orthogonal matrix ``\\bm A``.
However, note that this is not how the underlying code is working, we do not check for validity of the proposed generator (we dont even use it)
References:
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006.
"""
abstract type EllipticalCopula{d,MT} <: Copula{d} end
Base.eltype(C::CT) where CT<:EllipticalCopula = Base.eltype(N(CT)(C.Σ))
Expand Down
3 changes: 3 additions & 0 deletions src/EllipticalCopulas/GaussianCopula.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ And yo can fit the distribution via :
```julia
fit(GaussianCopula,data)
```
References:
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006.
"""
struct GaussianCopula{d,MT} <: EllipticalCopula{d,MT}
Σ::MT
Expand Down
3 changes: 3 additions & 0 deletions src/EllipticalCopulas/TCopula.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ fit(TCopula,data)
```
Except that currently it does not work since `fit(Distributions.MvTDist,data)` does not dispatch.
References:
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006.
"""
struct TCopula{d,df,MT} <: EllipticalCopula{d,MT}
Σ::MT
Expand Down
3 changes: 3 additions & 0 deletions src/Generator/UnivariateGenerator/AMHGenerator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ The [AMH](https://en.wikipedia.org/wiki/Copula_(probability_theory)#Most_importa
It has a few special cases:
- When θ = 0, it is the IndependentCopula
References:
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006.
"""
struct AMHGenerator{T} <: UnivariateGenerator
θ::T
Expand Down
3 changes: 3 additions & 0 deletions src/Generator/UnivariateGenerator/ClaytonGenerator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ It has a few special cases:
- When θ = -1/(d-1), it is the WCopula (Lower Frechet-Hoeffding bound)
- When θ = 0, it is the IndependentCopula
- When θ = ∞, is is the MCopula (Upper Frechet-Hoeffding bound)
References:
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006.
"""
struct ClaytonGenerator{T} <: UnivariateGenerator
θ::T
Expand Down
3 changes: 3 additions & 0 deletions src/Generator/UnivariateGenerator/FrankGenerator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ It has a few special cases:
- When θ = -∞, it is the WCopula (Lower Frechet-Hoeffding bound)
- When θ = 1, it is the IndependentCopula
- When θ = ∞, is is the MCopula (Upper Frechet-Hoeffding bound)
References:
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006.
"""
struct FrankGenerator{T} <: UnivariateGenerator
θ::T
Expand Down
8 changes: 4 additions & 4 deletions src/Generator/UnivariateGenerator/GumbelBarnettGenerator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ The Gumbel-Barnett copula is an archimdean copula with generator:
\\phi(t) = \\exp{θ^{-1}(1-e^{t})}, 0 \\leq \\theta \\leq 1.
```
More details about Gumbel-Barnett copula are found in:
Joe, H. (2014). Dependence modeling with copulas. CRC press, Page.437
It has a few special cases:
- When θ = 0, it is the IndependentCopula
References:
* [joe2014](@cite) Joe, H. (2014). Dependence modeling with copulas. CRC press, Page.437
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006.
"""
struct GumbelBarnettGenerator{T} <: UnivariateGenerator
θ::T
Expand Down
3 changes: 3 additions & 0 deletions src/Generator/UnivariateGenerator/GumbelGenerator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ The [Gumbel](https://en.wikipedia.org/wiki/Copula_(probability_theory)#Most_impo
It has a few special cases:
- When θ = 1, it is the IndependentCopula
- When θ = ∞, is is the MCopula (Upper Frechet-Hoeffding bound)
References:
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006.
"""
struct GumbelGenerator{T} <: UnivariateGenerator
θ::T
Expand Down
3 changes: 3 additions & 0 deletions src/Generator/UnivariateGenerator/InvGaussianGenerator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ More details about Inverse Gaussian Archimedean copula are found in :
It has a few special cases:
- When θ = 0, it is the IndependentCopula
References:
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006.
"""
struct InvGaussianGenerator{T} <: UnivariateGenerator
θ::T
Expand Down
3 changes: 3 additions & 0 deletions src/Generator/UnivariateGenerator/JoeGenerator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ The [Joe](https://en.wikipedia.org/wiki/Copula_(probability_theory)#Most_importa
It has a few special cases:
- When θ = 1, it is the IndependentCopula
- When θ = ∞, is is the MCopula (Upper Frechet-Hoeffding bound)
References:
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006.
"""
struct JoeGenerator{T} <: UnivariateGenerator
θ::T
Expand Down
3 changes: 3 additions & 0 deletions src/Generator/ZeroVariateGenerator/IndependentGenerator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ It happends to be an Archimedean Copula, with generator :
```math
\\phi(t) = \\exp{-t}
```
References:
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006.
"""
struct IndependentGenerator <: ZeroVariateGenerator end
max_monotony(::IndependentGenerator) = Inf
Expand Down
3 changes: 3 additions & 0 deletions src/Generator/ZeroVariateGenerator/MGenerator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ W(\\mathbf{u}) \\le C(\\mathbf{u}) \\le M(\\mathbf{u})
```
The two Frechet-Hoeffding bounds are also Archimedean copulas.
References:
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006.
"""
struct MGenerator <: ZeroVariateGenerator end
max_monotony(::MGenerator) = Inf
Expand Down
3 changes: 3 additions & 0 deletions src/Generator/ZeroVariateGenerator/WGenerator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ W(\\mathbf{u}) \\le C(\\mathbf{u}) \\le M(\\mathbf{u})
```
The two Frechet-Hoeffding bounds are also Archimedean copulas.
References:
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006.
"""
struct WGenerator <: ZeroVariateGenerator end
max_monotony(G::WGenerator) = 2
Expand Down
3 changes: 3 additions & 0 deletions src/MiscellaneousCopulas/EmpiricalCopula.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ C(\\mathbf x) = \\frac{1}{N}\\sum_{i=1}^n \\mathbf 1_{\\mathbf u_i \\le \\mathbf
```
This function is very practical, be be aware that this is not a true copula (since ``\\mathbf u`` are only pseudo-observations). The constructor allows you to pass dirctly pseudo-observations (the default) or will compute them for you. You can then compute the `cdf` of the copula, and sample it through the standard interface.
References:
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006.
"""
struct EmpiricalCopula{d,MT} <: Copula{d}
u::MT
Expand Down
3 changes: 3 additions & 0 deletions src/MiscellaneousCopulas/FGMCopula.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ We use the stochastic representation of the copula to obtain random samples.
It has a few special cases:
- When d=2 and θ = 0, it is the IndependentCopula.
References:
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006.
"""
struct FGMCopula{d, Tθ} <: Copula{d}
θ::Tθ
Expand Down
16 changes: 5 additions & 11 deletions src/MiscellaneousCopulas/PlackettCopula.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,12 @@ C_{1}(u,v) = uv
It has a few special cases:
- When θ = 0, is is the MCopula (Upper Frechet-Hoeffding bound)
- When θ = 1, it is the IndependentCopula
- When θ = ∞, is is the WCopula (Lower Frechet-Hoeffding bound)
- When θ = ∞, is is the WCopula (Lower Frechet-Hoeffding bound)
More details about Plackett Copula are found in:
Joe, H. (2014). Dependence modeling with copulas. CRC press, Page.164
Details about the algorithm to generate copula samples can be seen in the following references:
Johnson, Mark E. Multivariate statistical simulation:
A guide to selecting and generating continuous multivariate distributions.
Vol. 192. John Wiley & Sons, 1987. Page 193.
Nelsen, Roger B. An introduction to copulas. Springer, 2006. Exercise 3.38.
References:
* [joe2014](@cite) Joe, H. (2014). Dependence modeling with copulas. CRC press, Page.164
* [johnson1987multivariate](@cite) Johnson, Mark E. Multivariate statistical simulation: A guide to selecting and generating continuous multivariate distributions. Vol. 192. John Wiley & Sons, 1987. Page 193.
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006. Exercise 3.38.
"""
struct PlackettCopula{P} <: Copula{2} # since it is only bivariate.
θ::P # Copula parameter
Expand Down
5 changes: 4 additions & 1 deletion src/MiscellaneousCopulas/SurvivalCopula.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ Computes the survival version of any copula on given indices. From a copula ``C`
S(u_1,...u_4) = C(u_1,1-u_2,1-u3,u_4)
```
This constructor allows to derive new "survival" families. For exemple, in bivariate cases, this allows to do "rotations". The obtained models can be treated as the starting one, i.e. as a random vector in [0,1]^d with uniforms marginals.
This constructor allows to derive new "survival" families. For exemple, in bivariate cases, this allows to do "rotations". The obtained models can be treated as the starting one, i.e. as a random vector in [0,1]^d with uniforms marginals.
References:
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006.
"""
struct SurvivalCopula{d,CT,VI} <: Copula{d}
C::CT
Expand Down
1 change: 1 addition & 0 deletions src/SklarDist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ D̂ = fit(SklarDist{FrankCopula,Tuple{Gamma,Normal,LogNormal}}, simu)
References:
* [sklar1959](@cite) Sklar, M. (1959). Fonctions de répartition à n dimensions et leurs marges. In Annales de l'ISUP (Vol. 8, No. 3, pp. 229-231).
* [nelsen2006](@cite) Nelsen, Roger B. An introduction to copulas. Springer, 2006.
"""
struct SklarDist{CT,TplMargins} <: Distributions.ContinuousMultivariateDistribution
C::CT
Expand Down

0 comments on commit 43133de

Please sign in to comment.