Learn R Programming

sensitivity (version 1.2)

sobol.sal02: Sobol Non-linear Sensitivity Analysis

Description

sobol.sal02 is the implementation of the Sobol indices estimation method proposed by Saltelli. The particularity of this method is to estimate both first order and total order indices with the same sampling scheme. This function generates the design of experiments based on two independent samples and computes the requested indices.

Usage

sobol.sal02(model = NULL, x1, x2,
            nboot = 0, conf = 0.95, ...)
## S3 method for class 'sobol.sal02':
compute(sa, y = NULL)

Arguments

model
the model.
x1
the first random sample for factors.
x2
the second random sample for factors.
nboot
the number of bootstrap replicates.
conf
the confidence level for bootstrap confidence intervals.
sa
the sensitivity analysis object.
y
the response.
...
any other arguments for model which are passed unchanged each time it is called.

Value

  • sobol.sal02 returns an object of class "sobol.sal02". An object of class "sobol.sal02" is a list containing the following components:
  • modelthe model.
  • x1the first random sample for factors.
  • x2the second random sample for factors.
  • nbootthe number of bootstrap replicates.
  • confthe confidence level for bootstrap confidence intervals.
  • xthe factor sample.
  • ythe response used.
  • S1the estimations of the first order indices.
  • Stthe estimations of the total sensitivity indices.
  • callthe matched call.

Details

model is a function or a predictor (a class with a predict method) computing the response y based on the sample given by x. If no model is specified, the indices will be computed when one gives the response.

The Monte Carlo estimation requires two independent random samples x1 and x2. They must have the same dimensions.

The computing scheme is based on replacement of a column of a sample by the corresponding one of the other sample. We note ${x1,i,x2}$ the sample where all the columns are taken from x1, except the i-th one that is taken from x2.

Then, the first order index corresponding to the i-th factor is given by: $$S_i=\frac{D_i}{\mathrm{Var}(Y)}$$ where $$D_i = \frac{1}{n-1} \sum_{j=1}^n f(x2_j) f({x1,i,x2}_j) - \frac{1}{n} \sum_{j=1}^n f(x1_j) f(x2_j)$$

and the total order index is given by: $$St_i=1 - \frac{Dt_i}{\mathrm{Var}(Y)}$$ where $$Dt_i = \frac{1}{n-1} \sum_{j=1}^n f(x1_j) f({x1,i,x2}_j) - \left[ \frac{1}{n} \sum_{j=1}^n f(x1_j) \right]^2$$

With this method, the estimation of all the first order indices and total indices require $n(p+2)$ calls to the model, with $n$ the length of the samples x1 and x2, and $p$ the number of factors.

References

Saltelli, A., 2002, Making best use of model evaluations to compute sensitivity indices. Computer Physics Communication, 145, 580--297.

See Also

sensitivity compute

Examples

Run this code
# Test case : the non-monotonic Sobol g-function

# The method of sobol requires 2 samples
# There are 8 factors, all following the uniform distribution
# on [0,1]

n <- 3000
x1 <- data.frame(matrix(nr = n, nc = 8))
x2 <- data.frame(matrix(nr = n, nc = 8))
for (i in 1:8){
  x1[, i] <- runif(n)
  x2[, i] <- runif(n)
}

# sensitivity analysis

sa <- sobol.sal02(model = sobol.fun, x1 = x1, x2 = x2, nboot = 100)
print(sa)
plot(sa)

Run the code above in your browser using DataLab