View source: R/group_matrices.R
group_matrices | R Documentation |
Calculates confusion matrices for each subgroup
group_matrices(protected, probs, preds, cutoff)
protected |
vector containing protected variable |
probs |
|
preds |
numeric, vector with predictions |
cutoff |
|
group_matrices
object
It is a list with values:
For each subgroup:
subgroup
tp - number of true positives
fp - number of false positives
tn - number of true negatives
fn - number of false negatives
data("compas") glm_compas <- glm(Two_yr_Recidivism ~ ., data = compas, family = binomial(link = "logit")) y_prob <- glm_compas$fitted.values y_numeric <- as.numeric(compas$Two_yr_Recidivism) - 1 gm <- group_matrices(compas$Ethnicity, y_prob, y_numeric, cutoff = list( Asian = 0.45, African_American = 0.5, Other = 0.5, Hispanic = 0.5, Caucasian = 0.4, Native_American = 0.5 ) ) gm
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.