optimizeNetwork {intamapInteractive} | R Documentation |
This function allows to choose several options for optimizing a network of observation locations
optimizeNetwork(observations, predGrid, candidates, method, action, nDiff, model, criterion = "MUKV", plotOptim = TRUE, nGridCells, nTry, nr_iterations, ...)
observations |
object of class data.frame with x,y coordinates and possible covariates |
predGrid |
object of class data.frame with x,y coordinates of prediction locations when method is "ssa" |
candidates |
when method is "manual" , candidates is the study area of class
SpatialPolygonsDataFrame ; for other methods,
when action is "add" , candidates is a data.frame with x,y coordinates or
a SpatialPolygonsDataFrame |
method |
character string: "spcov" for spatial coverage, "ssa" for spatial simulated annealing or "manual" for manual processing of the network |
action |
character string indicating which type of action to simulate:
"add" to add new measurement stations to the existing network or "del" to turn off existing stations |
nDiff |
number of stations to add or delete |
model |
variogram model to consider when criterion = "mukv" ;
object of class variogramModel ,
as generated by vgm |
criterion |
Only in use for method "ssa" : character string like "mukv" |
plotOptim |
plot or not the result; TRUE by default |
nGridCells |
when method is "spcov" and action is "add" : string forcing the number gridcells to explore for candidate locations of new measurements |
nTry |
the method will try nTry initial configurations and will keep the best solution in order to reduce the risk of ending up with an unfavorable solution |
nr_iterations |
number of iterations before stoping |
... |
other arguments to be passed on at lower level functions |
This function allows to build optimization scenarios with the choice of several options.
The user should be aware of the following limitations:\
Method ssa
is only implemented for the criterion mukv
.
Input candidates
should preferably be a continuous domain such as SpatialPolygonsDataFrame
When action = "add"
, candidates are taken from existing network observations
Data frame with x,y coordinates of optimized locations
Olivier Baume
[2] D. J. Brus, G. B. M. Heuvelink (2007). Optimization of sample patterns for universal kriging of environmental variables, Geoderma, 138: 86-95 (2007).
[3] D. J. Brus, J. de Gruijter, J. van Groenigen (2006). Designing spatial coverage samples using the k-means clustering algorithm. In A. McBratney M. Voltz and P. Lagacherie, editor, Digital Soil Mapping: An Introductory Perspective, Developments in Soil Science, vol. 3., Elsevier, Amsterdam.
## Not run: library(intamapInteractive) library(maptools) # use SIC2004 dataset data(sic2004) # load a shape file of the study area rpath = system.file("inst/external", package="intamapInteractive") setwd(rpath) candidates = readShapePoly("sic2004") # load the input for the observation and prediction locations # including the covariates for UK, and changing to more intuitive # variable names coordinates(sic.val) = ~x+y observations = sic.val["dayx"] predGrid= sic.grid # limit the number of prediction locations to have faster UK # computations nGrid = length(predGrid$x) predGrid = predGrid[sample(seq(1,nGrid),1000),] coordinates(predGrid) = ~x+y # fit the variogram model (using function fit.variogram from package # gstat) model = fit.variogram(variogram(dayx~x+y, observations), vgm(50, "Sph", 250000, 250)) plot(variogram(dayx~x+y, observations), model=model) # compute the Mukv of the current network initMukv <- calculateMukv(observations, predGrid, model) print(initMukv) # delete optimally 20 stations from current network with method "ssa" # (spatial simulated annealing) and criterion "mukv" windows() optim = optimizeNetwork(observations, predGrid, candidates, method = "ssa", action = "del", nDiff = 20, model = model, criterion = "MUKV", plot = TRUE ) ## End(Not run)