I am using TWANG to match 3 treatment groups and I could produce plot 1 and 2 (shown here https://cran.r-project.org/web/packages/twang/vignettes/mnps.pdf ) but unfortunately I could not produce plot 3 that assesses absolute standardized mean differences (ASMD) before and after weighting)
Here is my code:
mnps.newtest1.ATE <- mnps(ttt_gps.3gp.Neo.Adj.dCRT ~ AGE + SEX +
Race_2psW.O + CDCC_2gps01.2 + Histology_3gps +
TUMOR_SIZE_R + YEAR_OF_DIAGNOSIS,
data = testdf2,
n.trees=10000,
interaction.depth=2,
shrinkage=0.01,
perm.test.iters=0,
stop.method=c("es.mean","ks.mean"),
estimand = "ATE",
verbose=F)
Warning message: In ps(formula = currFormula, data = currDat, n.trees = n.trees[i], : Optimal number of iterations is close to the specified n.trees. n.trees is likely set too small and better balance might be obtainable by setting n.trees to be larger.
plot(mnps.newtest1.ATE, plots = 3)
*****Error in matrix(unlist(value, recursive = FALSE, use.names = FALSE), nrow = nr, : length of 'dimnames' [2] not equal to array extent In addition: Warning message: In is.na(e2) : is.na() applied to non-(list or vector) of type 'NULL'*****
Then after googling this error, I found this solution on 1 website (length of 'dimnames' [2] not equal to array extent when using corrplot function from a matrix read from a csv file ) but it does not work yet
plot(as.matrix(mnps.newtest1.ATE), plots = 3)
Error in if (length(treatments) > 2 & x$estimand == "ATE") stop("The \"treatments\" argument must be null or have length 1 or 2.") :
argument is of length zero
Any help will be so much appreciated