Nothing
## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
## ----setup, warning=FALSE, message=FALSE--------------------------------------
library(ROCnGO)
library(dplyr)
library(forcats)
## -----------------------------------------------------------------------------
# Filter cases of versicolor species
iris_subset <- as_tibble(iris) %>% filter(Species != "versicolor")
iris_subset
## ----warning=FALSE------------------------------------------------------------
# Calculate ROC points for Sepal.Lenght
points <- roc_points(
data = iris_subset,
predictor = Sepal.Length,
response = Species
)
points
# Plot points
plot(points$fpr, points$tpr)
## ----warning=FALSE------------------------------------------------------------
# Check response levels
levels(iris_subset$Species)
# Set virginica as first value in levels
iris_subset$Species <- fct_relevel(iris_subset$Species, "virginica")
levels(iris_subset$Species)
# Plot ROC curve
points <- roc_points(
data = iris_subset,
predictor = Sepal.Length,
response = Species
)
plot(points$fpr, points$tpr)
## ----warning=FALSE------------------------------------------------------------
# Calc partial ROC points
p_points <- calc_partial_roc_points(
data = iris_subset,
predictor = Sepal.Length,
response = Species,
lower_threshold = 0.9,
upper_threshold = 1,
ratio = "tpr"
)
p_points
# Plot partial ROC curve
plot(p_points$fpr, p_points$tpr)
## ----warning=FALSE------------------------------------------------------------
# Summarize predictor in high sens region
summarize_predictor(
data = iris_subset,
predictor = Sepal.Length,
response = Species,
threshold = 0.9,
ratio = "tpr"
)
# Summarize predictor in high spec region
summarize_predictor(
data = iris_subset,
predictor = Sepal.Length,
response = Species,
threshold = 0.1,
ratio = "fpr"
)
## ----warning=FALSE------------------------------------------------------------
summarize_dataset(
data = iris_subset,
response = Species,
threshold = 0.9,
ratio = "tpr"
)
## ----warning=FALSE------------------------------------------------------------
# Plot ROC points of Sepal.Length
sepal_length_plot <- plot_roc_points(
data = iris_subset,
predictor = Sepal.Length,
response = Species
)
sepal_length_plot
## ----warning=FALSE------------------------------------------------------------
sepal_length_plot +
add_roc_curve(
data = iris_subset,
predictor = Sepal.Width,
response = Species
) +
add_roc_points(
data = iris_subset,
predictor = Petal.Width,
response = Species
) +
add_partial_roc_curve(
data = iris_subset,
predictor = Petal.Length,
response = Species,
ratio = "tpr",
threshold = 0.7
) +
add_threshold_line(
threshold = 0.7,
ratio = "tpr"
) +
add_chance_line()
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.