model_metrics | R Documentation |
Calculates a variety of standard model metrics, given the truth and predicted values as vectors.
model_metrics(truth, predicted, categorical = FALSE)
truth |
A vector - the true outcome values. |
predicted |
A vector - the predicted outcome values. |
categorical |
A logical - Is the true outcome a categorical response
variable? This function only handles the binary case where |
A tibble with calculated model metrics
# Continuous outcome mtcarslm <- lm(mpg ~ ., mtcars) model_metrics(mtcars$mpg, mtcarslm$fitted.values) # Binary outcome iris$isSetosa <- factor(as.integer(iris$Species == "setosa")) irisglm <- glm(isSetosa ~ Sepal.Length, iris, family = "binomial") model_metrics(iris$isSetosa, irisglm$fitted.values, TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.