georobvalidate.predictions.## S3 method for class 'georob':
cv(object, formula = NULL, subset = NULL,
method = c("block", "random"), nset = 10,
seed = NULL, sets = NULL, duplicates.in.same.set = TRUE,
re.estimate = TRUE, param = object[["param"]],
fit.param = object[["initial.objects"]][["fit.param"]],
aniso = object[["aniso"]][["aniso"]],
fit.aniso = object[["initial.objects"]][["fit.aniso"]],
return.fit = FALSE, reduced.output = TRUE, lgn = FALSE,
mfl.action = c("offset", "stop"),
ncores = min(nset, detectCores()), verbose = 0, ...)"georob", see
georobObject.blocks by kmeans
(default) or randomly. Ignored if sets is
non-NULLnset = 10). Ignored
if sets is non-NULL.set.seed. Ignored if sets is non-NULL.sets = NULL (defauTRUE).TRUE, default) or whether the model passed in object is
used to compute the predictions for the omitted oFALSE).FALSE) or only some components (TRUE, default, see
Value). Ignored if return.fit = FALSE.FALSE)."stop") or treats the respective
factors as model offset ("offset", decv.georob, which is a list with the two
components pred and fit.
pred is a data frame with the coordinates and the
cross-validation prediction results with the following variables:lgn = TRUE then pred has the additional variables:fit contains either the full outputs of
georob, fitted for the $K$ reduced data sets
(reduced.output = FALSE), or $K$ lists with the components
tuning.psi, converged,
convergence.code,
gradient, variogram.model, param,
aniso[["aniso"]], coefficients along with the standard errors of
$\widehat{\mbox{\boldmath$\beta$\unboldmath}}$, see
georobObject.data
argument to georob must exist in the user workspace
when calling cv.georob.
cv.georob then uses the package detectCores).
cv.georob uses the function update to
re-estimated the model with the reduced data sets. Therefore, any
argument accepted by georob can be changed when re-fitting
the model. Some of them (e.g. formula, subset, etc.) are
explicit arguments of cv.georob, but also the remaining ones can
be passed by ... to the function.
Practitioners in geostatistics commonly cross-validate a fitted model
without re-estimating the model parameters with the reduced data sets.
This is clearly an unsound practice (see Hastie et al., 2009, sec.
7.10). Therefore, the argument re.estimate should always be set
to TRUE. The alternative is provided only for historic reasons.validate.predictions for computing statistics of the cross-validation errors;
georob for (robust) fitting of spatial linear models;
georobObject for a description of the class georob;
predict.georob for computing robust kriging predictions.data(meuse)
r.logzn <- georob(log(zinc) ~ sqrt(dist), data = meuse, locations = ~ x + y,
variogram.model = "RMexp",
param = c(variance = 0.15, nugget = 0.05, scale = 200),
tuning.psi = 1)
r.logzn.cv.1 <- cv(r.logzn, seed = 1, lgn = TRUE)
r.logzn.cv.2 <- cv(r.logzn, formula = .~. + ffreq, seed = 1, lgn = TRUE)
plot(r.logzn.cv.1, type = "bs")
plot(r.logzn.cv.2, type = "bs", add = TRUE, col = "red")
legend("topright", lty = 1, col = c("black", "red"), bty = "n",
legend = c("log(Zn) ~ sqrt(dist)", "log(Zn) ~ sqrt(dist) + ffreq"))Run the code above in your browser using DataLab