bwd2asR0: bwd2asR0

View source: R/bwd2asR0.R

bwd2asR0R Documentation

bwd2asR0

Description

Given a q-dimensional random vector \mathbf{X} = (\mathbf{X}_{1},...,\mathbf{X}_{k}) with \mathbf{X}_{i} a d_{i}-dimensional random vector, i.e., q = d_{1} + ... + d_{k}, this function simulates a sample from the asymptotic distribution of the plug-in estimator for the correlation-based Bures-Wasserstein coefficient \mathcal{D}_{2} between \mathbf{X}_{1},...,\mathbf{X}_{k} given that the entire correlation matrix \mathbf{R} is equal to \mathbf{R}_{0} (correlation matrix under independence of \mathbf{X}_{1},...,\mathbf{X}_{k}). The argument dim should be in ascending order. This function requires importation of the python modules "numpy" and "scipy".

Usage

bwd2asR0(R, dim, M)

Arguments

R

The correlation matrix of \mathbf{X}.

dim

The vector of dimensions (d_{1},...,d_{k}), in ascending order.

M

The sample size.

Details

A sample of size M is drawn from the asymptotic distribution of the plug-in estimator \mathcal{D}_{2}(\widehat{\mathbf{R}}_{n}) at \mathbf{R}_{0} = \text{diag}(\mathbf{R}_{11}, \dots, \mathbf{R}_{kk}), where \widehat{\mathbf{R}}_{n} is the sample matrix of normal scores rank correlations. The underlying assumption is that the copula of \mathbf{X} is Gaussian.

To create a Python virtual environment with "numpy" and "scipy", run:

install_tensorflow()

reticulate::use_virtualenv("r-tensorflow", required = FALSE)

reticulate::py_install("numpy")

reticulate::py_install("scipy")

Value

A sample of size M from the asymptotic distribution of the plug-in estimator for the second Bures-Wasserstein dependence coefficient \mathcal{D}_{2} under independence of \mathbf{X}_{1},...,\mathbf{X}_{k}.

References

De Keyser, S. & Gijbels, I. (2024). High-dimensional copula-based Wasserstein dependence. doi: https://doi.org/10.48550/arXiv.2404.07141.

See Also

bwd1 for the computation of the first Bures-Wasserstein dependence coefficient \mathcal{D}_{1}, bwd2 for the computation of the second Bures-Wasserstein dependence coefficient \mathcal{D}_{2}, bwd1avar for the computation of the asymptotic variance of the plug-in estimator for \mathcal{D}_{1}, bwd2avar for the computation of the asymptotic variance of the plug-in estimator for \mathcal{D}_{2}, bwd1asR0 for sampling from the asymptotic distribution of the plug-in estimator for \mathcal{D}_{1} under the hypothesis of independence between \mathbf{X}_{1},\dots,\mathbf{X}_{k}, estR for the computation of the sample matrix of normal scores rank correlations, otsort for rearranging the columns of sample such that dim is in ascending order.

Examples


q = 5
dim = c(2,3)

# AR(1) correlation matrix with correlation 0.5
R = 0.5^(abs(matrix(1:q-1,nrow = q, ncol = q, byrow = TRUE) - (1:q-1)))

R0 = createR0(R,dim)

# Check whether scipy module is available (see details)
have_scipy = reticulate::py_module_available("scipy")

if(have_scipy){

sample = bwd2asR0(R0,dim,1000)

}


VecDep documentation built on April 4, 2025, 5:14 a.m.