fairTwins: Fair Twin Inspection convenience function.

View source: R/generics.R

fairTwinsR Documentation

Fair Twin Inspection convenience function.

Description

Fair Twin Inspection convenience function.

Usage

fairTwins(x, train.id = seq_len(nrow(x$train)), test.id = NULL, cols = NULL)

Arguments

x

Object of class fairadapt, a result of an adaptation procedure.

train.id

A vector of indices specifying which rows of the training data should be displayed.

test.id

A vector of indices specifying which rows of the test data should be displayed.

cols

A character vector, subset of names(train.data), which specifies which subset of columns is to be displayed in the result.

Value

A data.frame, containing the original and adapted values of the requested individuals. Adapted columns have ⁠_adapted⁠ appended to their original name.

Examples

n_samp <- 200
uni_dim <- c(       "gender", "edu", "test", "score")
uni_adj <- matrix(c(       0,     1,      1,       0,
                           0,     0,      1,       1,
                           0,     0,      0,       1,
                           0,     0,      0,       0),
                  ncol = length(uni_dim),
                  dimnames = rep(list(uni_dim), 2),
                  byrow = TRUE)

uni_ada <- fairadapt(score ~ .,
  train.data = head(uni_admission, n = n_samp),
  test.data = tail(uni_admission, n = n_samp),
  adj.mat = uni_adj,
  prot.attr = "gender"
)

fairTwins(uni_ada, train.id = 1:5)

fairadapt documentation built on Oct. 10, 2023, 1:07 a.m.