Sampling >

Latin Hypercube Sampling (LHS) is a way of generating random samples of parameter values. It is widely used in Monte Carlo simulation, because it can drastically reduce the number of runs necessary to achieve a reasonably accurate result.LHS is based on the Latin square design, which has a single sample in each row and column. A “hypercube” is a cube with more than three dimensions; the Latin square is extended to sample from multiple dimensions and multiple hyperplanes.

## The Method Behind Latin Hypercube Sampling

**One-dimensional Latin hypercube sampling** involves dividing your cumulative density function (cdf) into n equal partitions; and then choosing a random data point in each partition.

As a simple example, let’s say you needed a random sample with 100 data points. First, divide the cdf into 100 equal intervals. If your distribution starts at 0 and ends with *k *, your first data point would be selected from the interval between (0,k/100). The second data point would be from the interval (k/100, 2k/100), your third from (2k/100, 3k/100), and so on. In each interval you would randomly select one point, giving you 100 different points.

**Two-dimensional Latin hypercube sampling **is not much more complicated and is usually performed with software. Assuming your two variables, x_{1} and x_{2} are independent, you follow the one-dimensional method to come up with one dimensional samples for x_{1} and x_{2} separately. Once you have two lists of samples, you combine them, randomly, into two-dimensional pairs.

For **n-dimensional Latin hypercube sampling **the same method is used.

## Why Use Latin Hypercube Sampling?

Latin Hypercube Sampling is typically used to s**ave computer processing time **when running Monte Carlo simulations. Studies have shown that a well-performed LHS can cut down on processing time by up to 50 percent (versus a standard Monte Carlo importance sampling).

LHS is therefore more important when working with slow operating systems and software than when doing analysis on faster devices. Some have gone so far as to suggest that the modern computers available to almost any researcher have made LHS obsolete, but it is still widely used. Although it does not make as big a difference in analysis as it did in the days of slowly working computer systems, it still leads to marginally more accurate results (in terms of true variability) given any amount of processing time.

## References

Olsson, A. et al. (2003). On Latin hypercube sampling for structural reliability analysis. Structural Safety: Volume 25, Issue 1, January, Pages 47-68. Retrieved January 5, 2018 from: https://doi.org/10.1016/S0167-4730(02)00039-5

Xin, L. (2014). Numerical Methods for Engineering Design and Optimization: Latin Hypercube Sampling (LHS)

Retrieved January 1, 2018 from: https://users.ece.cmu.edu/~xinli/classes/cmu_18660/Lec25.pdf

If you prefer an online interactive environment to learn R and statistics, this *free R Tutorial by Datacamp* is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try *this Statistics with R track*.

*Facebook page*and I'll do my best to help!