optimCLHS(points, candi, iterations = 50000, covars, use.coords = FALSE,
x.max, x.min, y.max, y.min, acceptance = list(initial = 0.8, cooling =
iterations/10), stopping = list(max.count = iterations/10),
plotit = FALSE, track = FALSE, boundary, progress = TRUE,
verbose = FALSE, greedy = FALSE, weights = list(O1 = 1/3, O2 = 1/3, O3 =
1/3))objCLHS(points, candi, covars, use.coords = FALSE, weights = list(O1 = 1/3,
O2 = 1/3, O3 = 1/3))
points is an integer value, it defines the number of points that
should be randomly sampled from candi to form the starting system
configuration. If points is acandi must have two columns in the following
order: [, "x"] the projected x-coordinates, and [, "y"] the
projected y-coordinates.iterations = 100.use.coords = FALSE.initial --
numeric value between 0 and 1 defining the initial acceptance probability,
and cooling -- a numeric value defining the exponential factor by
which the acceptance probability decreasesmax.count --
integer value defining the maximum allowable number of iterations without
improvement of the objective function value. Defaults to
stopping = list(max.count = iterations / 10).track = FALSE (the default), only the starting and ending energy state
values are returned with the result.candi.progress = TRUE.verbose = FALSE.greedy = FALSE. (experimental)optimCLHS returns a matrix: the optimized sample configuration.objCLHS returns a numeric value: the energy state of the sample
configuration - the objective function value.
The second method consists of using a finite set of candidate
locations for the perturbed points. A finite set of candidate locations is
created by discretizing the spatial domain, that is, creating a fine grid of
points that serve as candidate locations for the perturbed points. This is
the only method currently implemented in the
Using a finite set of candidate locations has one important inconvenience.
When a point is selected to be jittered, it may be that the new location
already is occupied by another point. If this happens, another location is
iteratively sought for as many times as there are points in points.
Because the more points there are in points, the more likely it is
that the new location already is occupied by another point. If a solution is
not found, the point selected to be jittered point is kept in its original
location.
A more elegant method can be defined using a finite set of candidate
locations coupled with a form of two-stage random sampling as
implemented in spsample. Because the candidate
locations are placed on a finite regular grid, they can be seen as being the
centre nodes of a finite set of grid cells (or pixels of a raster image). In
the first stage, one of the
quantile using a continuous function (type = 7),
that is, a function that interpolates between existing covariate values to
estimate the sample quantiles -- this is the procedure implemented in the
method of Minasny and McBratney (2006), which creates breakpoints that do
not occur in the population of existing covariate values. Depending on the
level of discretization of the covariate values, that is, how many
significant digits they have, this can create repeated breakpoints,
resulting in empty marginal sampling strata. The number of empty marginal
sampling strata will ultimately depend on the frequency distribution of the
covariate, and on the number of sampling points.The weighted sum method is affected by the relative magnitude of the
different objective function values. The objective functions implemented in
optimCLHS have different units and orders of magnitude. The
consequence is that the objective function with the largest values,
generally O1, may have a numerical dominance during the optimization.
In other words, the weights will not express the true preferences of the
user, and the meaning of the utility function becomes unclear -- the
optimization will favour the objective function which is numerically
dominant.
An efficient solution to avoid numerical dominance is to transform the
objective functions so that they are constrained to the same approximate
range of values, at least in the end of the optimization. However, as in the
original CLHS, optimCLHS uses the naive aggregation method, which
ignores that the three objective functions have different units and orders
of magnitude. The same aggregation procedure is implemented in the
spatial trend
intamap package. R
package version 1.1-10.van Groenigen, J.-W. Constrained optimization of spatial sampling: a geostatistical approach. Wageningen: Wageningen University, p. 148, 1999.
Minasny, B.; McBratney, A. B. A conditioned Latin hypercube method for sampling in the presence of ancillary information. Computers & Geosciences, v. 32, p. 1378-1388, 2006.
Minasny, B.; McBratney, A. B. Conditioned Latin Hypercube Sampling for calibrating soil sensor data to soil properties. Chapter 9. Viscarra Rossel, R. A.; McBratney, A. B.; Minasny, B. (Eds.) Proximal Soil Sensing. Amsterdam: Springer, p. 111-119, 2010.
Roudier, P.; Beaudette, D.; Hewitt, A. A conditioned Latin hypercube sampling algorithm incorporating operational constraints. 5th Global Workshop on Digital Soil Mapping. Sydney, p. 227-231, 2012.
clhs, optimACDCrequire(sp)
data(meuse.grid)
candi <- meuse.grid[, 1:2]
covars <- meuse.grid[, 5]
weights <- list(O1 = 0.5, O3 = 0.5)
set.seed(2001)
res <- optimCLHS(points = 100, candi = candi, covars = covars,
use.coords = TRUE, weights = weights, iterations = 100)
objSPSANN(res) - # 106.0691
objCLHS(points = res, candi = candi, covars = covars, use.coords = TRUE,
weights = weights)
# MARGINAL DISTRIBUTION
par(mfrow = c(3, 3))
# Covariates
i <- sample(1:nrow(candi), 100)
hist(candi[, 1], breaks = 10)
hist(candi[, 2], breaks = 10)
hist(covars, breaks = 10)
# Optimized sample
hist(candi[res[, 1], 1], breaks = 10)
hist(candi[res[, 1], 2], breaks = 10)
hist(covars[res[, 1]], breaks = 10)
# Random sample
hist(candi[i, 1], breaks = 10)
hist(candi[i, 2], breaks = 10)
hist(covars[i], breaks = 10)
# LINEAR CORRELATION
# Covariates
cor(cbind(candi[, 1], candi[, 2], covars))
# Optimized sample
cor(cbind(candi[res[, 1], 1], candi[res[, 1], 2], covars[res[, 1]]))
# Random sample
cor(cbind(candi[i, 1], candi[i, 2], covars[i]))Run the code above in your browser using DataLab