gos {geosimilarity} | R Documentation |
Geographically optimal similarity
Description
Function for geographically optimal similarity (GOS) model
Usage
gos(formula, data = NULL, newdata = NULL, kappa = 0.25)
Arguments
formula |
A formula of GOS model |
data |
A data.frame of observation data |
newdata |
A data.frame of prediction variables data |
kappa |
A numeric value of the percentage of observation locations with high similarity to a prediction location. kappa = 1 - tau, where tau is the probability parameter in quantile operator. The default kappa is 0.25, meaning that 25 location are used for modelling. |
Value
A list of predictions and uncertainties.
Examples
data("zn")
# log-transformation
hist(zn$Zn)
zn$Zn <- log(zn$Zn)
hist(zn$Zn)
# remove outliers
require(SecDim)
k <- rmvoutlier(zn$Zn, coef = 2.5)
dt <- zn[-k,]
# split data for validation: 70% training; 30% testing
split <- sample(1:nrow(dt), round(nrow(dt)*0.7))
train <- dt[split,]
test <- dt[-split,]
system.time({ # 0.33s
g1 <- gos(Zn ~ Slope + Water + NDVI + SOC + pH + Road + Mine,
data = train, newdata = test, kappa = 0.25)
})
test$pred <- g1$pred
plot(test$Zn, test$pred)
cor(test$Zn, test$pred)
[Package geosimilarity version 2.2 Index]