View source: R/helper_vimpute.R
| build_gam_formula | R Documentation |
Constructs a formula for mgcv::gam() by wrapping numeric predictors with sufficient unique values in s() terms and keeping factors as linear terms.
build_gam_formula(target, features, data, min_unique = 4L, default_k = 10L)
target |
Character: target variable name |
features |
Character vector: predictor variable names |
data |
Data frame used to check variable types and unique value counts |
min_unique |
Integer: minimum number of unique values for a numeric predictor to be wrapped in s(). Default 4 (mgcv needs at least k=3 knots). |
A formula object suitable for mgcv::gam()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.