lhs_sample: Latin hypercube sample of parameter sets

View source: R/optimizer_lhs.R

lhs_sampleR Documentation

Latin hypercube sample of parameter sets

Description

Draws a Latin hypercube sample of parameter sets within user-specified ranges and returns them on the transformed scale on which optimizer works (see transform_pars). Each parameter range is divided into n strata of equal width on the sampling scale and every stratum is sampled exactly once per parameter.

Usage

lhs_sample(n, lower, upper, sampling_scale = "transformed")

Arguments

n

Number of parameter sets to draw.

lower

Vector with the lower bounds of the parameters on the original (untransformed) scale. If the vector is named, the names are used for the columns of the result.

upper

Vector with the upper bounds of the parameters on the original (untransformed) scale.

sampling_scale

The scale on which the strata have equal width. Either a single value used for all parameters, or one value per parameter:

  • 'transformed': uniform on the transformed scale transform_pars(pars), i.e. the scale on which the optimization takes place. Bounds of 0 and Inf are allowed.

  • 'original': uniform on the original scale. Bounds must be finite.

  • 'log': uniform on the logarithm of the original scale. Bounds must be positive and finite. Useful for parameters that span several orders of magnitude, such as the carrying capacity K.

Value

A matrix with n rows and length(lower) columns with the sampled parameter sets on the transformed scale. Use untransform_pars to obtain the values on the original scale.

Author(s)

Rampal S. Etienne

See Also

optimizer_lhs

Examples

set.seed(42)
trpars <- lhs_sample(n = 5,
                     lower = c(lambda = 0.1, mu = 0, K = 10),
                     upper = c(lambda = 2, mu = 1, K = 1000),
                     sampling_scale = c('transformed', 'transformed', 'log'))
untransform_pars(trpars)

DDD documentation built on Dec. 6, 2026, 1:08 a.m.