fit_multiple_gams.Rd
This function fits multiple generalized additive models (GAMs) using the
fit_gam_safely()
function. GAMs are fitted
to each dataset defined by the group_var
argument in the input
data_source
data frame. The number of models fitted is equal to the
number of unique levels of the group_var
. The function returns a data
frame with one row per group, including the original group identifier and the
fitted GAM model for that group.
fit_multiple_gams(
data_source,
x_var = "age",
y_var = "var",
group_var = "dataset_id",
smooth_basis = c("tp", "cr"),
error_family = "gaussian(link = 'identity')",
weights_var = NULL,
max_k = 10,
max_iterations = 200,
verbose = TRUE
)
Data frame with x_var
, y_var
, and group_var
Character. Name of the X-variable
Character. Name of the Y-variable
Character. Name of the variable used for identification of groups.
Character. Name of the Smooth basis to use
Character. Name of the error family to be used
Character. Name of the variable to use as weights
Maximum k
which can be used
Numeric. Maximum number of iterations for GAM to try.
Logical. Should additional messages be output?
A data frame containing the original grouping variable and the corresponding fitted GAM model for each group.