Create Sobol sampling matrices using sensobol::sobol_matrices() and an
mctable definition. The function generates quasi-random draws in [0, 1]
and then maps them to the target distributions defined in mctable$mc_func
(or mctable$func) and mctable$sample_space.
Usage
mctable_sobol_matrices(
mctable = set_mctable(),
N,
matrices = c("A", "B", "AB"),
order = c("first", "second", "third", "fourth"),
type = c("QRN", "LHS", "R"),
mc_names = NULL,
transformation = TRUE,
drop_constant = TRUE,
...
)Arguments
- mctable
(data frame). Table containing at least
mcnodeandsample_space; may also containmc_func/funcandtransformation.- N
(integer). Base sample size (see
sensobol::sobol_matrices()).- matrices
(character). Which Sobol matrices to create (see
sensobol::sobol_matrices()). Default:c("A", "B", "AB").- order
(character). Either
"first","second","third", or"fourth"(seesensobol::sobol_matrices()).- type
(character). Sampling design used by
sensobol::sobol_matrices(). In sensobol 1.1.6, options include"QRN"(default),"LHS", and"R".- mc_names
(character vector, optional). Node names to include. If
NULL, all nodes inmctable$mcnodeare used.- transformation
(logical). Whether to apply
mctable$transformationrules after mapping, so values are on the same scale as the bounds returned bymctable_bounds(). Required for categoricalsample_space. Default:TRUE.- drop_constant
(logical). If
TRUE, exclude nodes that take a single value before building the matrices. Dropped node names are stored inattr(X, "dropped"). Default:TRUE.- ...
Additional arguments passed to
sensobol::sobol_matrices()(and potentially torandtoolbox::sobol()whentype = "QRN").
Value
A numeric matrix where each column is a model input after mapping
to the distributions defined in the mctable (and transformation, if
applied), and each row is a sampling point. The matrix has the same
layout/row binding as sensobol::sobol_matrices(). Attribute "dropped"
contains the names of nodes removed by drop_constant.
Details
If the distribution function is missing but numeric bounds are available in
sample_space (e.g. min = 0, max = 1 or c(0, 1)), the function assumes a
uniform distribution (stats::runif). Supported distribution functions are
runif, rnorm (mean, sd) and rpert (min, mode, max, optional
shape), also when namespace-qualified (e.g. mc2d::rpert). Categorical
sample_space vectors (e.g. c('always', 'sometimes', 'never')) are
supported when a numeric transformation is provided. A single numeric
value (e.g. 1, c(1), c('1') or value = 1) defines a constant input
(min = max), which is dropped when drop_constant = TRUE.
