I have a dataset with 3465 observation and 5 variables as follows (named: dataset)
Variables
$ Treat --> factor(3 level: "1", "2", "3")
$ Age --> integer(eg. 24,54,etc.)
$ Mortality --> integer(0=no,1= yes)
$ LDL --> integer(eg. 200,120,143, etc.)
$ Smoking --> integer(0=no, 1= yes)
I used mnps function in twang package to weight my observations according to treat
mnps code
mnps.dataset <- mnps(treat ~ Age + LDL + Smoking, data = dataset, estimand = "ATE", stop.method = c("es.mean", "ks.mean"), n.trees=3000)
``` ### Plot ###
Then I used plot function to assess the balance of the data after weighting.
There was no problem for plots 1 and 2, (balanced of treatment per iterations, and propensity score distribution of treatments.)
Plot code
plot(mnps.dataset, plots = 1)
plot(mnps.dataset, plots = 2)
But when i wanted to run plot 3 for Absolute Standardized difference, it made an error with some warnings and an empty plot:
Warning Error
plot(mnps.dataset, plots = 3)
Warning messages:
1: In order(as.numeric(x)) : NAs introduced by coercion
2: In split(as.numeric(x) [ord], gg[ord]) : NAs introduced by coercion
3: ...(same as error 1)
4: ... (same as error 2)
5: ... (same as error 1)
6: ... (same as error 2)
7: ... (same as error 1)
8: ... (same as error 2)
9: In panel.superpose(x, y, type = type, groups = groups, ... : NAs introduced by coercion
10: ...
11: ...
12: ...
___________________
Note : "..." means repeated previous error