if (FALSE) {
require(dplyr)
require(doParallel)
require(sf)
# define input data
data("chaco")
input_data <-
chaco |>
# create Intercept as an addressable term
mutate(Intercept = 1) |>
# remove the geometry
st_drop_geometry()
# evaluate different model forms
# example 1 with 6 models and no `k` adjustment
svc_mods <-
evaluate_models(
input_data = input_data,
target_var = "ndvi",
model_family = "gaussian()",
vars = c("tmax"),
coords_x = "X",
coords_y = "Y",
VC_type = "SVC"
)
# have a look!
svc_mods
# example 2 with 6 models and `k` adjustment
svc_k1_mods <-
evaluate_models(
input_data = input_data,
target_var = "ndvi",
vars = c("tmax"),
model_family = "gaussian()",
coords_x = "X",
coords_y = "Y",
VC_type = "SVC",
k_increase = TRUE,
k2edf_ratio = 1.5,
k_multiplier = 2,
max_iter = 10
)
# have a look!
svc_k1_mods
# example 3 with 6 models and `k` set by user
svc_k2_mods <-
evaluate_models(
input_data = input_data,
model_family = "gaussian()",
target_var = "ndvi",
vars = c("tmax"),
coords_x = "X",
coords_y = "Y",
VC_type = "SVC",
time_var = NULL,
k_set = TRUE,
spatial_k = 20,
)
# have a look!
svc_k2_mods
}
Run the code above in your browser using DataLab