Learn R Programming

cobalt (version 1.3.0)

bal.tab.Match: Balance Statistics for Matching Objects

Description

Generates balance statistics for Match objects from Matching.

Usage

"bal.tab"(x, formula = NULL, data = NULL, treat = NULL, covs = NULL, int = FALSE, addl = NULL, continuous = c("std","raw"), binary = c("raw", "std"), s.d.denom, m.threshold = NULL, v.threshold = NULL, un = FALSE, disp.means = FALSE, disp.v.ratio = FALSE, cluster = NULL, which.cluster = NULL, cluster.summary = TRUE, quick = FALSE, ...)

Arguments

x
a Match object; the output of a call to Match() from the Matching package.
formula
a formula with the treatment variable as the response and the covariates for which balanace is to be assessed as the predictors. All named variables must be in data. See Details.
data
a data frame containing all the variables named in formula. See Details.
treat
a vector of treatment statuses. See Details.
covs
a data frame of covariate values for which to check balance. See Details.
int
logical; whether or not to include 2-way interactions of covariates included in formula or covs and in addl.
addl
a data frame of additional covariates for which to present balance. These may be covariates included in the original dataset but not included in formula or covs. In general, it makes more sense to include all desired variables in formula or covs than in addl. See note in Details for using addl.
continuous
whether mean differences for continuous variables should be standardized ("std") or raw ("raw"). Default "std". Abbreviations allowed.
binary
whether mean differences for binary variables (i.e., difference in proportion) should be standardized ("std") or raw ("raw"). Default "raw". Abbreviations allowed.
s.d.denom
whether the denominator for standardized differences (if any are calculated) should be the standard deviation of the treated group ("treated"), the standard deviation of the control group ("control"), or the pooled standard deviation ("pooled"), computed as the square root of the mean of the group variances. Abbreviations allowed. If not specified, bal.tab() will use "treated" if the estimand of the call to Match() is the ATT, "pooled" if the estimand is the ATE, and "control" if the estimand is the ATC.
m.threshold
a numeric value for the threshold for mean differences. .1 is recommended.
v.threshold
a numeric value for the threshold for variance ratios. Will automatically convert to the inverse if less than 1.
un
logical; whether to print statistics for the unadjusted sample as well as for the adjusted sample.
disp.means
logical; whether to print the group means in balance output.
disp.v.ratio
logical; whether to display variance ratios in balance output.
cluster
a vector of cluster membership.
which.cluster
which cluster(s) to display. If NULL, all clusters in cluster will be displayed. If NA, no clusters will be displayed. Otherwise, can be a vector of cluster names or numerical indices for which to display balance. Indices correspond to the alphabetical order of cluster names.
cluster.summary
logical; whether to display the cluster summary table if cluster is specified. If which.cluster is NA, cluster.summary will be set to TRUE.
quick
logical; if TRUE, will not compute any values that will not be displayed. Leave FALSE if computed values not displayed will be used later.
...
further arguments passed to or from other methods. They are ignored in this function.

Value

If clusters are not specified, an object of class "bal.tab" containing balance summaries for the Match object. The following are the elements of bal.tab: :If clusters are specified, an object of class "bal.tab.cluster" containing balance summaries within each cluster and a summary of balance across clusters. Each balance summary is a balance table as described in Balance above. The summary of balance across clusters displays the mean, median, and maximum mean difference and variance ratio after adjustment for each covariate across clusters. Minimum statistics are calculated as well, but not displayed. To see these, use the options in print.bal.tab.cluster.

Details

bal.tab.Match() generates a list of balance summaries for the Match object given, and functions similarly to MatchBalance() in Matching.

The input to bal.tab.Match() must include either both formula and data or both treat and covs. Using the formula + data inputs mirrors how MatchBalance() is used in Matching.

The last four arguments of bal.tab() affect display only; they are passed directly to print.bal.tab or print.bal.tab.subclass, and do not affect any calculations or the contents of the bal.tab object. All balance statistics are calculated whether they are displayed by print or not. The threshold values (m.threshold and v.threshold) control whether extra columns should be inserted into the Balance table describing whether the balance statistics in question exceeded or were within the threshold. Including these thresholds also creates summary tables tallying the number of variables that exceeded and were within the threshold and displaying the variables with the greatest imbalance on that balance measure.

The input to addl must be a data frame; if more than one variable is included, this is straightforward (i.e., because data[,c("v1", "v2")] is already a data frame), but if only one variable is used (e.g., data[,"v1"]), R will coerce it to a vector, thus making it unfit for input in addl. To avoid this, simply wrap the input to addl in data.frame() or use subset() if only one variable is to be added. Again, when more than one variable is included, the input is general already a data frame and nothing needs to be done. It is recommended to include all desired variables in formula or covs rather than specifying additional variables using addl.

See Also

bal.tab for details of calculations.

Examples

Run this code
library(Matching); data("lalonde", package = "cobalt")

glm1 <- glm(treat ~ age + educ + black + hispan + 
            married + nodegree + re74 + re75, 
            data = lalonde, family = binomial)
Match.out <- Match(Tr = lalonde$treat, X = glm1$fitted.values)

## Using formula and data
bal.tab(Match.out, treat ~ age + educ + black + hispan + 
        married + nodegree + re74 + re75, data = lalonde)

## Using treat and covs
covariates <- subset(lalonde, select=-c(treat, re78))
bal.tab(Match.out, treat = lalonde$treat, covs = covariates)

Run the code above in your browser using DataLab