Skip to contents

Estimate first-order and total-order Sobol indices using Monte Carlo estimators that support noisy outputs via independent replicates.

Usage

sobol_indices(
  model,
  design,
  replicates = 1L,
  estimator = c("jansen", "saltelli"),
  keep_samples = FALSE,
  ...
)

Arguments

model

Function receiving a numeric matrix and returning a numeric vector of responses. The function may include internal randomness.

design

Output of sobol_design().

replicates

Integer, number of repeated evaluations to average out the model noise. Defaults to one replicate (deterministic behaviour).

estimator

Character string, either "saltelli" or "jansen". Defaults to "jansen".

keep_samples

When TRUE, store all simulated values.

...

Further arguments passed to model.

Value

An object of class sobol_result containing the indices, intermediate estimates, and the Monte Carlo variance.

Details

Two families of estimators are available:

  • "saltelli": Saltelli-type estimator with internal centering of the model outputs before variance and index computation.

  • "jansen": Jansen-type estimator based on variances of output differences, which is numerically stable in many settings.

Examples

design <- sobol_design(n = 128, d = 3, quasi = TRUE)
model <- function(x) ishigami_model(x)
result <- sobol_indices(model, design, replicates = 4)
result$data