Skip to contents

These functions take a data frame with a binomial response "y" with unique values 1 and 0, and a continuous predictor "x", fit a univariate model, to return the Area Under the ROC Curve (AUC) of observations versus predictions:

  • f_auc_glm_binomial(): AUC of a binomial response against the predictions of a GLM model with formula y ~ x, family stats::quasibinomial(link = "logit"), and weighted cases (see case_weights()) to control for unbalanced data.

  • f_auc_glm_binomial_poly2(): AUC of a binomial response against the predictions of a GLM model with formula y ~ stats::poly(x, degree = 2, raw = TRUE), family stats::quasibinomial(link = "logit"), and weighted cases (see case_weights()) to control for unbalanced data.

  • f_auc_gam_binomial(): AUC of a GAM model with formula y ~ s(x), family stats::quasibinomial(link = "logit"), and weighted cases.

  • f_auc_rpart(): AUC of a Recursive Partition Tree with weighted cases.

  • f_auc_rf(): AUC of a Random Forest model with weighted cases.

Usage

f_auc_glm_binomial(df)

f_auc_glm_binomial_poly2(df)

f_auc_gam_binomial(df)

f_auc_rpart(df)

f_auc_rf(df)

Arguments

df

(required, data frame) with columns:

  • "x": (numeric) continuous predictor.

  • "y" (integer) binomial response with unique values 0 and 1.

See also

Other preference_order_functions: f_r2, f_r2_counts, f_v(), f_v_rf_categorical()

Other preference_order_functions: f_r2, f_r2_counts, f_v(), f_v_rf_categorical()

Other preference_order_functions: f_r2, f_r2_counts, f_v(), f_v_rf_categorical()

Other preference_order_functions: f_r2, f_r2_counts, f_v(), f_v_rf_categorical()

Other preference_order_functions: f_r2, f_r2_counts, f_v(), f_v_rf_categorical()

Other preference_order_functions: f_r2, f_r2_counts, f_v(), f_v_rf_categorical()

Examples

#load example data
data(vi)

#reduce size to speed-up example
vi <- vi[1:1000, ]

#integer counts response and continuous predictor
#to data frame without NAs
df <- data.frame(
  y = vi[["vi_binomial"]],
  x = vi[["swi_max"]]
) |>
  na.omit()

#AUC of GLM with binomial response and weighted cases
f_auc_glm_binomial(df = df)
#> [1] 0.7574154

#AUC of GLM as above plus second degree polynomials
f_auc_glm_binomial_poly2(df = df)
#> [1] 0.8152208

#AUC of binomial GAM with weighted cases
f_auc_gam_binomial(df = df)
#> [1] 0.8185645

#AUC of recursive partition tree with weighted cases
f_auc_rpart(df = df)
#> [1] 0.8093201

#AUC of random forest with weighted cases
f_auc_rf(df = df)
#> [1] 0.892244