Learn R Programming

tgp (version 1.1-11)

lhs: Latin Hypercube sampling

Description

Draw a (random) Latin Hypercube (LH) sample of size n from in the region outlined by the provided rectangle

Usage

lhs(n, rect)

Arguments

n
Size of the LH sample
rect
Rectangle describing the domain from which the LH sample is to be taken. The rectangle should have exactly two columns (i.e., dim(rect)[2] = 2), and number of rows equal to the dimension of the domain. For 1-d data, a vector of

Value

  • The output is a matrix with n rows and dim(rect)[1] columns. Each of the n rows represents a sample

References

McKay, M. D., W. J. Conover and R. J. Beckman. (1979). A Comparison of Three Methods for Selecting Values of Input Variables in the Analysis of Output from a Computer Code, Technometrics 21: (pp. 239--245).

See Also

tgp.design, dopt.gp

Examples

Run this code
# get and plot a 2-d LH design
s1 <- lhs(10, rbind(c(-2,3), c(0.5, 0.8)))
plot(s1)

# plot a grid to show that there is one sample
# in each grid location
abline(v=seq(-2,3,length=11), lty=2, col=3)
abline(h=seq(0.5,0.8,length=11), lty=2, col=3)

Run the code above in your browser using DataLab