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.
Arguments
- data
dataframe. All the variables in
datawill be used to predicty_col. To exclude any variables, assign asdataonly the subset of variables desired.- y_col
character(1). Name of the y outcome variable.
- ...
Arguments passed on to
mgcv::gam().- bs
character(1). The default basis function for GAM smooths. See
?mgcv::smooth.termsfor details. Whereas the defaultbsinmgcvis 'tp',autogam's default is 'cr', which is much faster and comparably accurate.
Value
Returns an mgcv::gam object, the result of predicting y_col from all other variables in data.
Examples
autogam(mtcars, 'mpg')
#> Detecting distribution of `mpg`...
#>
#> ✔ GAM successfully fit with 90.6% standardized accuracy.
#>
#>
#> Family: gaussian
#> Link function: identity
#>
#> Formula:
#> mpg ~ cyl + s(disp, bs = "cr") + s(hp, bs = "cr") + s(drat, bs = "cr") +
#> s(wt, bs = "cr") + s(qsec, bs = "cr") + vs + am + gear +
#> s(carb, k = 3, bs = "cr")
#>
#> Estimated degrees of freedom:
#> 5.45 1.00 1.79 1.00 1.00 1.00 total = 16.24
#>
#> fREML score: 49.8224
#>
#> MAE: 0.883; Std. accuracy: 90.6%