Bcopula {subcopem2D}R Documentation

Bernstein Copula Approximation

Description

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

Usage

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 \sqrt{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

## (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)

[Package subcopem2D version 1.3 Index]