| sobol {sensitivity} | R Documentation |
sobol is the implementation of the standard Monte Carlo
estimation of the Sobol indices. This function generates the design of
experiments based on two independent samples and computes the
requested indices. These indices are ALL the Sobol anova-like
decomposition indices, from the first order to the order given by the
user.
sobol(model = NULL, x1, x2, order = 1,
nboot = 0, conf = 0.95, ...)
## S3 method for class 'sobol':
compute(sa, y = NULL)
model |
the model. |
x1 |
the first random sample for factors. |
x2 |
the second random sample for factors. |
order |
the maximum order of indices to compute. |
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. |
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.
With this method, the estimation of the all the indices from the order 1 to
the order k (given by the order paremeter) require
n * sum_{from j = 0 to k} p! / (j! * (p - j)!)
calls to the model, with n the length of
the samples x1 and x2, and p the number of factors.
sobol returns an object of class "sobol".
An object of class "sobol" is a list containing the following
components:
model |
the model. |
x1 |
the first random sample for factors. |
x2 |
the second random sample for factors. |
order |
the maximum order of indices to compute. |
nboot |
the number of bootstrap replicates. |
conf |
the confidence level for bootstrap confidence intervals. |
x |
the factor sample. |
y |
the response used. |
S |
the estimations of the anova decomposition sensitivity indices. |
call |
the matched call. |
Saltelli, A., Chan, K. and Scott, E. M., 2000, Sensitivity analysis. Wiley.
Sobol, I. M., 1993, Sensitivity analysis for non-linear mathematical model. Math. Modelling Comput. Exp., 1, 407–414.
# 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 <- 1000
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(model = sobol.fun, x1 = x1, x2 = x2, order = 2, nboot = 100)
print(sa)
#plot(sa)