Create a weightit object manually
This function allows users to get the benefits of a weightit
object when using weights not estimated with weightit()
or weightitMSM()
. These benefits include diagnostics, plots, and direct compatibility with cobalt for assessing balance.
as.weightit(...) ## Default S3 method: as.weightit(weights, treat, covs = NULL, estimand = NULL, s.weights = NULL, ps = NULL, ...) as.weightitMSM(...) ## Default S3 method: as.weightitMSM(weights, treat.list, covs.list = NULL, estimand = NULL, s.weights = NULL, ps.list = NULL, ...)
weights |
required; a |
treat |
required; a vector of treatment statuses, one for each unit. |
covs |
an optional |
estimand |
an optional |
s.weights |
an optional |
ps |
an optional |
treat.list |
a list of treatment statuses at each time point.. |
covs.list |
an optional list of |
ps.list |
an optional list of |
... |
additional arguments. These must be named. They will be included in the output object. |
An object of class weightit
(for as.weightit()
) or weightitMSM
(for as.weightitMSM()
).
Noah Greifer
treat <- rbinom(500, 1, .3) weights <- rchisq(500, df = 2) W <- as.weightit(weights= weights, treat = treat, estimand = "ATE") summary(W)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.