sobolroalhs | R Documentation |
sobolroalhs
implements the estimation of the Sobol' sensitivity indices introduced by Tissot & Prieur (2015) using two replicated designs (Latin hypercubes or orthogonal arrays). This function estimates either all first-order indices or all closed second-order indices at a total cost of 2 \times N
model evaluations. For closed second-order indices N=q^{2}
where q \geq d-1
is a prime number corresponding to the number of levels of the orthogonal array, and where d
indicates the number of factors.
sobolroalhs(model = NULL, factors, N, p=1, order, tail=TRUE, conf=0.95, nboot=0, ...)
## S3 method for class 'sobolroalhs'
tell(x, y = NULL, ...)
## S3 method for class 'sobolroalhs'
print(x, ...)
## S3 method for class 'sobolroalhs'
plot(x, ylim = c(0,1), ...)
## S3 method for class 'sobolroalhs'
ggplot(data, mapping = aes(), ylim = c(0, 1), ..., environment
= parent.frame())
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 |
p |
an integer giving the number of model outputs. |
order |
an integer giving the order of the indices (1 or 2). |
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. |
x |
a list of class |
data |
a list of class |
y |
a vector of model responses. |
ylim |
y-coordinate plotting limits. |
mapping |
Default list of aesthetic mappings to use for plot. If not specified, must be supplied in each layer added to the plot. |
environment |
[Deprecated] Used prior to tidy evaluation. |
... |
any other arguments for |
sobolroalhs
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 realized before the call to tell() (see "Examples").
Missing values (i.e NA
values) in outputs are automatically handled by the function.
This function also supports multidimensional outputs (matrices in y
or as output of model
). In this case, aggregated Sobol' indices are returned (see sobolMultOut
).
sobolroalhs
returns a list of class "sobolroalhs"
, containing all
the input arguments detailed before, plus the following components:
call |
the matched call. |
X |
a |
y |
the responses used. |
OA |
the orthogonal array constructed ( |
V |
the estimations of Variances of the Conditional Expectations (VCE) with respect to each factor. |
S |
the estimations of the Sobol' indices. |
N
is not the square of a prime number. It has been replaced by: "when order
=2
, the number of levels of the orthogonal array must be a prime number. If N
is not a square of a prime number, then this warning message indicates that it was replaced depending on the value of tail
. If tail=TRUE
(resp. tail=FALSE
) the new value of N
is equal to the square of the prime number preceding (resp. following) the square root of N
.
N
is not satisfying the constraint N \geq (d-1)^2
. It has been replaced by: "when order
=2
, the following constraint must be satisfied N \geq (d-1)^{2}
where d
is the number of factors. This warning message indicates that N
was replaced by the square of the prime number following (or equals to) d-1
.
Laurent Gilquin
A.S. Hedayat, N.J.A. Sloane and J. Stufken, 1999, Orthogonal Arrays: Theory and Applications, Springer Series in Statistics.
F. Gamboa, A. Janon, T. Klein and A. Lagnoux, 2014, Sensitivity indices for multivariate outputs, Electronic Journal of Statistics, 8:575-603.
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.
sobolmara
,
sobolroauc
,
sobolMultOut
library(boot)
library(numbers)
####################
# 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])
# first-order sensitivity indices
x <- sobolroalhs(model = sobol.fun, factors = 8, N = 1000, order = 1, nboot=100)
print(x)
plot(x)
library(ggplot2)
ggplot(x)
# closed second-order sensitivity indices
x <- sobolroalhs(model = sobol.fun, factors = 8, N = 1000, order = 2, nboot=100)
print(x)
ggplot(x)
####################
# Test case: dealing with non-uniform distributions
x <- sobolroalhs(model = NULL, factors = 3, N = 1000, order =1, nboot=0)
# 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)
ggplot(x)
####################
# Test case : multidimensional outputs
toy <- function(x){cbind(x[,1]+x[,2]+x[,1]*x[,2],2*x[,1]+3*x[,1]*x[,2]+x[,2])}
x <- sobolroalhs(model = toy, factors = 3, N = 1000, p=2, order =1, nboot=100)
print(x)
ggplot(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.