View source: R/measures_model_fitness.R
measures_model_fitness | R Documentation |
TBD
measures_model_fitness(
y,
y.fitted,
family,
dispersion = NULL,
inverse.link.y = TRUE,
classify = FALSE,
classify.rule = 0.5
)
y |
A vector containing responses/outcome values.. |
y.fitted |
A vector containing predicted outcome/response values obtain from some model. |
family |
Response type (see above). |
dispersion |
A scalar defining the dispersion parameter from a GLM,
or |
inverse.link.y |
Logical. When |
classify |
Logical. When |
classify.rule |
A value between 0 and 1. For a given predicted value
from a logistic regression, if the value is above |
When the family is treated as Gaussian, returns deviance, R2, mean
squared error (MSE), and mean absolute error (MAE). Additionally, when the
outcome is binary, returns misclassification, and if classify = TRUE
,
then returns accuracy, sensitivity, specificity, positive predictive value
(PPV), negative predictive value (NPV), Matthews correlation coefficient
(MCC), and F1 score.
A data frame consisting of a single row and a column for each model fitness measure.
This function is set to replace measure_glm_raw
and
measure_bh_raw
.
## binary data
yb <- rbinom(20, size = 1, prob = 0.5)
yb.f <- yb
yb.f[c(2, 5, 6, 7, 13, 17)] <- abs(1 - yb[c(2, 5, 6, 7, 13, 17)])
measures_model_fitness(
y = yb,
y.fitted = yb.f,
family = "binomial",
classify = TRUE
)
## gaussian data
yg <- rnorm(20)
yg.f <- yg + rnorm(20, 0, 2/3)
measures_model_fitness(
y = yg,
y.fitted = yg.f,
family = "gaussian",
dispersion = 1
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.