# lhsnorm

Latin hypercube sample from normal distribution

## Syntax

```X = lhsnorm(mu,sigma,n) X = lhsnorm(mu,sigma,n,flag) [X,Z] = lhsnorm(...) ```

## Description

`X = lhsnorm(mu,sigma,n)` returns an n-by-p matrix, `X`, containing a Latin hypercube sample of size `n` from a p-dimensional multivariate normal distribution with mean vector, `mu`, and covariance matrix, `sigma`.

`X` is similar to a random sample from the multivariate normal distribution, but the marginal distribution of each column is adjusted so that its sample marginal distribution is close to its theoretical normal distribution.

`X = lhsnorm(mu,sigma,n,flag)` controls the amount of smoothing in the sample. If `flag` is `'off'`, each column has points equally spaced on the probability scale. In other words, each column is a permutation of the values ```G(0.5/n), G(1.5/n), ..., G(1-0.5/n)```, where `G` is the inverse normal cumulative distribution for that column's marginal distribution. If `flag` is `'on'` (the default), each column has points uniformly distributed on the probability scale. For example, in place of `0.5/n` you use a value having a uniform distribution on the interval `(0/n,1/n)`.

`[X,Z] = lhsnorm(...)` also returns `Z`, the original multivariate normal sample before the marginals are adjusted to obtain `X`.

## References

 Stein, M. “Large sample properties of simulations using latin hypercube sampling.” Technometrics. Vol. 29, No. 2, 1987, pp. 143–151. Correction, Vol. 32, p. 367.