evaluate_models {stgam} | R Documentation |
Creates and evaluates multiple varying coefficient GAM GP smooth models (SVC or STVC)
Description
Creates and evaluates multiple varying coefficient GAM GP smooth models (SVC or STVC)
Usage
evaluate_models(
input_data,
target_var = "privC",
covariates = c("unemp", "pubC"),
coords_x = "X",
coords_y = "Y",
STVC = FALSE,
time_var = NULL,
ncores = 2
)
Arguments
input_data |
a |
target_var |
the name of the target variable in |
covariates |
the name of the covariates (predictor variables) in |
coords_x |
the name of the X, Easting or Longitude variable in |
coords_y |
the name of the Y, Northing or Latitude variable in |
STVC |
a logical operator to indicate whether the models Space-Time ( |
time_var |
the name of the time variable if undertaking STVC model evaluations |
ncores |
the number of cores to use in parallelised approaches (default is 2 to overcome CRAN package checks). This can be determined for your computer by running |
Value
A data table in data.frame
format of all possible model combinations with each covariate specified in all possible ways, with the BIC of the model and the model formula.
Examples
library(dplyr)
library(glue)
library(purrr)
library(doParallel)
library(mgcv)
data("productivity")
input_data = productivity |> filter(year == "1970")
svc_res_gam =
evaluate_models(input_data = input_data,
target_var = "privC",
covariates = c("unemp", "pubC"),
coords_x = "X",
coords_y = "Y",
STVC = FALSE)
head(svc_res_gam)