as.wimids | R Documentation |
wimids
objectCreates a wimids
object from a list of weightit
objects and an imputed dataset.
as.wimids(x, ...)
## Default S3 method:
as.wimids(x, datasets, ...)
x |
A list of |
... |
Ignored. |
datasets |
The datasets containing the exposure and covariates mentioned in the |
The weighted datasets are stored as though weightthem()
was called with approach = "within"
.
A wimids
object.
weightthem()
, wimids
, WeightIt::weightit()
#Loading the dataset
data(osteoarthritis)
#Multiply imputing the missing values
imputed.datasets <- mice::mice(osteoarthritis, m = 5,
printFlag = FALSE)
#Matching the multiply imputed datasets manually
weight.list <- lapply(1:5, function(i) {
WeightIt::weightit(OSP ~ AGE + SEX + BMI + RAC + SMK,
mice::complete(imputed.datasets, i),
method = 'glm',
estimand = 'ATT')
})
#Creating wimids object
weighted.datasets <- as.wimids(weight.list,
imputed.datasets)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.