Skip to contents

Leave-one-out, or by the integer fold labels folds: each fold is predicted by Krige from the others. Returns predictions, variances, observed values, residuals (observed minus predicted), z-scores, RMSE, MAE, mean error and mean squared z-score.

Usage

KrigeCV(
  z,
  coords,
  model,
  X = NULL,
  beta = NULL,
  folds = NULL,
  nmax = NULL,
  maxdist = NULL
)

Arguments

z

Observations.

coords

Matrix of locations (any dimension).

model

Covariance model (KrigingCovariance).

X

Trend design at the data.

beta

Known trend coefficients (simple kriging).

folds

Fold labels (default leave-one-out).

nmax

Maximum number of nearest neighbours.

maxdist

Maximum neighbour distance.

Value

List of cross-validation results.

Examples

m <- list(model = "Sph", psill = 1, range = 3)
KrigeCV(c(1, 2, 1.5, 1.2, 0.7), rbind(c(0, 0), c(1, 0), c(0, 1), c(1, 1), c(2, 2)), m)$rmse
#> [1] 0.6418898