A wrapper function for mgcv::gam to help fit GAM models functionally.

fit_custom_gam(
  x_var = "age",
  y_var = "var",
  error_family = "gaussian(link = 'identity')",
  smooth_basis = c("tp", "cr"),
  data_source,
  weights_var = NULL,
  sel_k = 10,
  max_iterations = 200,
  verbose = FALSE
)

Arguments

x_var

Character. Name of the X-variable

y_var

Character. Name of the Y-variable

error_family

Character. Name of the error family to be used

smooth_basis

Character. Name of the Smooth basis to use

data_source

Data.frame with columns whose names are set by y_var and x_var

weights_var

Character. Name of the variable to use as weights

sel_k

Numeric. Define k (wiggliness)

max_iterations

Numeric. Maximum number of iterations for GAM to try.

verbose

Logical. Should additional messages be output?

Value

Fitted GAM model

See also