ps.summary {twang} | R Documentation |
Computes balance measures (mean differences and KS statistics) for a particular covariate and a set of propensity score weights. This function is not intended to be called directly by the user but is used by other functions in the package.
ps.summary(x, t, w, get.means = TRUE, get.ks = TRUE, na.action = c("level", "exclude", "lowest")[1], collapse.by.var = FALSE) ps.summary.f(x, t, w, get.means = TRUE, get.ks = TRUE, na.action = c("level", "exclude", "lowest")[1], collapse.by.var = TRUE) ps.summary.n(x, t, w, get.means = TRUE, get.ks = TRUE, na.action = c("level", "exclude", "lowest")[1], collapse.by.var = FALSE)
x |
a vector containing the data for a single covariate |
t |
a vector of the same length as x with the 0/1 treatment
assigniments |
w |
a vector of the same length as x with the weights |
get.means |
if TRUE , mean comparisons are computed |
get.ks |
if TRUE , the KS statistics are computed |
na.action |
a string indicating the method for handling missing data |
collapse.by.var |
if TRUE , then statistics computed for factors
are collapsed across the levels |
ps.summary
dispatches ps.summary.n
or ps.summary.f
depending on whether x
is a numeric vector or a factor.
Returns a data frame containing the balance information.
tx.mn |
The mean of the treatment group |
tx.sd |
The standard deviation of the treatment group |
ct.mn |
The mean of the control group |
ct.sd |
The standard deviation of the control group |
std.eff.sz |
The standardized effect size, (tx.mn-ct.mn)/tx.sd |
stat |
the t-statistic for numeric variables and the chi-square statistic for continuous variables |
p |
the p-value for the test associated with stat |
ks |
the KS statistic |
ks.pval |
the KS p-value computed using the analytic approximation, which does not necessarily work well with a lot of ties |
get.means
and get.ks
manipulate the inclusion of certain
columns in the returned result.
treat <- rbinom(100,1,0.5) w <- rexp(100) # categorical data x.cat <- factor(sample(letters[1:3],size=100,replace=TRUE)) ps.summary.f(x.cat,treat,w) # numeric data x.num <- rnorm(100) ps.summary.n(x.num,treat,w) # or let ps.summary figure out which to call ps.summary(x.num,treat,w)