predict.fairadapt {fairadapt} | R Documentation |
Prediction function for new data from a saved fairadapt
object.
Description
Prediction function for new data from a saved fairadapt
object.
Usage
## S3 method for class 'fairadapt'
predict(object, newdata, ...)
Arguments
object |
Object of class |
newdata |
A |
... |
Additional arguments forwarded to |
Details
The newdata
argument should be compatible with adapt.test
argument that was used when constructing the fairadapt
object. In
particular, newdata
should contain column names that appear in the formula
argument that was used when calling fairadapt()
(apart from the outcome
variable on the LHS of the formula).
Value
A data.frame
containing the adapted version of the new data.
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),
adj.mat = uni_adj,
prot.attr = "gender"
)
predict(object = uni_ada, newdata = tail(uni_admission, n = n_samp))
[Package fairadapt version 0.2.7 Index]