fit_gam_safely.RdA wrapper function for fit_custom_gam. The kis compared to
the number of samples and to the max_k. If there is a zero variability in
the term, lm is fitted instead. If no model was cretaed (due to errors),
the function retun NA_real
fit_gam_safely(
data_source,
x_var = "age",
y_var = "var",
smooth_basis = c("tp", "cr"),
error_family = "gaussian(link = 'identity')",
weights_var = NULL,
sel_k = 10,
max_k = 10,
max_iterations = 200,
verbose = FALSE
)Data.frame with columns whose names are set by y_var and
x_var
Character. Name of the X-variable
Character. Name of the Y-variable
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
Preferred k (wiggliness)
Maximum k which can be used
Numeric. Maximum number of iterations for GAM to try.
Logical. Should additional messages be output?