Skip to contents

This function draws a random Latin hypercube sample from the unit cube, i.e., the unit interval is divided into n intervals of equal length in each dimension, and each of them contains exactly one of the n points.

Usage

lhs_points(n, dim)

Arguments

n

[integer(1)]
The number of points.

dim

[integer(1)]
The dimension.

Value

A matrix with n rows and dim columns, where each row is a point in the unit cube.

References

McKay, M. D., Beckman, R. J. and Conover, W. J. (1979). A comparison of three methods for selecting values of input variables in the analysis of output from a computer code. Technometrics 21(2), 239–245. doi:10.1080/00401706.1979.10489755

Examples

set.seed(1)
lhs_points(n = 5, dim = 2)
#>            [,1]        [,2]
#> [1,] 0.02032206 0.500460152
#> [2,] 0.61106495 0.856476298
#> [3,] 0.46784044 0.001618781
#> [4,] 0.87417719 0.723992964
#> [5,] 0.38764275 0.244510956