gstat.cv(object, nfold, remove.all = FALSE, verbose = FALSE,
all.residuals = FALSE, ...)
krige.cv(formula, locations, data, model = NULL, ..., beta = NULL, nmax = Inf,
nmin = 0, maxdist = Inf, nfold = nrow(data), verbose = FALSE)
nfold
is set
to nrow(data)
(the default), leave-one-out cross validation is
done; if set to e.g. 5, five-fold cross validation is donegstat.cv
, or to gstat in case of krige.cv
z
, for ordinary and simple kriging use the formula z~1
;
for simple kriging also define be
~x+y
; if data
is of class spatial.data.frame
, this argument may be ignored, as
it can be derived from the datamaxdist
is less than nmin
, a missing
value will be generated; see maxdistmaxdist
from the prediction location are used for prediction
or simulation; if combined with nmax
, both criteria applydata
or those
of the first variable in object
, and columns of prediction and
prediction variance of cross validated data points, observed values,
residuals, zscore (residual divided by kriging standard error), and fold.If all.residuals
is true, a data frame with residuals for all
variables is returned, without coordinates.
data(meuse)
m <- vgm(.59, "Sph", 874, .04)
# five-fold cross validation:
x <- krige.cv(log(zinc)~1, ~x+y, model = m, data = meuse, nmax = 40, nfold=5)
bubble(x, z = "residual", main = "log(zinc): 5-fold CV residuals")
Run the code above in your browser using DataLab