Skip to contents

Generate the two-sample matrices (A and B) that are required to apply Monte Carlo Sobol estimators. The helper can rely on pseudo random numbers or on a light-weight Halton low-discrepancy sequence to increase coverage.

Usage

sobol_design(
  n,
  d,
  lower = rep(0, d),
  upper = rep(1, d),
  quasi = FALSE,
  seed = NULL
)

Arguments

n

Integer, number of rows per design matrix.

d

Integer, number of model parameters.

lower

Numeric vector of length d containing lower bounds.

upper

Numeric vector of length d containing upper bounds.

quasi

Logical, when TRUE a Halton sequence is used.

seed

Optional integer used to initialise the RNG state.

Value

A list with matrices A and B plus the column names.

Examples

design <- sobol_design(n = 64, d = 3, quasi = TRUE)
str(design)
#> List of 4
#>  $ A    : num [1:64, 1:3] 0.5 0.25 0.75 0.125 0.625 ...
#>   ..- attr(*, "dimnames")=List of 2
#>   .. ..$ : NULL
#>   .. ..$ : chr [1:3] "X1" "X2" "X3"
#>  $ B    : num [1:64, 1:3] 0.508 0.258 0.758 0.133 0.633 ...
#>   ..- attr(*, "dimnames")=List of 2
#>   .. ..$ : NULL
#>   .. ..$ : chr [1:3] "X1" "X2" "X3"
#>  $ lower: num [1:3] 0 0 0
#>  $ upper: num [1:3] 1 1 1