optimizeNetwork: Optimization of networks

optimizeNetworkR Documentation

Optimization of networks

Description

Optimizes the sampling design of observation point locations using a varity of methods including spatial coverage by k means (as described in spcosa) or by maximizing nearest neighbour distances and spatial simulated annealing (SSA, as described in ssaOptim) using MUKV as a criterion (calculateMukv) .

Usage

optimizeNetwork(observations, predGrid, candidates, method, action,
                nDiff, model, criterion = "MUKV", plotOptim = TRUE, nGridCells, 
                nTry, nr_iterations = 10000, formulaString, fun, ...)

Arguments

observations

object of class Spatial* with coordinates and possible covariates

predGrid

object of class Spatial* used when method = "ssa". predGrid should contain the coordinates of prediction locations for optimization. Usually predGrid is a SpatialGrid / SpatialPixels or a SpatialGridDataFrame / SpatialPixelsDataFrame when independent covariate predictor variables are used

candidates

when method = "manual" or method = "ssa", candidates is the study area of class SpatialPolygonsDataFrame; for other methods, when action = add, candidates are points or polygons of class Spatial*

method

"spcov" for spatial coverage, "ssa" for spatial simulated annealing or "manual" for manual processing of the network

action

character string indicating which action to perform: "add" to add new measurement stations to the existing network or "del" to delete existing stations

nDiff

number of stations to add or delete

model

variogram model to consider when method = "ssa" and criterion = "mukv"; object of class variogramModel, as generated by vgm

criterion

Only in use for method "ssa": character string, "mukv"

plotOptim

logical; if TRUE, creates a plot of the result as optimization progresses; TRUE by default

nGridCells

when method is "spcov" and action is "add": the approximate number gridcells to explore within the candidate map as locations for new observations

nTry

when method is "spcov" and action is "add": nTry is the number of initial configurations to try. The method will keep the best solution in order to reduce the risk of ending up with an unfavorable solution

nr_iterations

number of iterations to process before stoping. The default coolingFactor in ssaOptim is also a function of number of iterations. Refer to ssaOptim for more details

formulaString

When method = "ssa", this formula defines the dependent variable as a linear model of independent variables; suppose the dependent variable has name z, for ordinary and simple kriging use the formula z~1; for universal kriging, suppose z is linearly dependent on x and y, use the formula z~x+y. The formulaString defaults to "value~1" if value is a part of the data set. If not, the first column of the data set in observations is used.

fun

Alternative objective function for optimization, the input and output should match the ones of (calculateMukv (except for fun)

...

other arguments to be passed on to lower level functions

Details

This function contains different methods to optimally add or remove point locations to or from a measurement network (Baume et al. 2011). Points can be added or deleted in the following ways:

  1. manually

  2. using a spatial coverage approach by k means to add stations (as described in spcosa, Brus et al. 2006) using a spatial coverage approach by maximizing mean nearest neighbour distances to remove stations (as described in spCovDel)

  3. or using spatial simulated annealing with mean universal kriging variance as a criterion (calculateMukv, Brus & Heuvelink 2007, Melles et al. 2011)

The results of different methods can be checked using the function calculateMukv, which returns mean universal kriging variance for an optimized network.

The user should be aware of the following limitations:

  1. method = "ssa" is only implemented for criterion = "mukv"

  2. Input candidates should preferably be a continuous domain such as SpatialPolygons

  3. method = "ssa" with criterion = "mukv" makes it possible to assume a linear relationship between independent variables in predGrid and dependent variables at observation locations using universal kriging (krige). However, a correct estimate of mean universal kriging variance requires that the independent covariate variables be known at candidate locations. Thus it is necessary to have complete spatial coverage for all covariate predictors in the linear model. Covariate information must be available at both new candidate measurement locations and prediction locations. This information is acquired (or sampled) from predGrid at candidate locations during SSA using a call to over by default. But see ssaOptim for more details and an option to interpolate these values for candidate locations from predGrid.

  4. Note that it is not recommended to use independent variables which differ strongly in magnitude (as for traditional universal kriging)

  5. If no formulaString is supplied, an ordinary kriging formula is assumed, and optimization will proceed using mean ordinary kriging variance

Value

Object of class SpatialPoints* with spatial coordinates of optimized locations (including observation locations when action = "add")

Author(s)

O. Baume, S.J. Melles, J. Skoien

References

O. P. Baume, A. Gebhardt, C. Gebhardt, G. B. M. Heuvelink, J. Pilz (2011). Network optimization algorithms and scenarios in the context of automatic mapping, Computers and Geosciences, 37: 289-294 (2011).

S. J. Melles, G. B. M. Heuvelink, C. J. W. Twenhofel, U. Stohlker (2011). Optimizing the spatial pattern of networks for monitoring radioactive releases, Computers and Geosciences, 37: 280-288 (2011).

D. J. Brus, G. B. M. Heuvelink (2007). Optimization of sample patterns for universal kriging of environmental variables, Geoderma, 138: 86-95 (2007).

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.

See Also

ssaOptim, spCovDel, spCovAdd, calculateMukv, stratify

Examples


# load data:
library(gstat)
data(meuse)
coordinates(meuse) = ~x+y
data(meuse.grid)
coordinates(meuse.grid) = ~x+y
gridded(meuse.grid) = TRUE
predGrid = meuse.grid

# estimate variograms (OK/UK):
vfitOK = fit.variogram(variogram(zinc~1, meuse), vgm(1, "Exp", 300, 1))
vfitUK = fit.variogram(variogram(zinc~x+y, meuse), vgm(1, "Exp", 300, 1))
vfitRK = fit.variogram(variogram(zinc~dist+ffreq+soil, meuse), vgm(1, "Exp", 300, 1))

# study area of interest:
bb = bbox(predGrid)
boun = SpatialPoints(data.frame(x=c(bb[1,1],bb[1,2],bb[1,2],bb[1,1],bb[1,1]),
                                y=c(bb[2,1],bb[2,1],bb[2,2],bb[2,2],bb[2,1])))
Srl = Polygons(list(Polygon(boun)),ID = as.character(1))
candidates = SpatialPolygonsDataFrame(SpatialPolygons(list(Srl)),
                                      data = data.frame(ID=1))


# add 20 more points assuming OK model (SSA method):
 optimOK <- optimizeNetwork(meuse, meuse.grid, candidates = candidates,
  method= "ssa", action= "add", nDiff = 20, model = vfitOK, criterion="MUKV",
  nr_iterations=10000, nmax=40)


# add 20 more points assuming UK model (SSA method):
optimUK <- optimizeNetwork(meuse, meuse.grid, candidates = candidates,
   method = "ssa", action = "add", nDiff = 20, model=vfitUK, criterion="MUKV",
   nr_iterations = 10000, nmax = 40, formulaString = zinc~x+y)

# add 20 more points with auxiliary variables (SSA method):
optimRK <- optimizeNetwork(meuse, meuse.grid, candidates=candidates,
   method="ssa", action="add", nDiff=4, model=vfitRK, criterion="MUKV",
   nr_iterations=10000, formula=zinc~dist+ffreq+soil, nmax=200)

# add optimally 20 stations from current network with method "spcov"
# (spatial coverage method)
optimSC = optimizeNetwork(meuse, meuse.grid, candidates, method = "spcov",
            action = "add", nDiff = 10, model = model, criterion = "MUKV", plotOptim = TRUE,
            nGridCells = 10000,nTry = 100 )

# delete optimally 10 stations from current network with method "manual"
if (interactive()) optimMAN = optimizeNetwork(meuse, meuse.grid, candidates, method = "manual",
            action = "del", nDiff = 10, model = model, criterion = "MUKV", plotOptim = TRUE )


# comparison of results with ordinary kriging variogram, otherwise add formulaString
# ssa method, assuming ordinary kriging
calculateMukv(optimOK, predGrid, vfitOK) 

# ssa method, using spatial location as covariates
calculateMukv(optimUK, predGrid, vfitUK, zinc~x+y)
 
# ssa method, using other variables as covariates
calculateMukv(optimRK, predGrid, vfitRK, zinc~dist+ffreq+soil) 

# spcov method
calculateMukv(optimSC, predGrid, vfitOK) 

# 10 stations manually deleted
if (interactive()) calculateMukv(optimMAN, predGrid, vfitOK, zinc~1) 



intamapInteractive documentation built on Nov. 2, 2023, 5:45 p.m.