Streamlining Python Development: A Guide to a Modern Project Setup
Berlin
1. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Nonparametric estimation of copula
densities
A. Charpentier1
, J.D. Fermanian2
& O. Scaillet3
Gemeinsame Jahrestagung der Deutschen Mathematiker-Vereinigung und der
Gesellschaft für Didaktik der Mathematik,
Multivariate Dependence Modelling using Copulas - Applications in Finance
Humboldt-Universität zu Berlin, March 2007
1ensae-ensai-crest & Katholieke Universiteit Leuven, 2CoopeNeff A.M. & crest et 3HEC Genève & FAME
1
2. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
One (short) word on copulas
Definition 1. A 2-dimensional copula is a 2-dimensional cumulative
distribution function restricted to [0, 1]2
with standard uniform margins.
Copula (cumulative distribution function) Level curves of the copula
Copula density Level curves of the copula
If C is twice differentiable, let c denote the density of the copula.
2
3. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Theorem 2. (Sklar) Let C be a copula, and FX and FY two marginal
distributions, then F(x, y) = C(FX(x), FY (y)) is a bivariate distribution
function, with F ∈ F(FX, FY ).
Conversely, if F ∈ F(FX, FY ), there exists C such that
F(x, y) = C(FX(x), FY (y). Further, if FX and FY are continuous, then C is
unique, and given by
C(u, v) = F(F−1
X (u), F−1
Y (v)) for all (u, v) ∈ [0, 1] × [0, 1]
We will then define the copula of F, or the copula of (X, Y ).
3
4. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Motivation
Example Loss-ALAE: consider the following dataset, were the Xi’s are loss
amount (paid to the insured) and the Yi’s are allocated expenses. Denote by
Ri and Si the respective ranks of Xi and Yi. Set Ui = Ri/n = ˆFX(Xi) and
Vi = Si/n = ˆFY (Yi).
Figure 1 shows the log-log scatterplot (log Xi, log Yi), and the associate copula
based scatterplot (Ui, Vi).
Figure 2 is simply an histogram of the (Ui, Vi), which is a nonparametric
estimation of the copula density.
Note that the histogram suggests strong dependence in upper tails (the
interesting part in an insurance/reinsurance context).
4
5. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
1 2 3 4 5 6
12345
Log−log scatterplot, Loss−ALAE
log(LOSS)
log(ALAE)
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.0
Copula type scatterplot, Loss−ALAE
Probability level LOSSProbabilitylevelALAE
Figure 1: Loss-ALAE, scatterplots (log-log and copula type).
5
6. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Figure 2: Loss-ALAE, histogram of copula type transformation.
6
7. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Basic notions on nonparametric estimation of densities
Let {X1, ..., Xn} denote an i.i.d. sample with density f.
The standard kernel estimate of a density is,
f(x) =
1
nh
n
i=1
K
x − Xi
h
,
where K is a kernel function (e.g. K(ω) = I(|ω| ≤ 1)/2 for the moving
histogram).
If {X1, ..., Xn} of positive random variable (Xi ∈ [0, ∞[). Let K denote a
symmetric kernel, then
E(f(0, h) =
1
2
f(0) + O(h)
7
8. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Exponential random variables
Density
−1 0 1 2 3 4 5 6
0.00.20.40.60.81.01.2
Exponential random variables
Density
−1 0 1 2 3 4 5 6
0.00.20.40.60.81.01.2Figure 3: Density estimation of an exponential density, 100 points.
8
9. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.01.2
Kernel based estimation of the uniform density on [0,1]
Density
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.01.2
Kernel based estimation of the uniform density on [0,1]
Density
Figure 4: Density estimation of an uniform density on [0, 1].
9
10. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
How to get a proper estimation on the border
Several techniques have been introduce to get a better estimation on the
border,
• boundary kernel (Müller (1991))
• mirror image modification (Deheuvels & Hominal (1989), Schuster
(1985))
• transformed kernel (Devroye & Györfi (1981), Wand, Marron &
Ruppert (1991))
In the particular case of densities on [0, 1],
• Beta kernel (Brown & Chen (1999), Chen (1999, 2000)),
• average of histograms inspired by Dersko (1998).
10
11. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
The mirror image modification
The idea is to fit a density to the enlarged sample −X1, ..., −Xn, X1, ..., Xn
(for a positive distribution) and −X1, ..., −Xn, X1, ..., Xn, 2 − X1, ..., 2 − Xn
(for a distribution with support [0, 1]).
The estimator of the density is
f(x, h) =
1
nh
n
i=1
K
x − Xi
h
+ K
x + Xi
h
.
Remark: It works well when the density f has a null derivative in 0.
11
12. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
−1.0 −0.5 0.0 0.5 1.0 1.5 2.0
0.00.51.01.52.0
Density estimation using mirror image
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.52.0
Density estimation using mirror image
Figure 5: The mirror image principle.
12
13. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
The transformed Kernel estimate
The idea was developed in Devroye & Györfi (1981) for univariate
densities.
Consider a transformation T : R → [0, 1] strictly increasing, continuously
differentiable, one-to-one, with a continuously differentiable inverse.
Set Y = T(X). Then Y has density
fY (y) = fX(T−1
(y)) · (T−1
) (y).
If fY is estimated by fY , then fX is estimated by
fX(x) = fY (T(x)) · T (x).
13
14. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
−3 −2 −1 0 1 2 3
0.00.10.20.30.40.5
Density estimation transformed kernel
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.52.0
Density estimation transformed kernel
Figure 6: The transform kernel principle (with a Φ−1
-transformation).
14
15. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
The Beta Kernel estimate
The Beta-kernel based estimator of a density with support [0, 1] at point x, is
obtained using beta kernels, which yields
f(x) =
1
n
n
i=1
K Xi,
u
b
+ 1,
1 − u
b
+ 1
where K(·, α, β) denotes the density of the Beta distribution with parameters
α and β,
K(x, α, β) =
Γ(α + β)
Γ(α)Γ(β)
xα
(1 − x)β−1
1(x ∈ [0, 1]).
15
16. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.0 0.2 0.4 0.6 0.8 1.0
0246810
Gaussian Kernel approach
0.0 0.2 0.4 0.6 0.8 1.0
0246810
Beta Kernel approach
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.52.0
Density estimation using beta kernels
Figure 7: The beta-kernel estimate.
16
17. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
The average of histograms
In a very general context Dersko (1998) introduced the intrinsic estimator of
the density, as the average of all possible histograms. Consider the case of a
density on the unit interval [0, 1]. Let Jm denote the set of all partitions of
[0, 1) into m + 1 subintervals. Define fm(·) as the average of all the histograms,
fm(·) =
1
#Jm
Im∈Jm
fIm
(x), (1)
as in Dersko (1998).
Let Im = (I0:m, I1:m, I2:m, . . . , Im:m) a partition of [0, 1) into m + 1
subintervals, I = i Ii:m. Set Ii:m = [ui−1:m, ui:m), where
u0:m = 0 < u1:m < · · · < uk:m < uk+1:m = 1. The histogram of X1, . . . , Xn
associated to Ik is
fIm
(x) =
1
n · [ui:m − ui−1:m]
n
j=1
1(Xi ∈ Ii:m), where x ∈ Ii:m.
17
18. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.5
Average of histograms, m=1
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.5
Average of histograms, m=1
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.5
Average of histograms, m=1
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.5
Average of histograms, m=1
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.52.0
Density as average of randomized histograms, n=250, m=1
Figure 8: Average of histograms, m = 1.
18
19. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.5
Average of histograms, m=2
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.5
Average of histograms, m=2
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.5
Average of histograms, m=2
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.5
Average of histograms, m=2
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.52.0
Density as average of randomized histograms, n=250, m=2
Figure 9: Average of histograms, m = 2.
19
20. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.5
Average of histograms, m=5
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.5
Average of histograms, m=5
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.5
Average of histograms, m=5
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.5
Average of histograms, m=5
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.52.0
Density as average of randomized histograms, n=250, m=5
Figure 10: Average of histograms, m = 5.
20
21. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.52.0
Density as average of randomized histograms, n=250, m=10
0.0 0.2 0.4 0.6 0.8 1.0
0.00.51.01.52.0
Density as average of randomized histograms, n=250, m=20
Figure 11: Average of histograms, m = 10 and m = 20.
21
22. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.0 0.2 0.4 0.6 0.8 1.0
0246810
Gaussian Kernel approach
0.0 0.2 0.4 0.6 0.8 1.0
0246810
Beta Kernel approach
0.0 0.2 0.4 0.6 0.8 1.0
0246810
Average of histograms
0.0 0.2 0.4 0.6 0.8 1.00246810
Average of histograms
Figure 12: Shape of the induced kernel based on uniform averaging.
22
23. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Copula density estimation: the boundary problem
Let (U1, V1), ..., (Un, Vn) denote a sample with support [0, 1]2
, and with density
c(u, v), which is assumed to be twice continuously differentiable on (0, 1)2
.
If K denotes a symmetric kernel, with support [−1, +1], then for all
(u, v) ∈ [0, 1] × [0, 1], in any corners (e.g. (0, 0))
E(c(0, 0, h)) =
1
4
· c(u, v) −
1
2
[c1(0, 0) + c2(0, 0)]
1
0
ωK(ω)dω · h + o(h).
on the interior of the borders (e.g. u = 0 and v ∈ (0, 1)),
E(c(0, v, h)) =
1
2
· c(u, v) − [c1(0, v)]
1
0
ωK(ω)dω · h + o(h).
and in the interior ((u, v) ∈ (0, 1) × (0, 1)),
E(c(u, v, h)) = c(u, v) +
1
2
[c1,1(u, v) + c2,2(u, v)]
1
−1
ω2
K(ω)dω · h2
+ o(h2
).
23
24. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
On borders, there is a multiplicative bias and the order of the bias is O(h)
(while it is O(h2
) in the interior).
If K denotes a symmetric kernel, with support [−1, +1], then for all
(u, v) ∈ [0, 1] × [0, 1], in any corners (e.g. (0, 0))
V ar(c(0, 0, h)) = c(0, 0)
1
0
K(ω)2
dω
2
·
1
nh2
+ o
1
nh2
.
on the interior of the borders (e.g. u = 0 and v ∈ (0, 1)),
V ar(c(0, v, h)) = c(0, v)
1
−1
K(ω)2
dω
1
0
K(ω)2
dω ·
1
nh2
+ o
1
nh2
.
and in the interior ((u, v) ∈ (0, 1) × (0, 1)),
V ar(c(u, v, h)) = c(u, v)
1
−1
K(ω)2
dω
2
d ·
1
nh2
+ o
1
nh2
.
24
25. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0
1
2
3
4
5
Estimation of Frank copula
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.0
Figure 13: Theoretical density of Frank copula.
25
26. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0
1
2
3
4
5
Estimation of Frank copula
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.0
Figure 14: Estimated density of Frank copula, using standard Gaussian (inde-
pendent) kernels, h = h∗
.
26
27. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Transformed kernel technique
Consider the kernel estimator of the density of the
(Xi, Yi) = (G−1
(Ui), G−1
(Vi))’s, where G is a strictly increasing distribution
function, with a differentiable density. Since density f is continuous, twice
differentiable, and bounded above, for all (x, y) ∈ R2
, define
f(x, y) =
1
nh2
n
i=1
K
x − Xi
h
K
y − Yi
h
,
Since
f(x, y) = g(x)g(y)c[G(x), G(y)]. (2)
can be inverted in
c(u, v) =
f(G−1
(u), G−1
(v))
g(G−1(u))g(G−1(v))
, (u, v) ∈ [0, 1] × [0, 1], (3)
27
28. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
one gets, substituting f in (3)
c(u, v) =
1
nh · g(G−1(u)) · g(G−1(v))
n
i=1
K
G−1
(u) − G−1
(Ui)
h
,
G−1
(v) − G−1
(Vi)
h
,
(4)
Therefore,
E(c(u, v, h)) = c(u, v) +
o(h)
g(G−1(u))g(G−1(v))
.
Similarly,
V ar(c(u, v, h)) =
1
g(G−1(u))g(G−1(v))
c(u, v)
nh2
K(ω)2
dω
2
+
1
g(G−1(u))2g(G−1(v))2
o
1
nh2
.
Asymptotic normality and also be derived.
28
29. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0
1
2
3
4
5
Estimation of Frank copula
0.2 0.4 0.6 0.8
0.20.40.60.8
Figure 15: Estimated density of Frank copula, using a Gaussian kernel, after a
Gaussian normalization.
29
30. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0
1
2
3
4
5
Estimation of Frank copula
0.2 0.4 0.6 0.8
0.20.40.60.8
Figure 16: Estimated density of Frank copula, using a Gaussian kernel, after a
Student normalization, with 5 degrees of freedom.
30
31. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0
1
2
3
4
5
Estimation of Frank copula
0.2 0.4 0.6 0.8
0.20.40.60.8
Figure 17: Estimated density of Frank copula, using a Gaussian kernel, after a
Student normalization, with 3 degrees of freedom.
31
32. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Using the mirror reflection principle
Instead of using only the (Ui, Vi)’s the mirror image consists in reflecting each
data point with respect to all edges and corners of the unit square [0, 1] × [0, 1].
Hence, additional observations can be considered, i.e. the (±Ui, ±Vi)’s, the
(±Ui, 2 − Vi)’s, the (2 − Ui, ±Vi)’s and the (2 − Ui, 2 − Vi)’s. Hence, consider
ˆc(u, v) =
1
nh
n
i=1
K
u − Ui
h
K
v − Vi
h
+ K
u + Ui
h
K
v − Vi
h
+
K
u − Ui
h
K
v + Vi
h
+ K
u + Ui
h
K
v + Vi
h
+
K
u − Ui
h
K
v − 2 + Vi
h
+ K
u + Ui
h
K
v − 2 + Vi
h
+
K
u − 2 + Ui
h
K
v − Vi
h
+ K
u − 2 + Ui
h
K
v + Vi
h
+
K
u − 2 + Ui
h
K
v − 2 + Vi
h
.
32
33. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
In the case of uniformly continuous copula density c on [0, 1] × [0, 1], if K is a
bounded symmetric kernel that vanishes off [−1, 1], with ωK(ω) → 0 as
ω → ∞, and if nh2
→ ∞ as h → 0 and n → ∞, then f satisfies standard
asymptotic properties, e.g. for every (u, v) ∈ [0, 1] × [0, 1]
E(c(u, v, h)) = c(u, v) + O(h) on the borders,
= c(u, v) + O(h2
) in the interior,
and moreover, if σ2
=
1
−1
K(ω)2
dω
V ar(c(u, v, h)) = 4c(u, v)(nh2
)−1
σ4
+ o((nh2
)−1
) in corner,
= 2c(u, v)(nh2
)−1
σ4
+ o((nh2
)−1
) in the interior of borders,
= c(u, v)(nh2
)−1
σ4
+ o((nh2
)−1
) in the interior.
Furthermore, asymptotic normality can also be obtained,
√
nh2 (c(u, v, h) − c(u, v))
L
→ N 0, κc(u, v) K2
(ω)dω ,
33
34. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
−1.0 −0.5 0.0 0.5 1.0 1.5 2.0
−1.0−0.50.00.51.01.52.0
0.0 0.2 0.4 0.6 0.8 1.0
0.0
0.2
0.4
0.6
0.8
1.0
0.0
0.5
1.0
1.5
2.0
2.5
3.0
Estimation of the copula density
−1.0 −0.5 0.0 0.5 1.0 1.5 2.0
−1.0−0.50.00.51.01.52.0
0.0 0.2 0.4 0.6 0.8 1.0
0.0
0.2
0.4
0.6
0.8
1.0
0.0
0.5
1.0
1.5
2.0
2.5
3.0
Estimation of the copula density
Figure 18: Copula density estimation - mirror reflection (n = 100, 1000).
34
35. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
−1.0 −0.5 0.0 0.5 1.0 1.5 2.0
−1.0−0.50.00.51.01.52.0
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0.0
0.5
1.0
1.5
2.0
2.5
3.0
Estimation of the copula density (mirror reflection)
−1.0 −0.5 0.0 0.5 1.0 1.5 2.0
−1.0−0.50.00.51.01.52.0
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0.0
0.5
1.0
1.5
2.0
2.5
3.0
Estimation of the copula density (mirror reflection)
Figure 19: Copula density estimation - mirror reflection (n = 100, 1000).
35
36. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0.0
0.5
1.0
1.5
2.0
2.5
3.0
Estimation of the copula density (mirror reflection) Estimation of the copula density (mirror reflection)
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.0
Figure 20: Estimated density of Frank copula, mirror reflection principle
36
37. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Bivariate Beta kernels
The Beta-kernel based estimator of the copula density at point (u, v), is
obtained using product beta kernels, which yields
c(u, v) =
1
n
n
i=1
K Xi,
u
b
+ 1,
1 − u
b
+ 1 · K Yi,
v
b
+ 1,
1 − v
b
+ 1 ,
where K(·, α, β) denotes the density of the Beta distribution with parameters
α and β.
37
39. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Assume that the copula density c is twice differentiable on [0, 1] × [0, 1]. Let
(u, v) ∈ [0, 1] × [0, 1]. The bias of c(u, v) is of order b, i.e.
E(c(u, v)) = c(u, v) + Q(u, v) · b + o(b),
where the bias Q(u, v) is
Q(u, v) = (1−2u)c1(u, v)+(1−2v)c2(u, v)+
1
2
[u(1 − u)c1,1(u, v) + v(1 − v)c2,2(u, v)] .
The bias here is O(b) (everywhere) while it is O(h2
) using standard kernels.
Assume that the copula density c is twice differentiable on [0, 1] × [0, 1]. Let
(u, v) ∈ [0, 1] × [0, 1]. The variance of c(u, v) is in corners, e.g. (0, 0),
V ar(c(0, 0)) =
1
nb2
[c(0, 0) + o(n−1
)],
in the interior of borders, e.g. u = 0 and v ∈ (0, 1)
V ar(c(0, v)) =
1
2nb3/2 πv(1 − v)
[c(0, v) + o(n−1
)],
39
40. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
and in the interior,(u, v) ∈ (0, 1) × (0, 1)
V ar(c(u, v)) =
1
4nbπ v(1 − v)u(1 − u)
[c(u, v) + o(n−1
)].
Remark From those properties, an (asymptotically) optimal bandwidth b can
be deduced, maximizing asymptotic mean squared error,
b∗
≡
1
16πnQ(u, v)2
·
1
v(1 − v)u(1 − u)
1/3
.
Note (see Charpentier, Fermanian & Scaillet (2005)) that all those results can
be obtained in dimension d ≥ 2.
Example For n = 100 simulated data, from Frank copula, the optimal
bandwidth is b ∼ 0.05.
40
41. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0.0
0.5
1.0
1.5
2.0
2.5
3.0
Estimation of the copula density (Beta kernel, b=0.1) Estimation of the copula density (Beta kernel, b=0.1)
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.0
Figure 22: Estimated density of Frank copula, Beta kernels, b = 0.1
41
42. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0.0
0.5
1.0
1.5
2.0
2.5
3.0
Estimation of the copula density (Beta kernel, b=0.05) Estimation of the copula density (Beta kernel, b=0.05)
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.0
Figure 23: Estimated density of Frank copula, Beta kernels, b = 0.05
42
43. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.0 0.2 0.4 0.6 0.8 1.0
01234 Standard Gaussian kernel estimator, n=100
Estimation of the density on the diagonal
Densityoftheestimator
0.0 0.2 0.4 0.6 0.8 1.0
01234
Standard Gaussian kernel estimator, n=1000
Estimation of the density on the diagonal
Densityoftheestimator
0.0 0.2 0.4 0.6 0.8 1.0
01234
Standard Gaussian kernel estimator, n=10000
Estimation of the density on the diagonal
Densityoftheestimator
Figure 24: Density estimation on the diagonal, standard kernel.
43
44. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.0 0.2 0.4 0.6 0.8 1.0
01234 Transformed kernel estimator (Gaussian), n=100
Estimation of the density on the diagonal
Densityoftheestimator
0.0 0.2 0.4 0.6 0.8 1.0
01234
Transformed kernel estimator (Gaussian), n=1000
Estimation of the density on the diagonal
Densityoftheestimator
0.0 0.2 0.4 0.6 0.8 1.0
01234
Transformed kernel estimator (Gaussian), n=10000
Estimation of the density on the diagonal
Densityoftheestimator
Figure 25: Density estimation on the diagonal, transformed kernel.
44
45. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.0 0.2 0.4 0.6 0.8 1.0
01234 Beta kernel estimator, b=0.05, n=100
Estimation of the density on the diagonal
Densityoftheestimator
0.0 0.2 0.4 0.6 0.8 1.0
01234
Beta kernel estimator, b=0.02, n=1000
Estimation of the density on the diagonal
Densityoftheestimator
0.0 0.2 0.4 0.6 0.8 1.0
01234
Beta kernel estimator, b=0.005, n=10000
Estimation of the density on the diagonal
Densityoftheestimator
Figure 26: Density estimation on the diagonal, Beta kernel.
45
46. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Average of histograms and copulas
A natural idea would be to extend the notion of average of histograms in
higher dimension. But note that the notion of partition can be more
complicated.
Recall that C is a copula if for any u1 ≤ u2 and v1 ≤ v2,
C(u2, v2) − C(u1, v2) − C(u2, v1) + C(u1, v1) ≥ 0,
and C is a semicopula (Durante & Sempi (2004)) if for any u1 ≤ u2 and
v1 ≤ v2, C(u2, v2) − C(u1, v2) ≥ 0 and C(u2, v2) − C(u2, v1) ≥ 0.
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.0
Copula, positive area
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.0
Semicopula, positive area
46
47. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.0
Histogram in dimension 2
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.0
Histogram in dimension 2
Figure 27: Partitioning the unit square.
47
48. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0.0
0.5
1.0
1.5
2.0
2.5
3.0
Copula density as average of randomized histograms, m=2 Copula density as average of randomized histograms, m=2
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.0
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0.0
0.5
1.0
1.5
2.0
2.5
3.0
Copula density as average of randomized histograms, m=5 Copula density as average of randomized histograms, m=5
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.0
Figure 28: Copula density using average of histograms.
48
49. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0.0
0.5
1.0
1.5
2.0
2.5
3.0
Copula density as average of randomized histograms, m=10 Copula density as average of randomized histograms, m=10
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.0
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0
1
2
3
4
5
Copula density as average of randomized histograms, m=15 Copula density as average of randomized histograms, m=15
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.0
Figure 29: Copula density using average of histograms.
49
50. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.0 0.2 0.4 0.6 0.8 1.0
01234 Average of histograms, n=1000, m=5
Estimation of the density on the diagonal
Estimator
0.0 0.2 0.4 0.6 0.8 1.0
01234
Average of histograms, n=1000, m=10
Estimation of the density on the diagonal
Estimator
0.0 0.2 0.4 0.6 0.8 1.0
01234
Average of histograms, n=1000, m=15
Estimation of the density on the diagonal
Estimator
Figure 30: Density estimation on the diagonal, average of histograms.
50
51. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Copula density estimation
Gijbels & Mielniczuk (1990): given an i.i.d. sample, a natural estimate for
the normed density is obtained using the transformed sample
(FX(X1), FY (Y1)), ..., (FX(Xn), FY (Yn)), where FX and FY are the empirical
distribution function of the marginal distribution. The copula density can be
constructed as some density estimate based on this sample (Behnen,
Husková & Neuhaus (1985) investigated the kernel method).
The natural kernel type estimator c of c is
c(u, v) =
1
nh2
n
i=1
K
u − FX(Xi)
h
,
v − FY (Yi)
h
, (u, v) ∈ [0, 1].
“this estimator is not consistent in the points on the boundary of the unit
square.”
51
52. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Copula density estimation and pseudo-observations
Figure 31 shows scatterplots when margins are known (i.e.
(FX(Xi), FY (Yi))’s), and when margins are estimated (i.e.
( ˆFX(Xi), ˆFY (Yi)’s). Note that the pseudo sample is more “uniform”, in the
sense of a lower discrepancy (as in Quasi Monte Carlo techniques, see e.g.
Niederreiter, H. (1992)).
52
53. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.0
Scatterplot of observations (Xi,Yi)
Value of the Xis
ValueoftheYis
0.0 0.2 0.4 0.6 0.8 1.0
0.00.20.40.60.81.0
Scatterplot of pseudo−observations (Ui,Vi)
Value of the Uis (ranks)ValueoftheVis(ranks)
Figure 31: Observations and pseudo-observation, 500 simulated observations
from Frank copula (Xi, Yi) and the associate pseudo-sample ( ˆFX(Xi), ˆFY (Yi)).
53
54. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Because samples are more “uniform” using ranks and pseudo-observations, the
variance of the estimator of the density, at some given point
(u, v) ∈ (0, 1) × (0, 1) is usually smaller. For instance, Figure 32 shows the
impact of considering pseudo observations, i.e. substituting ˆFX and ˆFY to
unknown marginal distributions FX and FY . The dotted line shows the
density of ˆc(u, v) from a n = 100 sample (Ui, Vi) (from Frank copula), and the
straight line shows the density of ˆc(u, v) from the sample ( ˆFU (Ui), ˆFV (Vi))
(i.e. ranks of observations).
54
55. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0 1 2 3 4
0.00.51.01.52.0
Impact of pseudo−observations (n=100)
Distribution of the estimation of the density c(u,v)
Densityoftheestimator
Figure 32: The impact of estimating from pseudo-observations.
55
56. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
The problem of censored data
In the case of censored data, consider sample of ((Xi, δX
i ), (Yi, δY
i ))’s, where
δX
i = 0 when Xi is censored. Xi = min{X0
i , CX
i } and Yi = min{X0
i , CY
i }
where the Ci’s are censoring variates. The (Xi, Yi) are observed data, the
(X0
i , Y 0
i )’s are the variables of interest, that might be unobservable.
Kaplan-Meier estimator can be considered, based on the transformed sample
made of the non-zero elements.
The transformed sample is denoted by (Xi, Yi ), i = 1, ..., n , and its size is
n =
n
i=1 δX
i · δY
i of fully uncensored data.
The marginal Kaplan-Meier of the distribution function is
ˆFKM
X (x) = 1 −
i:Xi≤x
n − i
n − i + 1
δX
i
.
The nonparametric estimator of the copula density at point (u, v) can be
obtained using product beta kernels, on
56
57. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
( ˆUKM
i , V KM
i ) = (FKM
X (Xi), FKM
Y (Yi )), i = 1, ..., n .
Remark In the LOSS-ALAE dataset, the loss amounts Xi’s are censored,
because of a policy limit. Hence, Xi = min{loss, limit}.
57
58. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
2 4 6 8 10 12 14
4681012
Log(LOSS)
Log(ALAE)
Figure 33: The LOSS-ALAE dataset and censoring.
58
59. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Unfortunately, such a procedure suffers from the so-called stock sampling (or
selection bias) issue. Actually, the subsample used is far from being an i.i.d.
sample drawn from the law of (X, Y ).
The observations in hand are chosen as fully uncensored. Thus, small
observed (Xi, Yi) are more frequent in the subsample than they should be in a
usual i.i.d. sample. Therefore, the previous estimator can be advised only
when the proportion of censoring is small. Otherwise the bias induced by
stock sampling can become large.
59
60. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0
1
2
3
4
5
Estimation of Frank copula
0.2 0.4 0.6 0.8
0.20.40.60.8
Figure 34: Estimated density of Frank copula, using Beta kernels, n = 1000,
b = 0.050 and no-censoring.
60
61. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0
1
2
3
4
5
Estimation of Frank copula
0.2 0.4 0.6 0.8
0.20.40.60.8
Figure 35: Estimated density of Frank copula, using Beta kernels, n = 1000,
b = 0.050 and 1.7% censored data.
61
62. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0
1
2
3
4
5
Estimation of Frank copula
0.2 0.4 0.6 0.8
0.20.40.60.8
Figure 36: Estimated density of Frank copula, using Beta kernels, n = 1000,
b = 0.050 and 7.8% censored data.
62
63. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
0
1
2
3
4
5
Estimation of Frank copula
0.2 0.4 0.6 0.8
0.20.40.60.8
Figure 37: Estimated density of Frank copula, using Beta kernels, n = 1000,
b = 0.050 and 24% censored data.
63
64. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.0 0.2 0.4 0.6 0.8 1.0
01234
Beta kernel estimator, b=0.01, n=1000, no censoring
Estimation of the density on the diagonal
Densityoftheestimator
0.0 0.2 0.4 0.6 0.8 1.0
01234
Beta kernel estimator, b=0.01, n=1000, 5% censoring
Estimation of the density on the diagonal
Densityoftheestimator
0.0 0.2 0.4 0.6 0.8 1.0
01234
Beta kernel estimator, b=0.01, n=1000, 25% censoring
Estimation of the density on the diagonal
Densityoftheestimator
Figure 38: Estimation of the density on the diagonal, with censored data .
64
65. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Stock sampling can be observe as the bias increases as u goes to 1, and as the
proportion of censored data increases.
Figure 39 shows the estimated density c(12/13, 12/13) with no censoring, and
25% censored observations.
Following the idea proposed in Efron and Tibshirani (1993), bootstrap
techniques can be used to estimate the bias. Consider B bootstrap samples
drawn independently from the original censored data, with replacement,
X∗
i,b, Y ∗
i,b, δ∗
i,b , i = 1, ..., n and b = 1, ..., B. The bias of the density
estimator at point (u, v) can be estimated from
bias (u, v) =
1
B
B
i=1
c (u, v)
∗,b
− c (u, v)
where c (u)
∗,b
is the density obtained from the bth bootstrap sample.
65
66. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0 1 2 3 4 5 6
0.00.20.40.60.8
Standard Beta kernel estimator
Estimation of the density near the lower corner
Densityoftheestimator
Figure 39: c(12/13, 12/13) using Beta kernels, with censored data (dotted line).
66
67. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.0 0.2 0.4 0.6 0.8 1.0
01234
Transformed kernel estimator (Gaussian), n=1000
Estimation of the density on the diagonal, 25% censoring
Densityoftheestimator,bootstrapbiascorrection
0.0 0.2 0.4 0.6 0.8 1.0
01234
Beta kernel estimator, b=0.01, n=1000
Estimation of the density on the diagonal, 25% censoringDensityoftheestimator,bootstrapbiascorrection
Figure 40: Censoring bias correction using bootstrap techniques.
67
68. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
Figure 40 shows the the evolution of
u →
1
B
B
i=1
c (u, u)
∗,b
,
on the diagonal using bootstrap techniques (as in Efron (1981)).
For each bootstrap sample, unobservable value Y 0
i,b and censoring value Ci,b
are simulated using Kaplan-Meier estimate of the density, and then a sample
(Xi,b, Y i, b, δi, b), i = 1, ..., n is obtained, and a new Kaplan-Meier estimation
is obtained, F0
b , and is used to obtain the estimation of the copula density for
this bootstrap sample.
The application to the Loss-ALAE dataset confirms Gumbel model.
68
69. Arthur CHARPENTIER - Estimation non-paramétrique des densités de copules
0.0 0.2 0.4 0.6 0.8 1.0
01234567
Beta kernel estimator, b=0.01, n=1000
Estimation of the density on the diagonal, LOSS−ALAE
Densityoftheestimator,bootstrapbiascorrection
0.75 0.80 0.85 0.90 0.95 1.00
01234567
Beta kernel estimator, b=0.005, n=1000
Estimation of the density on the diagonal, LOSS−ALAEDensityoftheestimator,bootstrapbiascorrection
Figure 41: Beta kernel estimator for Loss-ALAE, compare with Gumbel copula.
69