roc_plot | R Documentation |
roc_plot
roc_plot(
data,
fitted,
actual,
group = NULL,
facet_x = NULL,
facet_y = NULL,
palette = ez_col,
size_line = 1,
size = 11,
env = parent.frame()
)
data |
A data.frame. |
fitted |
Vector of fitted values |
actual |
Vector of actual values |
group |
A character value. Evaluates to a column. |
facet_x |
A character value. Evaluates to a column. |
facet_y |
A character. Evaluates to a column. |
palette |
Colour function. |
size_line |
width of line for |
size |
theme size for |
env |
environment for evaluating expressions. |
library(ggplot2)
n = 1000
df = data.frame(actual = sample(c(FALSE, TRUE), n, replace = TRUE),
runif = runif(n))
df[["fitted"]] = runif(n) ^ ifelse(df[["actual"]] == 1, 0.5, 2)
ggplot(df) +
geom_density(aes(fitted, fill = actual), alpha = 0.5)
roc_plot(df, "actual", "actual")
roc_plot(df, "fitted", "actual")
roc_plot(df, "runif", "actual", size_line = 0.5)
library(dplyr, warn.conflicts = FALSE)
roc_plot(df, "fitted", "actual", "sample(c(1, 2), n(), TRUE)")
roc_plot(df, "fitted", "actual",
"sample(c(1, 2), n(), TRUE)",
"sample(c(3, 4), n(), TRUE)")
roc_plot(df, "fitted", "actual",
"sample(c(1, 2), n(), TRUE)",
"sample(c(3, 4), n(), TRUE)",
"sample(c(5, 6), n(), TRUE)")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.