Skip to contents

IdwPredict: \(\sum w z / \sum w\), \(w = d^{-power}\), over the nmax nearest within maxdist, exact at data points, block averages of point predictions and optional geometric anisotropy, with the weighted variance, as gstat::idw (Shepard 1968). IdwCv: leave-one-out or k-fold cross-validation (gstat::krige.cv). IdwPowerSearch: LOO RMSE over powers. ShepardPredict: Franke and Nielson (1980) weights with fixed or k-th-neighbour radius. Identical to the Python arm morie.fn.idwinterp.

Usage

IdwPredict(
  z,
  coords,
  new_coords,
  power = 2,
  nmax = NULL,
  maxdist = NULL,
  block = NULL,
  angle = 0,
  ratio = 1
)

IdwCv(z, coords, power = 2, nmax = NULL, maxdist = NULL, folds = NULL)

IdwPowerSearch(z, coords, powers = seq(0.5, 6, by = 0.5), nmax = NULL)

ShepardPredict(z, coords, new_coords, radius = NULL, k = NULL)

Arguments

z

Observations.

coords, new_coords

Coordinate matrices.

power

Distance power.

nmax

Maximum neighbours.

maxdist

Maximum distance.

block

Block offsets (matrix).

angle, ratio

Anisotropy angle (radians) and minor/major ratio.

folds

Fold labels.

powers

Candidate powers.

radius

Shepard radius.

k

Neighbour order of the adaptive radius.

Value

List.

References

Shepard, D. (1968). A two-dimensional interpolation function for irregularly-spaced data. Proceedings of the 23rd ACM National Conference, 517-524.

Franke, R. and Nielson, G. (1980). Smooth interpolation of large sets of scattered data. International Journal for Numerical Methods in Engineering 15, 1691-1704.

Examples

IdwPredict(c(1, 3), rbind(c(0, 0), c(2, 0)), rbind(c(0.5, 0)))
#> $prediction
#> [1] 1.2
#> 
#> $variance
#> [1] 0.36
#> 
ShepardPredict(c(1, 3), rbind(c(0, 0), c(2, 0)), rbind(c(0.5, 0)), radius = 3)$prediction
#> [1] 1.076923