Last data update: 2014.03.03

R: Latin Hypercube Sampling
LatinhyperR Documentation

Latin Hypercube Sampling

Description

Generates random parameter sets using a latin hypercube sampling algorithm.

Usage

Latinhyper(parRange, num)

Arguments

parRange

the range (min, max) of the parameters, a matrix or a data.frame with one row for each parameter, and two columns with the minimum (1st) and maximum (2nd) column.

num

the number of random parameter sets to generate.

Details

In the latin hypercube sampling, the space for each parameter is subdivided into num equally-sized segments and one parameter value in each of the segments drawn randomly.

Value

a matrix with one row for each generated parameter set, and one column per parameter.

Note

The latin hypercube distributed parameter sets give better coverage in parameter space than the uniform random design (Unif). It is a reasonable choice in case the number of parameter sets is limited.

Author(s)

Karline Soetaert <karline.soetaert@nioz.nl>

References

Press, W. H., Teukolsky, S. A., Vetterling, W. T. and Flannery, B. P. (2007) Numerical Recipes in C. Cambridge University Press.

See Also

Norm for (multi)normally distributed random parameter sets.

Unif for uniformly distributed random parameter sets.

Grid to generate random parameter sets arranged on a regular grid.

Examples

## 4 parameters
parRange <- data.frame(min = c(0, 1, 2, 3), max = c(10, 9, 8, 7))
rownames(parRange) <- c("par1", "par2", "par3", "par4")

## Latin hypercube
pairs(Latinhyper(parRange, 100), main = "Latin hypercube")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(FME)
Loading required package: deSolve

Attaching package: 'deSolve'

The following object is masked from 'package:graphics':

    matplot

Loading required package: rootSolve
Loading required package: coda
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/FME/Latinhyper.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Latinhyper
> ### Title: Latin Hypercube Sampling
> ### Aliases: Latinhyper
> ### Keywords: utilities
> 
> ### ** Examples
> 
> ## 4 parameters
> parRange <- data.frame(min = c(0, 1, 2, 3), max = c(10, 9, 8, 7))
> rownames(parRange) <- c("par1", "par2", "par3", "par4")
> 
> ## Latin hypercube
> pairs(Latinhyper(parRange, 100), main = "Latin hypercube")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>