summary.weightit: Print and Summarize Output

View source: R/weightit.R

summary.weightitR Documentation

Print and Summarize Output

Description

summary() generates a summary of the weightit or weightitMSM object to evaluate the properties of the estimated weights. plot() plots the distribution of the weights.

Usage


## S3 method for class 'weightit'
summary(object, top = 5,
        ignore.s.weights = FALSE, ...)

## S3 method for class 'summary.weightit'
print(x, ...)

## S3 method for class 'summary.weightit'
plot(x, binwidth = NULL, bins = NULL, ...)

## S3 method for class 'weightitMSM'
summary(object, top = 5,
        ignore.s.weights = FALSE, ...)

## S3 method for class 'summary.weightitMSM'
print(x, ...)

Arguments

object

a weightit or weightitMSM object; the output of a call to \funweightit or \funweightitMSM.

top

how many of the largest and smallest weights to display. Default is 5.

ignore.s.weights

whether or not to ignore sampling weights when computing the weight summary. If FALSE, the default, the estimated weights will be multiplied by the sampling weights (if any) before values are computed.

binwidth, bins

arguments passed to \pkgfunggplot2geom_histogram to control the size and/or number of bins.

x

a summary.weightit or summary.weightitMSM object; the output of a call to summary.weightit() or summary.weightitMSM().

...

for print(), arguments passed to \funprint. For plot(), additional arguments passed to \pkgfungraphicshist to determine the number of bins, though \pkgfunggplot2geom_histogram from ggplot2 is actually used to create the plot.

Value

For point treatments (i.e., weightit objects), a summary.weightit object with the following elements:

weight.range

The range (minimum and maximum) weight for each treatment group.

weight.top

The units with the greatest weights in each treatment group; how many are included is determined by top.

coef.of.var (Coef of Var)

The coefficient of variation (standard deviation divided by mean) of the weights in each treatment group and overall.

scaled.mad (MAD)

The mean absolute deviation of the weights in each treatment group and overall divided by the mean of the weights in the corresponding group.

negative entropy (Entropy)

The negative entropy (\sum w log(w)) of the weights in each treatment group and overall divided by the mean of the weights in the corresponding group.

num.zeros

The number of weights equal to zero.

effective.sample.size

The effective sample size for each treatment group before and after weighting. See \funESS.

For longitudinal treatments (i.e., weightitMSM objects), a list of the above elements for each treatment period.

plot() returns a ggplot object with a histogram displaying the distribution of the estimated weights. If the estimand is the ATT or ATC, only the weights for the non-focal group(s) will be displayed (since the weights for the focal group are all 1). A dotted line is displayed at the mean of the weights.

Author(s)

Noah Greifer

See Also

\fun

weightit, \funweightitMSM, \funsummary

Examples

# See example at ?weightit or ?weightitMSM

WeightIt documentation built on May 31, 2023, 9:25 p.m.