Test case: the non monotonic Sobol g function.
The method of Sobol requires two samples. In the reference case there are eight variables, all following the uniform distribution on [0,1].
n <- 50000
p <- 8
X1_1 <- data.frame(matrix(runif(p * n), nrow = n))
X2_1 <- data.frame(matrix(runif(p * n), nrow = n))The deterministic model is sobol4r_g2. The noisy version
with Gaussian noise N(0,1) is sobol4r_g2_noise_const. The
quantity of interest based on the mean over replications is
sobol4r_g2_noise_const_qoi_mean.
Y2 <- sobol_g2_function(gensol2$X)
Y3 <- sobol_g2_additive_noise(gensol2$X)
Y4 <- sobol_g2_qoi_mean(gensol2$X, nrep = 1000)x2 <- sensitivity::tell(gensol2, Y2)
x3 <- sensitivity::tell(gensol2, Y3)
x4 <- sensitivity::tell(gensol2, Y4)We keep the previously generated values for C1 and C2 and add a third
variable C3 distributed as runif(n, min = 1, max = 100).
The third variable controls the mean of the Gaussian noise.
n <- 50000
X1_r2 <- data.frame(
C1 = X1_r1$C1,
C2 = X1_r1$C2,
C3 = runif(n, min = 1, max = 100)
)
X2_r2 <- data.frame(
C1 = X2_r1$C1,
C2 = X2_r1$C2,
C3 = runif(n, min = 1, max = 100)
)We now take a third input C3 distributed as
runif(n, min = 1, max = 1.5), which induces a much smaller
range for the mean of the noise.
n <- 50000
X1_r3 <- data.frame(
C1 = X1_r1$C1,
C2 = X1_r1$C2,
C3 = runif(n, min = 1, max = 1.5)
)
X2_r3 <- data.frame(
C1 = X2_r1$C1,
C2 = X2_r1$C2,
C3 = runif(n, min = 1, max = 1.5)
)We now turn to the process model. The uncertain inputs are the distributional parameters of the individual unit model. The quantity of interest is the time needed to reach a given number of successes.
n <- 100
draw_params <- function(n) {
data.frame(t(replicate(
n,
c(
1 / runif(1, min = 20, max = 100),
1 / runif(1, min = 24, max = 2000),
1 / runif(1, min = 24, max = 120),
runif(1, min = 0.05, max = 0.3),
runif(1, min = 0.3, max = 0.7)
)
)))
}
X1_process <- draw_params(n)
X2_process <- draw_params(n)set.seed(4669)
gensolp1 <- sobol4r_design(
X1 = X1_process,
X2 = X2_process,
order = 2,
nboot = 10
)