Optimize a sample configuration for spatial trend identification and estimation. A criterion is defined so that the sample reproduces the bivariate association/correlation between the covariates (CORR).
optimCORR(points, candi, covars, strata.type = "area",
use.coords = FALSE, schedule = scheduleSPSANN(), plotit = FALSE,
track = FALSE, boundary, progress = "txt", verbose = FALSE)objCORR(points, candi, covars, strata.type = "area",
use.coords = FALSE)
Integer value, integer vector, data frame or matrix, or list.
Integer value. The number of points. These points will be randomly sampled from candi
to form
the starting sample configuration.
Integer vector. The row indexes of candi
that correspond to the points that form the starting
sample configuration. The length of the vector defines the number of points.
Data frame or matrix. An object with three columns in the following order: [, "id"]
, the
row indexes of candi
that correspond to each point, [, "x"]
, the projected x-coordinates, and
[, "y"]
, the projected y-coordinates.
List. An object with two named sub-arguments: fixed
, a data frame or matrix with the projected
x- and y-coordinates of the existing sample configuration -- kept fixed during the optimization --, and
free
, an integer value defining the number of points that should be added to the existing sample
configuration -- free to move during the optimization.
Data frame or matrix with the candidate locations for the jittered points. candi
must
have two columns in the following order: [, "x"]
, the projected x-coordinates, and [, "y"]
,
the projected y-coordinates.
Data frame or matrix with the covariates in the columns.
(Optional) Character value setting the type of stratification that should be used to
create the marginal sampling strata (or factor levels) for the numeric covariates. Available options are
"area"
, for equal-area, and "range"
, for equal-range. Defaults to strata.type = "area"
.
(Optional) Logical value. Should the spatial x- and y-coordinates be used as covariates?
Defaults to use.coords = FALSE
.
List with 11 named sub-arguments defining the control parameters of the cooling schedule.
See scheduleSPSANN
.
(Optional) Logical for plotting the optimization results, including a) the progress of the
objective function, and b) the starting (gray circles) and current sample configuration (black dots), and
the maximum jitter in the x- and y-coordinates. The plots are updated at each 10 jitters. When adding
points to an existing sample configuration, fixed points are indicated using black crosses. Defaults to
plotit = FALSE
.
(Optional) Logical value. Should the evolution of the energy state be recorded and returned
along with the result? If track = FALSE
(the default), only the starting and ending energy states
are returned along with the results.
(Optional) SpatialPolygon defining the boundary of the spatial domain. If missing and
plotit = TRUE
, boundary
is estimated from candi
.
(Optional) Type of progress bar that should be used, with options "txt"
, for a text
progress bar in the R console, "tk"
, to put up a Tk progress bar widget, and NULL
to omit the
progress bar. A Tk progress bar widget is useful when using parallel processors. Defaults to
progress = "txt"
.
(Optional) Logical for printing messages about the progress of the optimization. Defaults to
verbose = FALSE
.
optimCORR
returns an object of class OptimizedSampleConfiguration
: the optimized sample
configuration with details about the optimization.
objCORR
returns a numeric value: the energy state of the sample configuration -- the objective
function value.
Details about the mechanism used to generate a new sample configuration out of the current sample
configuration by randomly perturbing the coordinates of a sample point are available in the help page of
spJitter
.
The correlation between two numeric covariates is measured using the Pearson's r, a descriptive statistic that ranges from \(-1\) to \(+1\). This statistic is also known as the linear correlation coefficient.
When the set of covariates includes factor covariates, all numeric covariates are transformed into factor covariates. The factor levels are defined using the marginal sampling strata created from one of the two methods available (equal-area or equal-range strata).
The association between two factor covariates is measured using the Cram<U+00E9>r's V, a descriptive statistic that ranges from \(0\) to \(+1\). The closer to \(+1\) the Cram<U+00E9>r's V is, the stronger the association between two factor covariates.
The main weakness of using the Cram<U+00E9>r's V is that, while the Pearson's r shows the degree and direction of the association between two covariates (negative or positive), the Cram<U+00E9>r's V only measures the degree of association (weak or strong). The effect of replacing the Pearson's r with the Cram<U+00E9>r's V on the spatial modelling outcome still is poorly understood.
Cram<U+00E9>r, H. Mathematical methods of statistics. Princeton: Princeton University Press, p. 575, 1946.
Everitt, B. S. The Cambridge dictionary of statistics. Cambridge: Cambridge University Press, p. 432, 2006.
# NOT RUN {
data(meuse.grid, package = "sp")
candi <- meuse.grid[1:1000, 1:2]
covars <- meuse.grid[1:1000, 5]
schedule <- scheduleSPSANN(
initial.temperature = 5, chains = 1, x.max = 1540, y.max = 2060,
x.min = 0, y.min = 0, cellsize = 40)
set.seed(2001)
res <- optimCORR(
points = 10, candi = candi, covars = covars, use.coords = TRUE,
schedule = schedule)
objSPSANN(res) - objCORR(
points = res, candi = candi, covars = covars, use.coords = TRUE)
# }
Run the code above in your browser using DataLab