fit_hgam.Rd
Fit a hierarchical GAM model with/without a single common
smoother (common_trend
) plus group-level smoothers with differing
wiggliness (random effect). If there is less number of groups in the dataset
than 2, a normal GAM model will be fitted. This function is a wrapper for
complex mgcv::bam()
.
If use_parallel
is TRUE
, the number of cores is automatically detected.
fit_hgam(
x_var = "age",
y_var = "var",
group_var = "dataset_id",
error_family = "gaussian(link = 'identity')",
weights_var = NULL,
smooth_basis = c("tp", "cr"),
data_source,
sel_k = 10,
sel_m = NULL,
common_trend = TRUE,
use_parallel = TRUE,
use_discrete = FALSE,
max_iterations = 200,
verbose = TRUE
)
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 error family to be used
Character. Name of the variable to use as weights
Character. Name of the Smooth basis to use
Data.frame with columns whose names are set by y_var
and
x_var
Numeric. Define k
(wiggliness)
Numeric. The user specifies the order of the penalty for this
term. if NULL
, the function will use 1
or 2
depending on the presence
of common trend.
Logical. Should hGAM have a common shared trend?
Logical. Should computation use parallel?
Logical. Should the discrete
argument be used for
parallel computation?
Numeric. Maximum number of iterations for GAM to try.
Logical. Should additional messages be output?
Fitted hGAM model