| GeoCV | R Documentation |
The procedure uses the GeoKrig or GeoKrigloc
function to compute n-fold kriging cross-validation using information from a
GeoFit object. The function returns prediction scores.
GeoCV(
fit, K = 100, estimation = TRUE,
optimizer = NULL, lower = NULL, upper = NULL,
n.fold = 0.05, local = FALSE,
neighb = NULL, maxdist = NULL, maxtime = NULL,
sparse = FALSE, type_krig = "Simple", which = 1,
parallel = TRUE, ncores = NULL, progress = TRUE,
seed = NULL
)
fit |
An object of class |
K |
The number of iterations in cross-validation. |
estimation |
Logical; if |
optimizer |
The type of optimization algorithm if |
lower |
An optional named list giving the values for the lower bounds of
the parameters when bounded optimization is used and |
upper |
An optional named list giving the values for the upper bounds of
the parameters when bounded optimization is used and |
n.fold |
Numeric; the percentage of data to be deleted and predicted in each cross-validation iteration. |
local |
Logical; if |
neighb |
Numeric; an optional positive integer indicating the order of neighborhood if local kriging is performed. |
maxdist |
Numeric; an optional positive value indicating the spatial neighborhood distance if local kriging is performed. |
maxtime |
Numeric; an optional positive value indicating the temporal neighborhood distance if local kriging is performed. |
sparse |
Logical; if |
type_krig |
String; the type of kriging. If |
which |
Numeric; in the case of bivariate cokriging, it indicates which
variable to predict. It can be |
parallel |
Logical; if |
ncores |
Numeric; number of cores involved in parallelization. |
progress |
Logical; if |
seed |
Optional integer seed used to make the random selection of folds and
any stochastic refitting step reproducible. If |
The function randomly removes a fraction n.fold of the observations at
each iteration, predicts the removed observations using kriging, and computes a
set of predictive scores.
If estimation = TRUE, the model is re-estimated at each cross-validation
iteration before prediction. Otherwise, the parameter estimates contained in
fit are used.
When seed is supplied, the cross-validation folds are reproducible. The
function preserves and restores the user's random number generator state.
Returns a list containing the following components:
rmse |
The vector of root mean squared errors. |
mae |
The vector of mean absolute errors. |
mad |
The vector of median absolute errors. |
brie |
The vector of Brier scores. |
crps |
The vector of continuous ranked probability scores. |
lscore |
The vector of log-scores. |
pit |
The vector of average probability integral transform values. |
intscore |
The vector of interval scores. |
coverage |
The vector of empirical coverage values. |
seed |
The seed used for reproducibility, or |
Moreno Bevilacqua, moreno.bevilacqua89@gmail.com, https://sites.google.com/view/moreno-bevilacqua/home, Víctor Morales Oñate, victor.morales@uv.cl, https://sites.google.com/site/moralesonatevictor/, Christian Caamaño-Carrillo, chcaaman@ubiobio.cl, https://www.researchgate.net/profile/Christian-Caamano
GeoKrig, GeoKrigloc, GeoFit.
library(GeoModels)
###############################################################
### Example of spatial kriging cross-validation
###############################################################
model <- "Gaussian"
set.seed(79)
x <- runif(400, 0, 1)
y <- runif(400, 0, 1)
coords <- cbind(x, y)
corrmodel <- "GenWend"
mean <- 0
sill <- 5
nugget <- 0
scale <- 0.2
smooth <- 0
power2 <- 4
param <- list(
mean = mean, sill = sill, nugget = nugget,
scale = scale, smooth = smooth, power2 = power2
)
data <- GeoSim(coordx = coords, corrmodel = corrmodel,
param = param)$data
fixed <- list(nugget = nugget, smooth = 0, power2 = power2)
start <- list(mean = 0, scale = scale, sill = 1)
I <- Inf
lower <- list(mean = -I, scale = 0, sill = 0)
upper <- list(mean = I, scale = I, sill = I)
fit <- GeoFit(
data, coordx = coords, corrmodel = corrmodel,
model = model, likelihood = "Marginal", type = "Pairwise",
neighb = 3, optimizer = "nlminb", lower = lower,
upper = upper, start = start, fixed = fixed
)
#a <- GeoCV(fit, K = 100, estimation = TRUE,
# parallel = TRUE, seed = 123)
#mean(a$rmse)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.