summary.lmw: Assess balance for an 'lmw' object

View source: R/summary.lmw.R

summary.lmwR Documentation

Assess balance for an lmw object

Description

Computes balance statistics for an lmw object created by lmw(). Balance involves not only the similarity between the treatment groups but also the similarity between each treatment group and the target population.

Usage

## S3 method for class 'lmw'
summary(
  object,
  un = TRUE,
  addlvariables = NULL,
  standardize = TRUE,
  data = NULL,
  stat = "balance",
  ...
)

## S3 method for class 'lmw_multi'
summary(
  object,
  un = TRUE,
  addlvariables = NULL,
  standardize = TRUE,
  data = NULL,
  contrast = NULL,
  stat = "balance",
  ...
)

## S3 method for class 'summary.lmw'
print(x, digits = max(3, getOption("digits") - 4), ...)

Arguments

object

an lmw object; the output of a call to lmw().

un

logical; whether to display balance statistics for the sample prior to weighting and, additionally, with base weights applied (if supplied). If s.weights were supplied to lmw(), the unadjusted sample will be weighted by the sampling weights.

addlvariables

additional variables for which balance statistics are to be computed along with the covariates in the lmw object. Can be entered in one of three ways: as a data frame of covariates with as many rows as there were units in the original lmw() call, as a string containing the names of variables in data, or as a right-sided formula with the additional variables (and possibly their transformations) found in data, the environment, or the lmw object.

standardize

logical; whether to compute standardized (TRUE) or unstandardized (FALSE) mean differences. Default is TRUE.

data

a optional data frame containing variables named in addlvariables if specified as a string or formula.

stat

character; whether to display balance statistics (i.e., standardized mean differences and Kolmogorv-Smirnov statistics; "balance") or distribution statistics (i.e., means and standard deviations; "distribution"). Default is "balance". Abbreviations allowed.

...

ignored.

contrast

for multi-category treatments with method = "MRI", which two groups should be compared. If NULL, only target balance statistics will be displayed. Ignored with binary treatments or when method = "URI".

x

a summary.lmw object.

digits

the number of digits to print.

Details

summary.lmw() produces covariate balance or distribution statistics and effective samples sizes before and after adjustment by the regression weights and base weights, if supplied. For each covariate, the following balance statistics are computed when stat = "balance":

  • SMD - the standardized mean difference (SMD) between the treated and control groups

  • ⁠TSMD Treated⁠ - the target standardized mean difference (TSMD) between the treated group and target sample

  • ⁠TSMD Control⁠ - the TSMD between between the control group and target sample

  • KS - the Kolmogorov-Smirnov (KS) statistic between the treated and control groups

  • ⁠TKS Treated⁠ - the target KS (TKS) statistic between the treated group and target sample

  • ⁠TKS Control⁠ - the TKS statistic between the control group and target sample

For multi-category treatments with method = "MRI", balance statistics are are computed between each treatment group and the target sample.

When stat = "distribution" the mean and standard deviation of each covariate is compute before and after adjustment and for the target sample. (Standard deviations are printed in parentheses for visual clarity.)

After weighting with the regression weights, the mean difference between the treated and control groups of each covariate included in the original call to lmw() will be equal to zero. However, the mean difference between each treatment group and the target sample may not be equal to zero when method = "URI" in the call to lmw(), and covariates supplied to addlvariables not included in the call to lmw() may not be well balanced.

When s.weights are supplied to lmw(), the unadjusted statistics (if requested) will incorporate the sampling weights. When base.weights are supplied to lmw(), the unadjusted statistics will not incorporate the base weights; rather, balance with base weights applied (if supplied) will be produced in a separate balance table (see Value below).

SMDs are computed as the difference between the (weighted) means divided by a standardization factor, which is the standard deviation of the covariate in the target sample. When estimand = "ATT" in the call to lmw(), the standardization factor is the standard deviation in the treated group; when estimand = "ATC", the standardization factor is the standard deviation in the control group; when estimand = "ATE" or when estimand = "CATE" and a target profile is supplied, the standardization factor is the square root of the average of the variances of both treatment groups; when estimand = "CATE" and a target dataset is supplied, the standardization factor is the standard deviation in the target dataset. When s.weights is supplied, the standardization factor is computed including the sampling weights; otherwise it is computed in the unweighted sample.

For binary covariates, the KS statistic is equal to the unstandardized difference in means and is computed as such.

When estimand = "CATE" in the original call to lmw(), any variables supplied to addlvariables that were not given a target value will not have any target statistics computed (e.g., TSMD, TKS, target means, etc.).

The effective sample size (ESS) is computed within each group as (\sum w)^2/\sum w^2. With uniform weights, this is equal to the sample size.

Value

A summary.lmw object, which contains the following components:

call

The original call to lmw().

nn

The (effective) sample sizes before and after weighting.

bal.un

When stat = "balance" and un = TRUE, the balance statistics prior to weighting.

bal.base.weighted

When stat = "balance", un = TRUE and base weights were supplied to lmw(), the balance statistics with the base weights applied.

bal.weighted

When stat = "balance", the balance statistics with the implied regression weights applied.

dist.un

When stat = "distribution" and un = TRUE, the distribution statistics prior to weighting.

dist.base.weighted

When stat = "distribution", un = TRUE and base weights were supplied to lmw(), the distribution statistics with the base weights applied.

dist.weighted

When stat = "distribution", the distribution statistics with the implied regression weights applied.

method

The method used to estimate the weights (i.e., URI or MRI)

base.weights.origin

If base weights were supplied through the obj argument to lmw(), their origin (i.e, MatchIt or WeightIt)

With multi-category treatments and method = "MRI", the object will also inherit from class summary.lmw_multi.

See Also

lmw() for computing the implied regression weights, plot.summary.lmw() for plotting the balance statistics in a Love plot, plot.lmw() for assessing the representativeness and extrapolation of the weights

Examples

data("lalonde")

# URI regression for ATT
lmw.out1 <- lmw(~ treat + age + education + race + married +
                  nodegree + re74 + re75, data = lalonde,
                  estimand = "ATT", method = "URI",
                  treat = "treat")

lmw.out1

summary(lmw.out1)

summary(lmw.out1, stat = "distribution")

# Adding additional variables to summary, removing unweighted
summary(lmw.out1, un = FALSE,
        addlvariables = ~I(age^2) + I(nodegree*re74))


# MRI regression for ATT after PS matching
m.out <- MatchIt::matchit(treat ~ age + education + race + married +
                            nodegree + re74 + re75,
                          data = lalonde, method = "nearest",
                          estimand = "ATT")

lmw.out2 <- lmw(~ treat + age + education + race + married +
                  nodegree + re74 + re75, data = lalonde,
                method = "MRI", treat = "treat", obj = m.out)

lmw.out2

summary(lmw.out2)

# MRI for a multi-category treatment ATE
lmw.out3 <- lmw(~ treat_multi + age + education + race + married +
                  nodegree + re74 + re75, data = lalonde,
                estimand = "ATE", method = "MRI",
                treat = "treat_multi")

lmw.out3

summary(lmw.out3)

summary(lmw.out3, contrast = c("2", "1"))


lmw documentation built on May 29, 2024, 6:53 a.m.