Skip to contents

Computes a univariate random forest model with weighted cases via \link[ranger]{ranger} and returns the Area Under the Curve on the out-of-bag data.

Usage

f_rf_auc_unbalanced(x, y, df)

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'.

Value

Area Under the Curve

Examples


data(vi)

#subset to limit example run time
vi <- vi[1:1000, ]

#this example requires "ranger" installed in the system
if(requireNamespace(package = "ranger", quietly = TRUE)){

  f_rf_auc_unbalanced(
    x = "growing_season_length", #predictor
    y = "vi_binary",               #response
    df = vi
  )

}
#> [1] 0.9158895