Stratified uniform [0, 1] samples via Latin hypercube sampling, using
the same seeded Mersenne Twister stream as the C# LatinHypercube.Random,
so a given seed reproduces the C# sample bit-for-bit (and matches
corehydropy exactly).
Usage
latin_hypercube(n, dimension = 1, seed = NULL, median = FALSE)
Arguments
- n
number of samples (rows).
- dimension
number of dimensions (columns).
- seed
integer seed for reproducible samples; NULL (the default)
seeds from the clock.
- median
if TRUE, place each sample at the center of its bin
(median LHS) instead of at a random position within it.
Value
An n by dimension numeric matrix of probabilities in
(0, 1).
Examples
latin_hypercube(5, 2, seed = 12345)
#> [,1] [,2]
#> [1,] 0.02124079 0.4293266
#> [2,] 0.70808945 0.1781281
#> [3,] 0.94031819 0.7721923
#> [4,] 0.43741575 0.3004890
#> [5,] 0.30296318 0.9652221