Skip to contents

autogam() is a wrapper for 'mgcv::gam()' that makes it easier to create high-performing Generalized Additive Models (GAMs). By entering just a dataset and the name of the outcome column as inputs, autogam() tries to automate the procedure of configuring a highly accurate GAM which performs at reasonably high speed, even for large datasets.

Usage

autogam(data, y_col, ...)

Arguments

data

dataframe. All the variables in data will be used to predict y_col. To exclude any variables, assign as data only the subset of variables desired.

y_col

character(1). Name of the y outcome variable.

...

Arguments passed on to mgcv::gam().

Value

Returns an mgcv::gam object, the result of predicting y_col from all other variables in data.

Examples

autogam(mtcars, 'mpg')
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> Formula:
#> mpg ~ cyl + s(disp) + s(hp) + s(drat) + s(wt) + s(qsec) + vs + 
#>     am + gear + s(carb, k = 3)
#> 
#> Estimated degrees of freedom:
#> 1.00 8.74 1.99 1.76 8.90 1.78  total = 29.18 
#> 
#> GCV score: 1.727942     
#> 
#> MAE: 0.082; Std. accuracy: 99.2%