AUC of Logistic GAM Model
f_gam_auc_balanced.Rd
Fits a binomial logistic Generalized Additive Model (GAM) y ~ s(x, k = 3)
between a binary response and a numeric predictor and returns the Area Under the Curve of the observations versus the predictions.
Arguments
- x
(required, character string) name of the predictor variable.
- y
(required, character string) name of the binary response variable.
- df
(required, data frame) data frame with the columns 'x' and 'y'.
Examples
data(vi)
#subset to limit example run time
vi <- vi[1:1000, ]
#this example requires "mgcv" installed
if(requireNamespace(package = "mgcv", quietly = TRUE)){
f_gam_auc_balanced(
x = "growing_season_length", #predictor
y = "vi_binary", #response
df = vi
)
}
#> [1] 0.9367964