View source: R/mice.impute.2l.bin.R
mice.impute.2l.bin | R Documentation |
glmer
Imputes univariate systematically and sporadically missing data
using a two-level logistic model using lme4::glmer()
mice.impute.2l.bin(y, ry, x, type, wy = NULL, intercept = TRUE, ...)
y |
Vector to be imputed |
ry |
Logical vector of length |
x |
Numeric design matrix with |
type |
Vector of length |
wy |
Logical vector of length |
intercept |
Logical determining whether the intercept is automatically added. |
... |
Arguments passed down to |
Data are missing systematically if they have not been measured, e.g., in the case where we combine data from different sources. Data are missing sporadically if they have been partially observed.
Vector with imputed data, same type as y
, and of length
sum(wy)
Shahab Jolani, 2015; adapted to mice, SvB, 2018
Jolani S., Debray T.P.A., Koffijberg H., van Buuren S., Moons K.G.M. (2015). Imputation of systematically missing predictors in an individual participant data meta-analysis: a generalized approach using MICE. Statistics in Medicine, 34:1841-1863.
Other univariate-2l:
mice.impute.2l.lmer()
,
mice.impute.2l.norm()
,
mice.impute.2l.pan()
library(tidyr)
library(dplyr)
data("toenail2")
data <- tidyr::complete(toenail2, patientID, visit) %>%
tidyr::fill(treatment) %>%
dplyr::select(-time) %>%
dplyr::mutate(patientID = as.integer(patientID))
## Not run:
pred <- mice(data, print = FALSE, maxit = 0, seed = 1)$pred
pred["outcome", "patientID"] <- -2
imp <- mice(data, method = "2l.bin", pred = pred, maxit = 1, m = 1, seed = 1)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.