# NOT RUN {
data(rl_reg1)
# make a fake posterior distribution for the linkage
m <- 10
n <- nrow(rl_reg1)
post_link <- matrix(sample(seq_len(n), n*m, replace = TRUE), nrow = m)
# get the posterior prototyping weights
col_type <- c("string", "string", "numeric", "numeric", "numeric", "categorical", "ordinal",
"numeric", "numeric")
orders <- list(education = c("Less than a high school diploma", "High school graduates, no college",
"Some college or associate degree", "Bachelor's degree only", "Advanced degree"))
weights <- c(.25, .25, .05, .05, .1, .15, .05, .05, .05)
pp_weight <- pp_weights(rl_reg1, post_link, "proto_minimax", distance = dist_col_type,
col_type = col_type, weights = weights, orders = orders, scale = TRUE, parallel = FALSE)
# threshold by posterior prototyping weights
head(rl_reg1[pp_weight > 0.5, ])
# }
Run the code above in your browser using DataCamp Workspace