Bcopula: Bernstein Copula Approximation

Description Usage Arguments Details Value Acknowledgement Note Author(s) References See Also Examples

Description

Bernstein copula approximation from the empirical subcopula of given bivariate data.

Usage

1
Bcopula(mat.xy, m, both.cont = FALSE, tolimit = 1e-05)

Arguments

mat.xy

2-column matrix with bivariate observations of a random vector (X,Y).

m

integer value of approximation order, where m = 2,...,n with n equal to sample size. A recommended value for m would be the minimum between √{n} and 50.

both.cont

logical value, if TRUE then (X,Y) are considered (both) as continuos random variables, and jittering will be applied to repeated values (if any).

tolimit

tolerance limit in numerical approximation of the inverse of the first partial derivatives of the estimated Bernstein copula.

Details

Each of the random variables X and Y may be of any kind (discrete, continuous, or mixed). NA values are not allowed.

Value

A list containing the following components:

copula

bivariate Bernstein Copula function (BC) of order m

du

bivariate function \partial BC(u,v)/\partial u

dv

bivariate function \partial BC(u,v)/\partial v

du.inv

inverse of du with respect to v, given u and alpha (numerical approx)

dv.inv

inverse of dv with respect to u, given v and alpha (numerical approx)

density

bivariate Bernstein copula density function of order m

bilinearCopula

bivariate function of bilinear approximation of copula

bilinearSubcopula

(m+1)\times (m+1) matrix with empirical subcopula values

sample.size

sample size of bivariate observations

order

approximation order m used

both.cont

logical value, TRUE if both variables considered as continuous

tolimit

tolerance limit in numerical approximation of du.inv and dv.inv

subcopemObject

list object with the output from subcopem if both.cont = FALSE or from subcopemc if both.cont = TRUE

Acknowledgement

Development of this code was partially supported by Programa UNAM DGAPA PAPIIT through project IN115817.

Note

If both X and Y are continuous random variables it is faster and better to set both.cont = TRUE.

Author(s)

Arturo Erdely https://sites.google.com/site/arturoerdely

References

Erdely, A. (2017) A subcopula based dependence measure. Kybernetika 53(2), 231-243. DOI: 10.14736/kyb-2017-2-0231

Nelsen, R.B. (2006) An Introduction to Copulas. Springer, New York.

Sancetta, A., Satchell, S. (2004) The Bernstein copula and its applications to modeling and approximations of multivariate distributions. Econometric Theory 20, 535-562. DOI: 10.1017/S026646660420305X

See Also

subcopem, subcopemc

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## (X,Y) continuous random variables with copula FGM(param = 1)

# Theoretical formulas
FGMcopula <- function(u, v) u*v*(1 + (1 - u)*(1 - v))
dFGM.du <- function(u, v) (2*u - 1)*(v^2) + 2*v*(1 - u)
dFGM.dv <- function(u, v) (2*v - 1)*(u^2) + 2*u*(1 - v)
A1 <- function(u) 2*(1 - u)
A2 <- function(u, z) sqrt(A1(u)^2 - 4*(A1(u) - 1)*z)
dFGM.du.inv <- function(u, z) 2*z/(A1(u) + A2(u, z))
FGMdensity <- function(u, v) 2*(1 - u - v + 2*u*v)

# Simulating FGM observations
n <- 3000
U <- runif(n)
Z <- runif(n)
V <- mapply(dFGM.du.inv, U, Z)

# Applying Bcopula to FGM simulated values
B <- Bcopula(cbind(U, V), 50, TRUE)
str(B)

# Comparing theoretical values versus Bernstein and Bilinear approximations
u <- 0.70; v <- 0.55
FGMcopula(u, v); B[["copula"]](u, v); B[["bilinearCopula"]](u, v)
dFGM.du(u, v); B[["du"]](u, v)
dFGM.dv(u, v); B[["dv"]](u, v)
dFGM.du.inv(u, 0.8); B[["du.inv"]](u, 0.8)
FGMdensity(u, v); B[["density"]](u, v)

Example output

List of 13
 $ copula           :function (u, v)  
 $ du               :function (u, v)  
 $ du.inv           :function (u, a)  
 $ dv               :function (u, v)  
 $ dv.inv           :function (v, a)  
 $ density          :function (u, v)  
 $ bilinearCopula   :function (u, v)  
 $ bilinearSubcopula: num [1:51, 1:51] 0 0 0 0 0 0 0 0 0 0 ...
 $ sample.size      : int 3000
 $ order            : num 50
 $ both.cont        : logi TRUE
 $ tolerance        : num 1e-05
 $ subcopemObject   :List of 11
  ..$ depMon      : num 0.236
  ..$ depMonNonSTD: Named num [1:3] -1 0.236 1
  .. ..- attr(*, "names")= chr [1:3] "min" "value" "max"
  ..$ depSup      : num 0.236
  ..$ depSupNonSTD: Named num [1:3] 0 0.236 1
  .. ..- attr(*, "names")= chr [1:3] "min" "value" "max"
  ..$ matrix      : num [1:51, 1:51] 0 0 0 0 0 0 0 0 0 0 ...
  ..$ part1       : num [1:51] 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 ...
  ..$ part2       : num [1:51] 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 ...
  ..$ sample.size : int 3000
  ..$ order       : num 50
  ..$ std.sample  : num [1:3000, 1:2] 0.894 0.835 0.071 0.288 0.287 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:2] "U" "V"
  ..$ sample      : num [1:3000, 1:2] 0.9045 0.8434 0.0683 0.2969 0.2964 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:2] "U" "V"
[1] 0.436975
[1] 0.4294967
[1] 0.4318333
[1] 0.451
[1] 0.4790032
[1] 0.679
[1] 0.6893572
[1] 0.8507811
[1] 0.8349687
[1] 1.04
[1] 1.097897

subcopem2D documentation built on May 2, 2019, 2:46 p.m.