Learn R Programming

clhs (version 0.4-3)

clhs: Conditioned Latin Hypercube Sampling

Description

Implementation of the conditioned Latin hypercube sampling, as published by Minasny and McBratney (2006). This method proposes to stratify sampling in presence of ancillary data.

Usage

clhs(x, ...)

Arguments

x
A data.frame, SpatialPointsDataFrame or Raster object.
...
Additional arguments, see under Details.

Value

  • * If the simple option is set to TRUE (default behaviour): A numeric vector containing the indices of the selected samples is returned

    * If the simple option is set to FALSE: An object of class cLHS_result, with the following elements:

  • index_samplesa vector giving the indices of the chosen samples.
  • sampled_datathe sampled data.frame.
  • obj_functiona vector giving the evolution of the objective function throughout the Meropolis-Hastings iterations.

Details

Below are the additional arguments that can be used:

- size: A non-negative integer giving the number of items to choose.

- iter: A positive number, giving the number of iterations for the Metropolis-Hastings annealing process.

- tdecrease: A number betwen 0 and 1, giving the rate at which temperature decreases in the simulated annealing process.

- weights: A list a length 3, giving the relative weights for continuous data, categorical data, and correlation between variables.

- progress: TRUE or FALSE, displays a progress bar.

- simple: TRUE or FALSE. If set to TRUE, only the indices of the selected samples are returned, as a numeric vector. If set to FALSE, a cLHS_result object is returned (takes more memory but allows to make use of cLHS_results methods such as plot.cLHS_result).

References

Minasny, B. and McBratney, A.B. 2006. A conditioned Latin hypercube method for sampling in the presence of ancillary information. Computers and Geosciences, 32:1378-1388.

See Also

plot.cLHS_result

Examples

Run this code
df <- data.frame(a = runif(1000), b = rnorm(1000), c = sample(LETTERS[1:5], size = 1000, replace = TRUE))

# Returning the indices of the sampled points
res <- clhs(df, size = 50, iter = 2000, progress = FALSE, simple = TRUE)
str(res)

# Returning a cLHS_result object for plotting
res <- clhs(df, size = 50, iter = 2000, progress = FALSE, simple = FALSE)
str(res)
plot(res)

Run the code above in your browser using DataLab