| as.weightit | R Documentation |
weightit object manuallyThis 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(x, ...)
## S3 method for class 'weightit.fit'
as.weightit(x, covs = NULL, ...)
## Default S3 method:
as.weightit(
x,
treat,
covs = NULL,
estimand = NULL,
s.weights = NULL,
ps = NULL,
...
)
as.weightitMSM(x, ...)
## Default S3 method:
as.weightitMSM(
x,
treat.list,
covs.list = NULL,
estimand = NULL,
s.weights = NULL,
ps.list = NULL,
...
)
x |
required; a |
... |
additional arguments. These must be named. They will be included in the output object. |
covs |
an optional |
treat |
a vector of treatment statuses, one for each unit. Required when
|
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 |
An object of class weightit (for as.weightit()) or weightitMSM
(for as.weightitMSM()).
treat <- rbinom(500, 1, .3)
weights <- rchisq(500, df = 2)
W <- as.weightit(weights, treat = treat, estimand = "ATE")
summary(W)
# See ?weightit.fit for using as.weightit() with a
# weightit.fit object.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.