Plot Optimal Transport based sensitivity indices using ggplot2
package.
Usage
# S3 method for class 'gsaot_indices'
plot(x, ranking = NULL, wb_all = FALSE, dummy = NULL, ...)
Arguments
- x
An object generated by
ot_indices
,ot_indices_1d
, orot_indices_wb
.- ranking
An integer with absolute value less or equal than the number of inputs. If positive, select the first
ranking
inputs per importance. If negative, select the lastranking
inputs per importance.- wb_all
(default
FALSE
) Logical that defines whether or not to plot the Advective and Diffusive components of the Wasserstein-Bures indices- dummy
(default
NULL
) A double or and object of classgsaot_indices
that represents a lower bound.- ...
Further arguments passed to or from other methods.
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)
M <- 25
# Calculate sensitivity indices
sensitivity_indices <- ot_indices_wb(x, y, M)
sensitivity_indices
#> Method: wasserstein-bures
#>
#> Indices:
#> X1 X2 X3
#> 0.4884653 0.4921685 0.1319275
#>
#> Advective component:
#> X1 X2 X3
#> 0.2959886 0.3113776 0.1149829
#>
#> Diffusive component:
#> X1 X2 X3
#> 0.19247673 0.18079086 0.01694463
#>
#> Upper bound: 96.6074
plot(sensitivity_indices)