Description Usage Arguments Details Value Acknowledgement Note Author(s) References See Also Examples
Bernstein copula approximation from the empirical subcopula of given bivariate data.
1 |
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. |
Each of the random variables X and Y may be of any kind (discrete, continuous, or mixed). NA values are not allowed.
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 |
dv.inv |
inverse of |
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 |
subcopemObject |
list object with the output from |
Development of this code was partially supported by Programa UNAM DGAPA PAPIIT through project IN115817.
If both X and Y are continuous random variables it is faster and better to set both.cont = TRUE
.
Arturo Erdely https://sites.google.com/site/arturoerdely
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
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)
|
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.