View source: R/test_functions.R
| metafunction | R Documentation |
Random metafunction based on \insertCiteBecker2020;textualsensobol's metafunction.
metafunction(data, k_2 = 0.5, k_3 = 0.2, epsilon = NULL)
data |
A numeric matrix where each column is a model input and each row a sampling point. |
k_2 |
Numeric value indicating the fraction of active pairwise interactions (between 0 and 1).
Default is |
k_3 |
Numeric value indicating the fraction of active three-wise interactions
(between 0 and 1). Default is |
epsilon |
Integer value. It fixes the seed for the random number generator.
The default is |
The metafunction randomly combines the following functions in a metafunction of dimension k:
f(x) = x ^ 3 (cubic).
f(x) = 1~\mbox{if}(x > 0.5), 0~\mbox{otherwise} (discontinuous).
f(x) = \frac{e ^ x}{e - 1} (exponential).
f(x) = \frac{10 - 1}{1.1} ^ {-1} (x + 0.1) ^ {-1} (inverse).
f(x) = x (linear)
f(x) = 0 (no effect).
f(x) = 4(x - 0.5) ^ 2 (non-monotonic).
f(x) = \frac{\sin (2 \pi x)}{2} (periodic).
f(x) = x ^ 2 (quadratic).
f(x) = \cos(x) (trigonometric).
It is constructed as follows:
y=\sum_{i=1}^{k}\alpha_i f^{u_i}(x_i) \\
+ \sum_{i=1}^{k_2}\beta_i f^{u_{V_{i,1}}}(x_{V_{i,1}}) f^{u_{V_{i,2}}} (x_{V_{i,2}}) \\
+ \sum_{i=1}^{k_3}\gamma_i f^{u_{W_{i,1}}}(x_{W_{i,1}}) f^{u_{W_{i,2}}}(x_{W_{i,2}}) f^{u_{W_{i,3}}} (x_{W_{i,3}})
where k is the model dimensionality, u is a k-length vector formed by randomly
sampling with replacement the ten functions mentioned above, V and W are two matrices specifying the
number of pairwise and three-wise interactions given the model dimensionality,
and \mathbf{\alpha}, \mathbf{\beta}, \mathbf{\gamma} are three
vectors of length k generated by sampling from a mixture of two normal distributions
\Psi=0.3\mathcal{N}(0, 5) + 0.7\mathcal{N}(0, 0.5).
See \insertCitePuyj;textualsensobol and \insertCiteBecker2020;textualsensobol for a full
mathematical description of the metafunction approach.
A numeric vector with the function output.
# Define settings (number of model inputs = 86)
N <- 100; params <- paste("X", 1:86, sep = "")
# Create sample matrix
mat <- sobol_matrices(N = N, params = params)
# Compute metafunction
Y <- metafunction(mat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.