Learn R Programming

GSIF (version 0.5-5.1)

predict.gstatModel-method: Predict from an object of class "gstatModel"

Description

Predicts from an object of class gstatModel-class using new prediction locations. The function combines predictions by regression (e.g. GLM) and interpolation of residuals (kriging) via the Regression-Kriging (RK) or Kriging with External Drift (KED, also known as Universal Kriging) framework.

Usage

# S4 method for gstatModel
predict(object, 
     predictionLocations, nmin = 10, nmax = 30, debug.level = -1, 
     predict.method = c("RK", "KED"), nfold = 5, verbose = FALSE, 
     nsim = 0, mask.extra = TRUE, block, 
     zmin = -Inf, zmax = Inf, subsample = length(object@sp), 
     coarsening.factor = 1, vgmmodel = object@vgmModel,
     subset.observations = !is.na(object@sp@coords[,1]), betas = c(0,1), extend = .5, …)
# S4 method for list
predict(object, 
     predictionLocations, nmin = 10, nmax = 30, debug.level = -1, 
     predict.method = c("RK", "KED"), nfold = 5, verbose = FALSE, 
     nsim = 0, mask.extra = TRUE, block, 
     zmin = -Inf, zmax = Inf, subsample = length(object@sp), …)

Arguments

object

object of type "gstatModel"

predictionLocations

object of type "SpatialPixelsDataFrame" prediction locations (must contain all covariates from the model)

nmin

integer; minimum number of nearest observations sent to gstat::krige

nmax

integer; maximum number of nearest observations sent to gstat::krige

debug.level

integer; default debug level mode sent to gstat::krige

predict.method

character; mathematical implementation of the gstat::krige interpolation method with covariates: Regression-Kriging (RK) or Kriging with External Drift (KED)

nfold

integer; n-fold cross validation sent to gstat::krige.cv

verbose

logical; specifies whether to supress the progress bar of the gstat::krige.cv

nsim

integer; triggers the geostatistical simulations

mask.extra

logical; specifies whether to mask out the extrapolation pixels (prediction variance exceeding the global variance)

block

numeric; support size (block support for objects of type "SpatialPixelsDataFrame" is chosen by default)

zmin

numeric; lower physical limit for the target variable

zmax

numeric; upper physical limit for the target variable

subsample

integer; sub-sample point observations to speed up the processing

coarsening.factor

integer; coarsening factor (1:5) to speed up the processing

vgmmodel

object of class data.frame corresponding to the gstat::vgm variogram

subset.observations

logical; vector specifying the subset of observations used for interpolation

extend

numeric; fraction of the range for which the spatial domain should be extended when searching for observations for kriging

betas

numeric; vector of the beta coefficients to be passed to the gstat::krige

other optional arguments that can be passed to gstat::krige and/or predict.glm

Details

Selecting predict.method = "KED" invokes simple kriging with external drift with betas set at 0 (intercept) and 1 (regression predictions used as the only covariate). This assumes that the regression model already results in an unbiased estimator of the trend model. If not speficied otherwise, subset.observations by default selects only obserations within the spatial domain (bounding box) of the predictionLocations plus 50% of the one third of the extent of the area (extend). In the case of spatial duplicates in 2D or 3D, subset.observations will automatically remove all duplicates before running kriging. All points in 3D that stand exactly above each other will be removed by default. Predictions can be speed up by using a larger coarsening.factor e.g. 2 to 5, in which case the ordinary kriging on residuals will run at a coarser resolution, and the output would be then downscaled to the original resolution using splines (via the warp method). In the case of predict.method = RK, the kriging variance is derived as a sum of the GLM variance and the OK variance, which is statistically sub-optimal.

References

See Also

gstatModel-class, fit.gstatModel