sobolrep {sensitivity} | R Documentation |
Sobol' indices estimation based on replicated orthogonal arrays
Description
sobolrep
generalizes the estimation of the Sobol' sensitivity indices introduced by Tissot & Prieur (2015) using two replicated orthogonal arrays. This function estimates either
all first-order and second-order indices at a total cost of
2 \times N
model evaluations,or all first-order, second-order and total-effect indices at a total cost of
N \times (d+2)
model evaluations,
where N=q^{2}
and q \geq d-1
is a prime number corresponding to the number of levels of each orthogonal array.
Usage
sobolrep(model = NULL, factors, N, tail=TRUE,
conf=0.95, nboot=0, nbrep=1, total=FALSE, ...)
## S3 method for class 'sobolrep'
tell(x, y = NULL, ...)
## S3 method for class 'sobolrep'
print(x, ...)
## S3 method for class 'sobolrep'
plot(x, ylim = c(0,1), choice, ...)
Arguments
model |
a function, or a model with a |
factors |
an integer giving the number of factors, or a vector of character strings giving their names. |
N |
an integer giving the size of each replicated design (for a total of |
tail |
a boolean specifying the method used to choose the number of levels of the orthogonal array (see "Warning messages"). |
conf |
the confidence level for confidence intervals. |
nboot |
the number of bootstrap replicates. |
nbrep |
the number of times the estimation procedure is repeated (see "Details"). |
total |
a boolean specifying whether or not total effect indices are estimated. |
x |
a list of class |
y |
the model response. |
ylim |
y-coordinate plotting limits. |
choice |
an integer specifying which indices to plot: |
... |
any other arguments for |
Details
sobolrep
automatically assigns a uniform distribution on [0,1] to each input. Transformations of distributions (between U[0,1] and the wanted distribution) have to be performed before the call to tell() (see "Examples").
nbrep
specifies the number of times the estimation procedure is repeated. Each repetition makes use of the orthogonal array structure to obtain a new set of Sobol' indices. It is important to note that no additional model evaluations are performed (the cost of the procedure remains the same).
Value
sobolrep
returns a list of class "sobolrep"
, containing all
the input arguments detailed before, plus the following components:
call |
the matched call. |
X |
a |
y |
the response used. |
RP |
the matrix of permutations. |
V |
the model variance. |
S |
a data.frame containing estimations of the first-order Sobol' indices plus confidence intervals if specified. |
S2 |
a data.frame containing estimations of the second-order Sobol' indices plus confidence intervals if specified. |
T |
a data.frame containing estimations of the total-effect indices plus confidence intervals if specified. |
Warning messages
- "The value entered for
N
is not the square of a prime number. It has been replaced by: " the number of levels
q
of each orthogonal array must be a prime number. IfN
is not a square of a prime number, then this warning message indicates that it was replaced depending on the value oftail
. Iftail=TRUE
(resp.tail=FALSE
) the new value ofN
is equal to the square of the prime number preceding (resp. following) the square root ofN
.- "The value entered for
N
is not satisfying the constraintN \geq (d-1)^2
. It has been replaced by: " the following constraint must be satisfied
N \geq (d-1)^{2}
whered
is the number of factors. This warning message indicates thatN
was replaced by the square of the prime number following (or equals to)d-1
.
References
A.S. Hedayat, N.J.A. Sloane and J. Stufken, 1999, Orthogonal Arrays: Theory and Applications, Springer Series in Statistics.
J-Y. Tissot and C. Prieur, 2015, A randomized orthogonal orray-based procedure for the estimation of first- and second-order Sobol' indices, J. Statist. Comput. Simulation, 85:1358-1381.
Examples
# 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])
x <- sobolrep(model = sobol.fun, factors = 8, N = 1000, nboot=100, nbrep=1, total=FALSE)
print(x)
plot(x,choice=1)
plot(x,choice=2)
# Test case: dealing with non-uniform distributions
x <- sobolrep(model = NULL, factors = 3, N = 1000, nboot=0, nbrep=1, total=FALSE)
# X1 follows a log-normal distribution:
x$X[,1] <- qlnorm(x$X[,1])
# X2 follows a standard normal distribution:
x$X[,2] <- qnorm(x$X[,2])
# X3 follows a gamma distribution:
x$X[,3] <- qgamma(x$X[,3],shape=0.5)
# toy example
toy <- function(x){rowSums(x)}
y <- toy(x$X)
tell(x, y)
print(x)
plot(x,choice=1)
plot(x,choice=2)