Learn R Programming

pedometrics (version 0.3-0)

spJitter: Perturbation of spatial points

Description

This function perturbs the coordinates of spatial points (also known as jittering).

Usage

spJitterFinite(points, candidates, x.max, x.min, y.max, y.min, which.pts)

Arguments

points
A data.frame or matrix with the points to be perturbed. points must be a subset of candidates. See Details for more information.
candidates
A data.frame or matrix with the candidate locations for the perturbed points. points must be a subset of candidates. See Details for more information.
x.min, x.max, y.min, y.max
The minimum and maximum quantity of random noise to be added to the x and y coordinates. The minimum quantity should be equal to, at least, the minimum distance between two neighboring candidate locations. The units are the same as of the coordinates. See
which.pts
Vector of integer values defining which point should be perturbed. The current version accepts only one point to be perturbed at a time. See Details for more information.

Value

  • A data.frame or matrix with jittered coordinates.

Details

This function perturbs the coordinates of spatial points adding random noise, a process also known as jittering. There are two ways of jittering the coordinates. They differ on how the the set of candidate locations is defined.

Finite set of candidate locations{

The first method uses a finite set of candidate locations for the perturbed points. This method usually is the fastest because it does not require the use of complex routines to check if the perturbed point falls inside the spatial domain. Since the candidate locations is a finite set, any perturbed point will inexorably fall inside the spatial domain. This is a very important feature in optimization exercises with complex objective functions such as simulated annealing when repetitive perturbation is required.

The arguments x.min, y.min, x.max, and y.max are used to define a rectangular window containing the set of potential candidate locations for the point defined with the argument which.pts. We then eliminate the candidate locations that already are cointaned in the set of points being perturbed to avoid having duplicated points. The new location is then randomly sampled from the set of effective candidate locations. The current implementation does not enable to define the direction of the perturbation, nor to perturb more than one point at a time. } Infinite set of candidate locations{

The current version does not accept using an infinite set of candidate locations.}

References

Edzer Pebesma, Jon Skoien with contributions from Olivier Baume, A. Chorti, D.T. Hristopulos, S.J. Melles and G. Spiliopoulos (2013). intamapInteractive: procedures for automated interpolation - methods only to be used interactively, not included in intamap package. R package version 1.1-10. http://CRAN.R-project.org/package=intamapInteractive

Van Groenigen, J.-W. Constrained optimization of spatial sampling: a geostatistical approach. Wageningen: Wageningen University, p. 148, 1999.

See Also

ssaOptim, zerodist, jitter, jitter2d, gContains

Examples

Run this code
require(sp)
data(meuse.grid)
meuse.grid <- meuse.grid[, 1:2]
pts1 <- sample(c(1:dim(meuse.grid)[1]), 155)
pts2 <- meuse.grid[pts1, ]
pts3 <- spJitterFinite(points = pts2, candidates = meuse.grid, which.pts = 10,
                       x.min = 40, x.max = 100, y.min = 40, y.max = 100)
plot(meuse.grid, asp = 1, pch = 15, col = "gray")
points(pts2, col = "red", cex = 0.5)
points(pts3, pch = 19, col = "blue", cex = 0.5)

Run the code above in your browser using DataLab