Skip to contents

Thin extender over gstat::krige for simple, ordinary or universal kriging given a fitted variogram model.

Usage

morie_geostat_krige(formula, data, newdata, model, ...)

Arguments

formula

A formula describing the response and trend terms (e.g. z ~ 1 for ordinary kriging), as expected by gstat::krige.

data

Spatial object with the observed locations and response.

newdata

Spatial object with the prediction locations.

model

A fitted variogram model (e.g. from gstat::fit.variogram) describing the spatial covariance.

...

Further arguments forwarded to gstat::krige (e.g. nmax, nmin, block, beta, debug.level).

Value

A list with $method = "gstat::krige" and $raw (a spatial object with kriging predictions and variances).

Examples

if (FALSE) { # \dontrun{
  if (requireNamespace("gstat", quietly = TRUE) &&
      requireNamespace("sp", quietly = TRUE)) {
    data(meuse, package = "sp")
    data(meuse.grid, package = "sp")
    sp::coordinates(meuse) <- ~ x + y
    sp::coordinates(meuse.grid) <- ~ x + y
    vg <- gstat::variogram(log(zinc) ~ 1, data = meuse)
    mod <- gstat::fit.variogram(vg, gstat::vgm(1, "Sph", 900, 1))
    morie_geostat_krige(log(zinc) ~ 1, meuse, meuse.grid, mod)
  }
} # }