# Random Latin Hypercube

### Description

Draws a Latin Hypercube Sample from a set of uniform distributions for use in creating a Latin Hypercube Design. This sample is taken in a random manner without regard to optimization.

### Usage

1 | ```
randomLHS(n, k, preserveDraw)
``` |

### Arguments

`n` |
The number of partitions (simulations or design points) |

`k` |
The number of replications (variables) |

`preserveDraw` |
Default:FALSE. Ensures that two subsequent draws
with the same |

### Details

Latin hypercube sampling (LHS) was developed to generate a distribution
of collections of parameter values from a multidimensional distribution.
A square grid containing possible sample points is a Latin square iff there
is only one sample in each row and each column. A Latin hypercube is the
generalisation of this concept to an arbitrary number of dimensions. When
sampling a function of `k`

variables, the range of each variable is divided
into `n`

equally probable intervals. `n`

sample points are then drawn such that a
Latin Hypercube is created. Latin Hypercube sampling generates more efficient
estimates of desired parameters than simple Monte Carlo sampling.

This program generates a Latin Hypercube Sample by creating random permutations
of the first `n`

integers in each of `k`

columns and then transforming those
integers into n sections of a standard uniform distribution. Random values are
then sampled from within each of the n sections. Once the sample is generated,
the uniform sample from a column can be transformed to any distribution by
using the quantile functions, e.g. qnorm(). Different columns can have
different distributions.

### Value

An `n`

by `k`

Latin Hypercube Sample matrix with values uniformly distributed on [0,1]

### Author(s)

Rob Carnell and D. Mooney

### References

Stein, M. (1987)
Large Sample Properties of Simulations Using Latin Hypercube Sampling.
*Technometrics*.
**29**, 143–151.

### See Also

`geneticLHS`

,
`improvedLHS`

, `maximinLHS`

, and
`optimumLHS`

to generate Latin Hypercube Samples.
`optAugmentLHS`

, `optSeededLHS`

, and
`augmentLHS`

to modify and augment existing designs.

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
# draw a Latin hypercube
randomLHS(4, 3)
# transform a Latin hypercube
X <- randomLHS(5, 2)
Y <- matrix(0, nrow=5, ncol=2)
Y[,1] <- qnorm(X[,1], mean=3, sd=0.1)
Y[,2] <- qbeta(X[,2], shape1=2, shape2=3)
# check the preserveDraw option
set.seed(1976)
X <- randomLHS(6,3,preserveDraw=TRUE)
set.seed(1976)
Y <- randomLHS(6,5,preserveDraw=TRUE)
all(abs(X - Y[,1:3]) < 1E-12) # TRUE
``` |