plot_ROC: plot_ROC

Description Usage Arguments Value Examples

View source: R/plot_ROC.R

Description

Returns a plot showing the ROC curve of one or more models compared to the null model

#' Note: Predictions should be annualised (independent of exposure)

Usage

1
plot_ROC(actual, predicted, weight = NULL, na.rm = FALSE, use_plotly = TRUE)

Arguments

actual

Array[Numeric] - 0 or 1 - Values we are aiming to predict.

predicted

Array[Numeric] / DataFrame[Numeric] - Between 0 and 1 - Values that we have predicted.

weight

Optional: Array[Numeric] - Weighting of predictions. If NULL even weighting is used.

na.rm

logical. Should missing values be removed?

use_plotly

Optional: boolean - If TRUE plotly object is returned else ggplot2 object

Value

plotly object of showing ROC curve for all predictions given

Examples

1
2
3
4
5
data <- data.frame(x1=runif(100), x2=runif(100), noise=rnorm(100, sd=0.2)) %>%
  mutate(target=ifelse(x1 + noise>0.5, 1, 0))

plot_ROC(actual=data$target, predicted=data$x1)
plot_ROC(actual=data$target, predicted=data[c("x1","x2")])

gloverd2/admr documentation built on Dec. 2, 2020, 11:16 p.m.