parameterSets {hydromad}R Documentation

Generate parameter sets


Generate parameter sets from given ranges, with chosen sampling scheme.


parameterSets(par.ranges, samples,
    method = c("latin.hypercube", "random", "all.combinations"))



A named list of (numeric) parameter values. Each element can be:

  • a single number, for fixed parameters;

  • a length-2 vector, representing a range of values;

  • a vector of length > 2, representing a fixed set of values. Also, a length 2 vector can be defined as a fixed set of values by wrapping it in I(). Such fixed sets of values are resampled when method = "latin.hypercube" or "random".


Number of samples to generate. In the "all.combinations" method, the result may not have exactly this length.


the sampling scheme; see Details.


Method "latin.hypercube" generates a regular sequence for each free parameter range (using quantile and ppoints), and a repeated sequence for each fixed parameter set. Each of these sequences is then randomly permuted. For the special case of samples = 1, the mean of each range is returned.

Method "random" generates uniform random values in each free parameter range, and random samples from each fixed parameter set.

Method "all.combinations" generates a regular sequence for each free parameter range, and keeps each fixed parameter set as given. All combinations of these values are then calculated (using expand.grid). The length of the free parameter sequences is chosen such that the total number of results does not exceed samples. However, if fixed parameter sets are given, the number of combinations of these may exceed samples, and then any free parameters will be fixed at their mean values.


the result is a data.frame, with named columns for each parameter in par.ranges. Each row represents one parameter set.


Felix Andrews

See Also

sample, quantile


pars <- list(a = 1, b = 0:1, c = c(1,10), d = c(-2,-4,-8))

parameterSets(pars, 10, method = "random")

parameterSets(pars, 10, method = "latin")

parameterSets(pars, 10, method = "all.combinations")

parameterSets(pars, 20, method = "all.combinations")
[Package hydromad version 0.9-18 Index]