Evaluate Wasserstein-Bures approximation of the Optimal Transport solution
Source:R/ot_indices_bw.R
ot_indices_wb.Rd
Evaluate Wasserstein-Bures approximation of the Optimal Transport solution
Usage
ot_indices_wb(
x,
y,
M,
boot = FALSE,
R = NULL,
parallel = "no",
ncpus = 1,
conf = 0.95,
type = "norm"
)
Arguments
- x
A matrix or data.frame containing the input(s) values. The values can be numeric, factors, or strings. The type of data changes the partitioning. If the values are continuous (double), the function partitions the data into
M
sets. If the values are discrete (integers, strings, factors), the number of partitioning sets is data-driven.- y
A matrix containing the output values. Each column represents a different output variable, and each row represents a different observation. Only numeric values are allowed.
- M
A scalar representing the number of partitions for continuous inputs.
- boot
(default
FALSE
) Logical that sets whether or not to perform bootstrapping of the OT indices.- R
(default
NULL
) Positive integer, number of bootstrap replicas.- parallel
(default
"no"
) The type of parallel operation to be used (if any). If missing, the default is taken from the optionboot.parallel
(and if that is not set,"no"
). Only considered ifboot = TRUE
. For more information, check theboot::boot()
function.- ncpus
(default
1
) Positive integer: number of processes to be used in parallel operation: typically one would chose this to the number of available CPUs. Check thencpus
option in theboot::boot()
function of the boot package.- conf
(default
0.95
) Number between0
and1
representing the confidence level. Only considered ifboot = TRUE
.- type
(default
"norm"
) Method to compute the confidence interval. Only considered ifboot = TRUE
. For more information, check thetype
option ofboot::boot.ci()
.
Value
A gsaot_indices
object containing:
method
: a string that identifies the type of indices computed.indices
: a names array containing the sensitivity indices between 0 and 1 for each column in x, indicating the influence of each input variable on the output variables.bound
: a double representing the upper bound of the separation measure or an array representing the mean of the separation for each input according to the bootstrap replicas.x
,y
: input and output data provided as arguments of the function.inner_statistic
: a list of matrices containing the values of the inner statistics for the partitions defined bypartitions
. Ifmethod = wasserstein-bures
, each matrix has three rows containing the Wasserstein-Bures indices, the Advective, and the Diffusive components.partitions
: a matrix containing the partitions built to calculate the sensitivity indices. Each column contains the partition associated to the same column inx
. Ifboot = TRUE
, the object contains also:indices_ci
: adata.frame
with first column the input, second and third columns the lower and upper bound of the confidence interval.inner_statistic_ci
: a list of matrices. Each element of the list contains the lower and upper confidence bounds for the partition defined by the row.bound_ci
: a list containing the lower and upper bounds of the confidence intervals of the separation measure bound.type
,conf
: type of confidence interval and confidence level, provided as arguments.
Examples
N <- 1000
mx <- c(1, 1, 1)
Sigmax <- matrix(data = c(1, 0.5, 0.5, 0.5, 1, 0.5, 0.5, 0.5, 1), nrow = 3)
x1 <- rnorm(N)
x2 <- rnorm(N)
x3 <- rnorm(N)
x <- cbind(x1, x2, x3)
x <- mx + x %*% chol(Sigmax)
A <- matrix(data = c(4, -2, 1, 2, 5, -1), nrow = 2, byrow = TRUE)
y <- t(A %*% t(x))
x <- data.frame(x)
y <- y
ot_indices_wb(x, y, 100)
#> Method: wasserstein-bures
#>
#> Indices:
#> X1 X2 X3
#> 0.5270767 0.5380900 0.1831289
#>
#> Advective component:
#> X1 X2 X3
#> 0.3143543 0.3362151 0.1423724
#>
#> Diffusive component:
#> X1 X2 X3
#> 0.21272243 0.20187498 0.04075641
#>
#> Upper bound: 92.57906