This page explains the details of estimating optimization-based weights by setting method = "optweight"
in the call to weightit
or weightitMSM
. This method can be used with binary, multinomial, and continuous treatments.
In general, this method relies on estimating weights by solving a quadratic programming problem subject to approximate or exact balance constraints. This method relies on optweight
from the optweight package.
Because optweight
offers finer control and uses the same syntax as weightit
, it is recommended that optweight
be used instead of weightit
with method = "optweight"
.
Binary Treatments
For binary treatments, this method estimates the weights using optweight
. The following estimands are allowed: ATE, ATT, and ATC. The weights are taken from the output of the optweight
fit object. When include.obj = TRUE
, the returned object is the optweight
fit.
Multinomial Treatments
For multinomial treatments, this method estimates the weights using optweight
. The following estimands are allowed: ATE and ATT. The weights are taken from the output of the optweight
fit object. When include.obj = TRUE
, the returned object is the optweight
fit.
Continuous Treatments
For binary treatments, this method estimates the weights using optweight
. The weights are taken from the output of the optweight
fit object. When include.obj = TRUE
, the returned object is the optweight
fit.
Longitudinal Treatments
For longitudinal treatments, optweight
estimates weights that simultaneously satisfy balance constraints at all time points, so only one model is fit to obtain the weights. Using method = "optweight"
in weightitMSM
cause is.MSM.method
to be set to TRUE
by default. Setting it to FALSE
will run one model for each time point and multiply the weights together, a method that is not recommended. NOTE: neither use of optimization-based weights with longitudinal treatments has been validated!
Sampling Weights
Sampling weights are supported through s.weights
in all scenarios.
Missing Data
Missing data is not compatible with the optimization-based weighting algorithm, so a few extra things happen when NA
s are present in the covariates. First, for each variable with missingness, a new missingness indicator variable is created which takes the value 1 if the original covariate is NA
and 0 otherwise. The missingness indicators are added to the model formula as main effects. The missing values in the covariates are then replaced with 0s (this value is arbitrary and does not affect estimation). The weight estimation then proceeds with this new formula and set of covariates. The covariates output in the resulting weightit
object will be the original covariates with the NA
s.