
Using bal.tab() with Subclassified Data
Source: R/class-bal.tab.subclass.R
class-bal.tab.subclass.RdWhen using bal.tab() with subclassified data, i.e., data split into subclasses where balance may hold, the output will be different from the standard, non-subclassified case, and there is an additional option for controlling display. This page outlines the outputs and options in this case.
There are two main components of the output of bal.tab() with subclassified data: the balance within subclasses and the balance summary across subclasses. The within-subclass balance displays essentially are standard balance displays for each subclass, except that only "adjusted" values are available, because the subclassification itself is the adjustment.
The balance summary is, for each variable, like a weighted average of the balance statistics across subclasses. With a binary treatment, this is computed internally by assigning each individual a weight based on their subclass and treatment group membership and then computing weighted balance statistics as usual with these weights. This summary is the same one would get if subclasses were supplied to the match.strata argument rather than to subclass. Because the means and mean differences are additive, their computed values will be weighted averages of the subclass-specific values, but for other statistics, the computed values will not be.
With a censoring indicator, subclassification is itself the solution: within each subclass the units still under observation should resemble every at-risk unit in it, and the summary across subclasses is that subclassification expressed as censoring weights. See class-bal.tab.cens.
With a continuous treatment, subclassification cannot be expressed as weights, because no set of weights makes a continuous treatment independent of the covariates within a subclass. The balance summary is therefore computed by combining the subclass-specific statistics directly, weighting each subclass by its share of the subclassified units (using s.weights, if supplied). Every statistic is a weighted average of the subclass-specific values, except the standard deviations, which are combined in quadrature so that the summary value is the pooled within-subclass standard deviation. The summary means are consequently the same as the means in the original sample, since subclassification does not change the distribution of the covariates.
Allowable arguments
There are three arguments for bal.tab() that relate to subclasses: subclass, which.subclass, and subclass.summary.
subclassFor the
data.frameand formula methods ofbal.tab(), a vector of subclass membership or the name of the variable indatacontaining subclass membership. When using subclassification with a function compatible with cobalt, such asmatchit()in MatchIt, this argument can be omitted because the subclasses are in the output object.which.subclassThis is a display option that does not affect computation. If
.all, all subclasses insubclasswill be displayed. If.none(the default), no subclasses will be displayed. Otherwise, can be a vector of subclass indices for which to display balance.subclass.summaryThis is a display option that does not affect computation. If
TRUE, the balance summary across subclasses will be displayed. The default isTRUE, and ifwhich.subclassis.none, it will automatically be set toTRUE.
Output
The output is a bal.tab.subclass object, which inherits from bal.tab. It has the following elements:
Subclass.Balance: A list of data frames containing balance information for each covariate in each subclass.Balance.Across.Subclass: A data frame containing balance statistics for each covariate aggregated across subclasses and for the original sample (i.e., unadjusted). Seebal.tab()for details on what this includes.Observations: A table of sample sizes in each subclass and overall.