glm_weightit()
is essentially a wrapper for glm()
that optionally computes a coefficient variance matrix that can be adjusted to account for estimation of the weights if a weightit
or weightitMSM
object is supplied to the weightit
argument. When no argument is supplied to weightit
or there is no "Mparts"
attribute in the supplied object, the default variance matrix returned will be the "HC0" sandwich variance matrix, which is robust to misspecification of the outcome family (including heteroscedasticity). Otherwise, the default variance matrix uses M-estimation to additionally adjust for estimation of the weights. When possible, this often yields smaller (and more accurate) standard errors. See the individual methods pages to see whether and when an "Mparts"
attribute is included in the supplied object. To request that a variance matrix be computed that doesn't account for estimation of the weights even when a compatible weightit
object is supplied, set vcov = "HC0"
, which treats the weights as fixed.
Bootstrapping can also be used to compute the coefficient variance matrix; when vcov = "BS"
or vcov = "FWB"
, which implement the traditional resampling-based and fractional weighted bootstrap, respectively, the entire process of estimating the weights and fitting the outcome model is repeated in bootstrap samples (if a weightit
object is supplied). This accounts for estimation of the weights and can be used with any weighting method. It is important to set a seed using set.seed()
to ensure replicability of the results. The fractional weighted bootstrap is more reliable but requires the weighting method to accept sampling weights (which most do, and you'll get an error if it doesn't). Setting vcov = "FWB"
and supplying fwb.args = list(wtype = "multinom")
also performs the resampling-based bootstrap but with the additional features fwb provides (e.g., a progress and parallelization) at the expense of needing to have fwb installed.
When family = "multinomial"
, multinomial logistic regression is fit using a custom function in WeightIt that uses M-estimation to estimate the model coefficients. This implementation is less robust to failures than other multinomial logistic regression solvers and should be used with caution. Estimation of coefficients should align with that from mlogit::mlogit()
and mclogit::mblogit()
.
Functions in the sandwich package can be to compute standard errors after fitting, regardless of how vcov
was specified, though these will ignore estimation of the weights, if any. When no adjustment is done for estimation of the weights (i.e., because no weightit
argument was supplied or there was no "Mparts"
component in the supplied object), the default variance matrix produced by glm_weightit()
should align with that from sandwich::vcovHC(. type = "HC0")
or sandwich::vcovCL(., type = "HC0", cluster = cluster)
when cluster
is supplied.