- formula.list
a list of formulas corresponding to each time point with
the time-specific treatment variable on the left hand side and
pre-treatment covariates to be balanced on the right hand side. The
formulas must be in temporal order, and must contain all covariates to be
balanced at that time point (i.e., treatments and covariates featured in
early formulas should appear in later ones). Interactions and functions of
covariates are allowed.
- data
an optional data set in the form of a data frame that contains
the variables in the formulas in formula.list
. This must be a wide data
set with exactly one row per unit.
- method
a string of length 1 containing the name of the method that
will be used to estimate weights. See weightit()
for allowable options.
The default is "glm"
, which estimates the weights using generalized
linear models.
- stabilize
logical
; whether or not to stabilize the weights.
Stabilizing the weights involves fitting a model predicting treatment at
each time point from treatment status at prior time points. If TRUE
, a
fully saturated model will be fit (i.e., all interactions between all
treatments up to each time point), essentially using the observed treatment
probabilities in the numerator (for binary and multi-category treatments).
This may yield an error if some combinations are not observed. Default is
FALSE
. To manually specify stabilization model formulas, e.g., to specify
non-saturated models, use num.formula
. With many time points, saturated
models may be time-consuming or impossible to fit.
- by
a string containing the name of the variable in data
for which
weighting is to be done within categories or a one-sided formula with the
stratifying variable on the right-hand side. For example, if by = "gender"
or by = ~gender
, a separate propensity score model or
optimization will occur within each level of the variable "gender"
. Only
one by
variable is allowed; to stratify by multiply variables
simultaneously, create a new variable that is a full cross of those
variables using interaction()
.
- s.weights
A vector of sampling weights or the name of a variable in
data
that contains sampling weights. These can also be matching weights
if weighting is to be used on matched data. See the individual pages for
each method for information on whether sampling weights can be supplied.
- num.formula
optional; a one-sided formula with the stabilization
factors (other than the previous treatments) on the right hand side, which
adds, for each time point, the stabilization factors to a model saturated
with previous treatments. See Cole & Hernán (2008) for a discussion of how
to specify this model; including stabilization factors can change the
estimand without proper adjustment, and should be done with caution. Can
also be a list of one-sided formulas, one for each time point. Unless you
know what you are doing, we recommend setting stabilize = TRUE
and
ignoring num.formula
.
- moments
numeric
; for some methods, the greatest power of each
covariate to be balanced. For example, if moments = 3
, for each
non-categorical covariate, the covariate, its square, and its cube will be
balanced. This argument is ignored for other methods; to balance powers of
the covariates, appropriate functions must be entered in formula
. See the
individual pages for each method for information on whether they accept
moments
.
- int
logical
; for some methods, whether first-order interactions of
the covariates are to be balanced. This argument is ignored for other
methods; to balance interactions between the variables, appropriate
functions must be entered in formula
. See the individual pages for each
method for information on whether they accept int
.
- missing
character
; how missing data should be handled. The options
and defaults depend on the method
used. Ignored if no missing data is
present. It should be noted that multiple imputation outperforms all
available missingness methods available in weightit()
and should probably
be used instead. Consider the MatchThem package for the use of
weightit()
with multiply imputed data.
- verbose
logical
; whether to print additional information output by
the fitting function.
- include.obj
whether to include in the output a list of the fit objects
created in the process of estimating the weights at each time point. For
example, with method = "glm"
, a list of the glm
objects containing the
propensity score models at each time point will be included. See the help
pages for each method for information on what object will be included if
TRUE
.
- keep.mparts
logical
; whether to include in the output components
necessary to estimate standard errors that account for estimation of the
weights in glm_weightit()
. Default is TRUE
if such parts are present.
See the individual pages for each method for whether these components are
produced. Set to FALSE
to keep the output object smaller, e.g., if
standard errors will not be computed using glm_weightit()
.
- is.MSM.method
whether the method estimates weights for multiple time
points all at once (TRUE
) or by estimating weights at each time point and
then multiplying them together (FALSE
). This is only relevant for
user-specified functions.
- weightit.force
several methods are not valid for estimating weights
with longitudinal treatments, and will produce an error message if
attempted. Set to TRUE
to bypass this error message.
- ...
other arguments for functions called by weightit()
that control
aspects of fitting that are not covered by the above arguments. See Details
at weightit()
.