Description Usage Arguments Details Value Note Author(s) References See Also Examples
Calculation of bivariate empirical subcopula matrix, induced partitions, standardized bivariate sample, and dependence measures for a given bivariate sample.
1 |
mat.xy |
2-column matrix with bivariate observations of a random vector (X,Y). |
display |
logical value indicating if graphs and dependence measures should be displayed. |
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:
depMon |
monotone standardized supremum distance in [-1,1]. |
depMonNonSTD |
monotone non-standardized supremum distance [min,value,max]. |
depSup |
standardized supremum distance in [0,1]. |
depSupNonSTD |
non-standardized supremum distance [min,value,max]. |
matrix |
matrix with empirical subcopula values. |
part1 |
vector with partition induced by first variable X. |
part2 |
vector with partition induced by second variable Y. |
sample.size |
numeric value of sample size. |
std.sample |
2-column matrix with the standardized bivariate sample. |
sample |
2-column matrix with the original bivariate sample of (X,Y). |
If display = TRUE
then the values of depMon
, depMonNonSTD
, depSup
, and depSupNonSTD
will be displayed, and the following graphs will be generated: marginal histograms of X and Y, scatterplots of the original and the standardized bivariate sample, contour and image bivariate graphs of the empirical subcopula.
If both X and Y are continuous random variables it is faster and better to use subcopemc
.
Arturo Erdely https://sites.google.com/site/arturoerdely
Durante, F. and Sempi, C. (2016) Principles of Copula Theory. Taylor and Francis Group, Boca Raton.
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Example 1: Discrete-discrete Poisson positive dependence
n <- 1000 # sample size
X <- rpois(n, 5) # Poisson(parameter = 5)
p <- 2 # another parameter
Y <- mapply(rpois, rep(1, n), 1 + p*X) # creating dependence
XY <- cbind(X, Y) # 2-column matrix with bivariate sample
cor(XY, method = "pearson")[1, 2] # Pearson's correlation
cor(XY, method = "spearman")[1, 2] # Spearman's correlation
cor(XY, method = "kendall")[1, 2] # Kendall's correlation
SC <- subcopem(XY, display = TRUE)
str(SC)
## Example 2: Continuous-discrete non-monotone dependence
n <- 1000 # sample size
X <- rnorm(n) # Normal(0,1)
Y <- 2*(X > 1) - 1*(X > -1) # Discrete({-1, 0, 1})
XY <- cbind(X, Y) # 2-column matrix with bivariate sample
cor(XY, method = "pearson")[1, 2] # Pearson's correlation
cor(XY, method = "spearman")[1, 2] # Spearman's correlation
cor(XY, method = "kendall")[1, 2] # Kendall's correlation
SC <- subcopem(XY, display = TRUE)
str(SC)
|
[1] 0.8099064
[1] 0.7924834
[1] 0.6495426
monotone dependence = [ -1 , 0.61634802 , 1 ]
non-std interval = [ -0.927072 , 0.600392 , 0.974112 ]
supremum dependence = [ 0 , 0.61634802 , 1 ]
non-std interval = [ 0 , 0.600392 , 0.974112 ]
List of 10
$ depMon : num 0.616
$ depMonNonSTD: Named num [1:3] -0.927 0.6 0.974
..- attr(*, "names")= chr [1:3] "min" "value" "max"
$ depSup : num 0.616
$ depSupNonSTD: Named num [1:3] 0 0.6 0.974
..- attr(*, "names")= chr [1:3] "min" "value" "max"
$ matrix : num [1:15, 1:32] 0 0 0 0 0 0 0 0 0 0 ...
$ part1 : num [1:15] 0 0.005 0.04 0.141 0.284 0.444 0.617 0.771 0.867 0.936 ...
$ part2 : num [1:32] 0 0.004 0.019 0.031 0.059 0.1 0.159 0.224 0.281 0.374 ...
$ sample.size : int 1000
$ std.sample : num [1:1000, 1:2] 0.771 0.771 0.771 0.867 0.968 0.444 0.867 0.936 0.284 0.968 ...
$ sample : int [1:1000, 1:2] 6 6 6 7 9 4 7 8 3 9 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:2] "X" "Y"
[1] 0.2972084
[1] 0.1150596
[1] 0.04113666
monotone dependence = [ -1 , 0.06595935 , 1 ]
non-std interval = [ -0.867504 , 0.05722 , 0.867504 ]
supremum dependence = [ 0 , 0.59111658 , 1 ]
non-std interval = [ 0 , 0.512796 , 0.867504 ]
dev.new(): using pdf(file="Rplots1.pdf")
List of 10
$ depMon : num 0.066
$ depMonNonSTD: Named num [1:3] -0.8675 0.0572 0.8675
..- attr(*, "names")= chr [1:3] "min" "value" "max"
$ depSup : num 0.591
$ depSupNonSTD: Named num [1:3] 0 0.513 0.868
..- attr(*, "names")= chr [1:3] "min" "value" "max"
$ matrix : num [1:1001, 1:4] 0 0 0 0 0 0 0 0 0 0 ...
$ part1 : num [1:1001] 0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 ...
$ part2 : num [1:4] 0 0.682 0.849 1
$ sample.size : int 1000
$ std.sample : num [1:1000, 1:2] 0.558 0.726 0.228 0.95 0.564 0.855 0.356 0.397 0.305 0.486 ...
$ sample : num [1:1000, 1:2] 0.12 0.566 -0.739 1.655 0.126 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:2] "X" "Y"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.