make_boxplot <- function(e) {
mods <- getModels(e)
# Hack to get rid of iptw
mods[["iptw"]] <- NULL
sum_mods <- list()
for(i in seq(length(mods))) {
sum_mods[[i]] <- do.call("summary", list(mods[[i]], standardize=TRUE))
}
sum_matched <- lapply(sum_mods, `[[`, "sum.matched")
std_mean_diff <- sapply(sum_matched, `[`, "Std. Mean Diff.")
allbiases <- unname(abs(unlist(std_mean_diff)))
len <- length(std_mean_diff[[1]])
id <- rep(seq(1, length(mods)), each=len)
par(cex.axis=0.6)
boxplot(allbiases ~ id, main="Abs. std. biases for remaining models",
names=names(mods), ylab="Absolute standardized biases", las=3)
}
getModels <- function(e) {
lapply(e$methods_list, "[[", "matchit_mod")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.