gos_bestkappa {geosimilarity} | R Documentation |
function for the best kappa parameter
Description
Computationally optimized function for determining the best kappa parameter for the optimal similarity
Usage
gos_bestkappa(
formula,
data = NULL,
kappa = seq(0.05, 1, 0.05),
nrepeat = 10,
nsplit = 0.5,
cores = 1
)
Arguments
formula |
A formula of GOS model. |
data |
A |
kappa |
(optional) A numeric value of the percentage of observation locations
with high similarity to a prediction location. |
nrepeat |
(optional) A numeric value of the number of cross-validation training times.
The default value is |
nsplit |
(optional) The sample training set segmentation ratio,which in |
cores |
(optional) Positive integer. If cores > 1, a |
Value
A list.
bestkappa
the result of best kappa
cvrmse
all RMSE calculations during cross-validation
cvmean
the average RMSE corresponding to different kappa in the cross-validation process
plot
the plot of rmse changes corresponding to different kappa
References
Song, Y. (2022). Geographically Optimal Similarity. Mathematical Geosciences. doi: 10.1007/s11004-022-10036-8.
Examples
data("zn")
# log-transformation
hist(zn$Zn)
zn$Zn <- log(zn$Zn)
hist(zn$Zn)
# remove outliers
k <- removeoutlier(zn$Zn, coef = 2.5)
dt <- zn[-k,]
# determine the best kappa
system.time({
b1 <- gos_bestkappa(Zn ~ Slope + Water + NDVI + SOC + pH + Road + Mine,
data = dt,
kappa = c(0.01, 0.1, 1),
nrepeat = 1,
cores = 1)
})
b1$bestkappa
b1$plot