| predict.fairadaptBoot {fairadapt} | R Documentation |
Prediction function for new data from a saved fairadaptBoot object.
Description
Prediction function for new data from a saved fairadaptBoot object.
Usage
## S3 method for class 'fairadaptBoot'
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 fairadaptBoot object. In
particular, newdata should contain column names that appear in the
formula argument that was used when calling fairadaptBoot() (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_boot <- fairadaptBoot(score ~ .,
train.data = head(uni_admission, n = n_samp),
adj.mat = uni_adj,
prot.attr = "gender",
n.boot = 5,
keep.object = TRUE
)
predict(object = uni_ada_boot, newdata = tail(uni_admission, n = n_samp))
[Package fairadapt version 0.2.7 Index]