knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(risk3r) N <- 10000 predicted <- runif(N) actual <- rbinom(N, size = 1, prob = predicted) metrics(actual, predicted)
Remove NA
if are present.
predicted2 <- predicted predicted2[sample(c(TRUE, FALSE), size = N, prob = c(1, 99), replace = TRUE)] <- NA metrics(actual, predicted2)
daux <- data.frame(actual = actual, predicted = predicted) m <- glm(actual ~ predicted, family = binomial, data = daux) model_metrics(m)
Works with new data.
new_daux <- head(daux, 1000) model_metrics(m, newdata = new_daux)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.