Closed KZARCA closed 4 years ago
Hi, from the twang example, if treat has character levels, it works:
library(twang) data(AOD) mnps.AOD <- mnps(treat ~ illact + crimjust + subprob + subdep + white, data = AOD, estimand = "ATE", verbose = FALSE, stop.method = c("es.mean"), n.trees = 3000) bal.tab(mnps.AOD)
If, however, you add: levels(AOD$treat) <- 1:3 at the beginning, you get
levels(AOD$treat) <- 1:3
Error in `[.data.frame`(do.call("cbind", unname(lapply(bal.tab.multi.list, : undefined columns selected
Thanks, someone else reported that bug and it’ll be fixed in the next release. If a multi-category treatment has names that are numbers, it won’t work. Use other names to make it work correctly for now.
Hi, from the twang example, if treat has character levels, it works:
If, however, you add:
levels(AOD$treat) <- 1:3
at the beginning, you get