Skip to contents

Plots the dual variables resulting from optweight() in a way similar to figure 2 of Zubizarreta (2015), which explained how to interpret these values. These represent the cost of changing the constraint on the variance of the resulting weights. For covariates with large values of the dual variable, tightening the constraint will increase the variability of the weights, and loosening the constraint will decrease the variability of the weights, both to a greater extent than would doing the same for covariate with small values of the dual variable.

Usage

# S3 method for class 'optweight'
plot(x, ...)

# S3 method for class 'optweightMSM'
plot(x, which.time = 1, ...)

# S3 method for class 'optweight.svy'
plot(x, ...)

Arguments

x

An optweight or optweight.svy object; the output of a call to optweight() or optweight.svy().

...

Ignored.

which.time

For longitudinal treatments, which time period to display. Only one may be displayed at a time.

Value

A ggplot object that can be used with other ggplot2 functions.

References

Zubizarreta, J. R. (2015). Stable Weights that Balance Covariates for Estimation With Incomplete Outcome Data. Journal of the American Statistical Association, 110(511), 910–922. doi:10.1080/01621459.2015.1023805

See also

optweight() or optweight.svy() to estimate the weights and the dual variables

plot.summary.optweight() for plots of the distribution of weights

Examples

library("cobalt")
data("lalonde", package = "cobalt")

#Balancing covariates between treatment groups (binary)
ow1 <- optweight(treat ~ age + educ + married +
                nodegree + re74, data = lalonde,
                tols = c(.1, .1, .1, .1, .1),
                estimand = "ATT")

summary(ow1) # Note the coefficient of variation
#> Summary of weights:
#> 
#> - Weight ranges:
#>         Min                                  Max
#> treated   1                   ||          1.0000
#> control   0 |---------------------------| 1.5946
#> 
#> - Units with 5 greatest weights by group:
#>                                            
#>               1      2      3      4      5
#>  treated      1      1      1      1      1
#>              79    118    127    156    164
#>  control 1.5946 1.5946 1.5946 1.5946 1.5946
#> 
#>         RMSE Dev Mean Abs Dev Max Abs Dev # Zeros
#> treated   0.0000       0.0000           0       0
#> control   0.5319       0.4619           1       0
#> 
#> - Effective Sample Sizes:
#>            Control Treated
#> Unweighted 429.000     185
#> Weighted   334.408     185
#> 
             # and effective sample size (ESS)

plot(ow1) # age has a low value, married is high


ow2 <- optweight(treat ~ age + educ + married +
                nodegree + re74, data = lalonde,
                tols = c(0, .1, .1, .1, .1),
                estimand = "ATT")

summary(ow2) # Notice that tightening the constraint
#> Summary of weights:
#> 
#> - Weight ranges:
#>         Min                                  Max
#> treated   1                  ||           1.0000
#> control   0 |---------------------------| 1.7539
#> 
#> - Units with 5 greatest weights by group:
#>                                            
#>               1      2      3      4      5
#>  treated      1      1      1      1      1
#>             419    404    412    387    395
#>  control 1.7343 1.7441 1.7441 1.7539 1.7539
#> 
#>         RMSE Dev Mean Abs Dev Max Abs Dev # Zeros
#> treated   0.0000       0.0000           0       0
#> control   0.5338       0.4649           1       0
#> 
#> - Effective Sample Sizes:
#>            Control Treated
#> Unweighted 429.000     185
#> Weighted   333.863     185
#> 
             # on age had a negligible effect on the
             # variability of the weights and ESS

ow3 <- optweight(treat ~ age + educ + married +
                nodegree + re74, data = lalonde,
                tols = c(.1, .1, 0, .1, .1),
                estimand = "ATT")

summary(ow3) # In contrast, tightening the constraint
#> Summary of weights:
#> 
#> - Weight ranges:
#>         Min                                  Max
#> treated   1                ||             1.0000
#> control   0 |---------------------------| 1.8712
#> 
#> - Units with 5 greatest weights by group:
#>                                           
#>              1      2      3      4      5
#>  treated     1      1      1      1      1
#>            419    404    412    387    395
#>  control 1.857 1.8641 1.8641 1.8712 1.8712
#> 
#>         RMSE Dev Mean Abs Dev Max Abs Dev # Zeros
#> treated   0.0000       0.0000           0       0
#> control   0.6763       0.6473           1       0
#> 
#> - Effective Sample Sizes:
#>            Control Treated
#> Unweighted 429.000     185
#> Weighted   294.354     185
#> 
             # on married had a large effect on the
             # variability of the weights, shrinking
             # the ESS