x: A data frame, matrix, or vector of propensity score weights or a ps object. x can also be a data frame, matrix, or vector of propensity scores if x.as.weights=FALSE.
data: A data frame.
estimand: The estimand of interest: either "ATT" or "ATE".
vars: A vector of character strings naming variables in data on which to assess balance.
treat.var: A character string indicating which variable in data
contains the 0/1 treatment group indicator.
x.as.weights: TRUE or FALSE indicating whether x
specifies propensity score weights or propensity scores. Ignored if x is a ps object. Default: TRUE.
sampw: Optional sampling weights. If x is a ps object, then the sampling weights should have been passed to ps and not specified here. dx.wts.mediation will issue a warning if x is a ps object and sampw is also specified.
perm.test.iters: A non-negative integer giving the number of iterations of the permutation test for the KS statistic. If perm.test.iters=0, then the function returns an analytic approximation to the p-value. This argument is ignored is x is a ps object. Setting perm.test.iters=200 will yield precision to within 3% if the true p-value is 0.05. Use perm.test.iters=500 to be within 2%.
Returns
Returns a list containing
treat The vector of 0/1 treatment assignment indicators.
Details
Creates a balance table that compares unweighted and weighted means and standard deviations, computes effect sizes, and KS statistics to assess the ability of the propensity scores to balance the treatment and control groups.
Examples
data("tMdat")## tMdat is small simulated data set included in twangMediation for ## demonstrating the functions. See ?tMdat for detailsfit.es.max <- wgtmed(M ~ w1 + w2 + w3, data = tMdat, a_treatment ="A", y_outcome ="Y", total_effect_wts = tMdat$te.wgt, method ="ps", ps_n.trees=1500, ps_shrinkage=0.01, ps_stop.method=c("es.max"))## dx.wts.mediation is used internally by bal.table.mediation,## print.mediation, and summary.mediationsummary(fit.es.max)