library("data.table")
data = data.table(
"AGE_NA" = c(0, 0, 0, 0, 0),
"AGE_0_10" = c(1, 1, 0, 0, 0),
"AGE_11_20" = c(0, 0, 1, 0, 0),
"AGE_21_31" = c(0, 0, 0, 1, 1),
"X1" = runif(5),
"X2" = runif(5)
)
label = c(1,0,0,1,1)
pops = list("AGE_NA", "AGE_0_10", "AGE_11_20", "AGE_21_31", function(x) {x[["X1" > 0.5]]})
sf = SubpopAuditorFitter$new(subpops = pops)
sf$fit(data, label - 0.5)
Run the code above in your browser using DataLab