Title: | Automate the Creation of Generalized Additive Models (GAMs) |
Version: | 0.1.0 |
Language: | en-US |
Description: | This wrapper package for 'mgcv' makes it easier to create high-performing Generalized Additive Models (GAMs). With its central function autogam(), 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. |
License: | MIT + file LICENSE |
Config/testthat/edition: | 3 |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
Depends: | R (≥ 4.2.0) |
Imports: | cli, dplyr, methods, mgcv, purrr, rlang, staccuracy, stats, stringr, univariateML |
Suggests: | testthat (≥ 3.0.0) |
URL: | https://github.com/tripartio/autogam, https://tripartio.github.io/autogam/ |
BugReports: | https://github.com/tripartio/autogam/issues |
NeedsCompilation: | no |
Packaged: | 2025-02-24 17:45:53 UTC; chitu.okoli |
Author: | Chitu Okoli |
Maintainer: | Chitu Okoli <Chitu.Okoli@skema.edu> |
Repository: | CRAN |
Date/Publication: | 2025-02-24 19:20:06 UTC |
Automate the Creation of Generalized Additive Models (GAMs)
Description
This wrapper package for 'mgcv' makes it easier to create high-performing Generalized Additive Models (GAMs). With its central function autogam(), 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.
Author(s)
Chitu Okoli Chitu.Okoli@skema.edu
See Also
Useful links:
Report bugs at https://github.com/tripartio/autogam/issues
Automate the creation of a Generalized Additive Model (GAM)
Description
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, ..., bs = "cr")
Arguments
data |
dataframe. All the variables in |
y_col |
character(1). Name of the y outcome variable. |
... |
Arguments passed on to |
bs |
character(1). The default basis function for GAM smooths. See |
Value
Returns an mgcv::gam
object, the result of predicting y_col
from all other variables in data
.
Examples
autogam(mtcars, 'mpg')
Generic autogam methods passed on to mgcv::gam methods
Description
An autogam
object contains a gam
element that is simply an mgcv::gam
object. So, it supports all mgcv::gam
methods by, in most cases, simply passing the gam
element on to their corresponding mgcv::gam
methods. Only the following methods have special specifications for autogam (see their dedicated documentation files for details): print.autogam()
.
Usage
## S3 method for class 'autogam'
anova(object, ...)
## S3 method for class 'autogam'
coef(object, ...)
## S3 method for class 'autogam'
cooks.distance(model, ...)
## S3 method for class 'autogam'
formula(x, ...)
## S3 method for class 'autogam'
influence(model, ...)
## S3 method for class 'autogam'
logLik(object, ...)
## S3 method for class 'autogam'
model.matrix(object, ...)
## S3 method for class 'autogam'
predict(object, ...)
## S3 method for class 'autogam'
residuals(object, ...)
## S3 method for class 'autogam'
vcov(object, ...)
Arguments
object , model |
An object of class |
... |
other arguments |
x |
formula |
Value
Returns the return object of the corresponding mgcv::gam
method.
Plot Method for autogam Objects
Description
This function plots an autogam
object. It calls the mgcv::gam
object mgcv::plot.gam()
method.
Usage
## S3 method for class 'autogam'
plot(x, ...)
Arguments
x |
An object of class |
... |
Additional arguments passed to other methods. |
Value
Same return object as mgcv::print.gam()
.
Print Method for autogam Objects
Description
This function prints an autogam
object. It calls the mgcv::gam
object print()
method and then adds basic performance metrics from the autogam
object:
For models that predict numeric outcomes, it prints "MAE", the mean absolute error, and "Std. accuracy", the standardized accuracy (staccuracy) of the winsorized MAE relative to the mean absolute deviation.
For models that predict binary outcomes, it prints "AUC", the area under the ROC curve.
Usage
## S3 method for class 'autogam'
print(x, ...)
Arguments
x |
An object of class |
... |
Additional arguments passed to other methods. |
Value
Invisibly returns the input object x
.
Create a character string for a mgcv::gam formula
Description
Create a character string that wraps appropriate variables in a dataframe with s()
smooth functions. Based on the datatype of each variable, it determines whether it is a numeric variable to be smoothed:
Non-numeric: no smoothing.
Numeric: determine knots based on the number of unique values for that variable:
-
<= 4
: no smoothing -
5 to 19
(inclusive): smooth function with knots equal to the floored half of the number of unique values. E.g., 6 unique values receive 3 knots, 7 will receive 3 knots, and 8 will receive 4 knots. -
>= 20
: smooth function with no specified number of knots, allowing thegam()
function to detect the appropriate number.
-
Usage
smooth_formula_string(
data,
y_col,
smooth_fun = "s",
bs = "cr",
expand_parametric = TRUE
)
Arguments
data |
dataframe. All the variables in |
y_col |
character(1). Name of the y outcome variable. |
smooth_fun |
character(1). Function to use for smooth wraps; default is 's' for the |
bs |
See documentation for |
expand_parametric |
logical(1). If |
Value
Returns a single character string that represents a formula with y_col
on the left and all other variables in data
on the right, each formatted with an appropriate s()
function when applicable.
Examples
smooth_formula_string(mtcars, 'mpg')
Summary Method for autogam Objects
Description
This function returns a summary of an autogam
object. It calls the mgcv::gam
object mgcv::summary.gam()
method.
Usage
## S3 method for class 'autogam'
summary(object, ...)
Arguments
object |
An object of class |
... |
Additional arguments passed to other methods. |
Value
Same return object as mgcv::summary.gam()
.