View source: R/summary.optweight.R
| summary.optweight | R Documentation |
These functions summarize the weights resulting from a call to optweight(), optweightMV(), or optweight.svy(). summary() produces summary statistics on the distribution of weights, including their range and variability, and the effective sample size of the weighted sample (computed using the formula in McCaffrey, et al., 2004). plot() creates a histogram of the weights.
## S3 method for class 'optweight'
summary(object, top = 5L, ignore.s.weights = FALSE, weight.range = TRUE, ...)
## S3 method for class 'optweightMV'
summary(object, top = 5L, ignore.s.weights = FALSE, weight.range = TRUE, ...)
## S3 method for class 'optweight.svy'
summary(object, top = 5L, ignore.s.weights = FALSE, weight.range = TRUE, ...)
## S3 method for class 'summary.optweight'
plot(x, ...)
object |
an |
top |
|
ignore.s.weights |
logical |
weight.range |
|
... |
Additional arguments. For |
x |
a |
For point treatments (i.e., optweight objects), summary() returns a summary.optweight 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 |
l2 |
The square root of the |
l1 |
The |
linf |
The |
rel.ent |
The relative entropy between the estimated weights and the base weights, weighted by the sampling weights (if any): |
num.zeros |
The number of units with a weight equal to 0. |
effective.sample.size |
The effective sample size for each treatment group before and after weighting. |
For multivariate treatments (i.e., optweightMV objects), a list of the above elements for each treatment.
For optweight.svy objects, the above object but with no treatment group divisions.
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 (the mean of the base weights, or 1 if not supplied).
McCaffrey, D. F., Ridgeway, G., & Morral, A. R. (2004). Propensity Score Estimation With Boosted Regression for Evaluating Causal Effects in Observational Studies. Psychological Methods, 9(4), 403–425. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1037/1082-989X.9.4.403")}
plot.optweight() for plotting the values of the dual variables.
library("cobalt")
data("lalonde", package = "cobalt")
#Balancing covariates between treatment groups (binary)
(ow1 <- optweight(treat ~ age + educ + married +
nodegree + re74, data = lalonde,
tols = .001,
estimand = "ATT"))
(s <- summary(ow1))
plot(s, breaks = 12)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.