kriging_cv: Compare interpolation methods using cross-validation

View source: R/kriging_cv.R

kriging_cvR Documentation

Compare interpolation methods using cross-validation

Description

Conducts cross validation of a single predictor using kriging, nearest-neighbor, and inverse-distance weighting interpolation method using gstat.

Usage

kriging_cv(
  x,
  fold = NULL,
  kriging_formula,
  location_formula,
  anisotropy_parameters = NULL,
  nm = Inf,
  maxdist = Inf,
  interpolation_methods = c("nn", "idw", "exp", "cir", "gau", "sph", "mat", "bes", "ste"),
  vgm_width = NULL,
  estimate_anisotropy = FALSE,
  only_return_anisotropy = FALSE,
  anisotropy_kfold = 10,
  seed = 19673
)

Arguments

x

A data.frame containing variables to be interpolated and latitude and longitude coordinates.

fold

Vector of numeric values indicating which observations are assigned to which fold. Default NULL performs leave-one-out cross validation. (see 'nfold' argument in ?gstat::gstat).

kriging_formula

Formula to use for kriging. See gstat documentation for description of the formula interface (see ?gstat::gstat).

location_formula

Formula to use for location argument to gstat. See gstat documentation for description of the formula interface (see ?gstat::gstat).

nm

Maximum number of nearest neighbor observations to use for interpolation.

vgm_width

Optional. Width of variogram breaks.

estimate_anisotropy

Logical indicating whether anisotropy should be estimated for kriging methods based on k-fold cross validation. Default = FALSE

anisotropy_kfold

1L numeric vector indicating how many folds to use for cross-validation if estimate_anisotropy = TRUE.

seed

RNG seed (set.seed(seed)) to use for anisotropy estimation based on cross-validation.

anisotopy_parameters

Optional. Anisotropy parameters to use for ordinary kriging as a 2L vector for 2D kriging or 5L vector for 3D kriging. See: ?gstat::vgm. If NULL and estimate_anisotropy, anisotropy is estimated.

interplation_methods

Interpolation methods to use. Valid options are nearest-neighbor, inverse distance weighting, inverse distance weighting using the closest nm stations (idw_nmax), and kriging with and exponential (exp), circular (cir), gaussian (gau), Bessel (bes), Matern (mat), or Stein's Matern (ste) variogram model.


afsc-gap-products/coldpool documentation built on Feb. 25, 2024, 9:44 p.m.