Learn R Programming

mlim (version 0.3.0)

mlim.mids: prepare "mids" class object

Description

takes "mlim" object and prepares a "mids" class for data analysis with multiple imputation.

Usage

mlim.mids(mlim, incomplete)

Value

object of class 'mids', as required by 'mice' package for analyzing multiple imputation data

Arguments

mlim

array of class "mlim", returned by "mlim" function

incomplete

the original data.frame with NAs

Author

E. F. Haghish, based on code from 'prelim' frunction in missMDA R package

Examples

Run this code

if (FALSE) {
data(iris)
require(mice)
irisNA <- mlim.na(iris, p = 0.1, seed = 2022)

# adding unstratified NAs to all variables of a data.frame
MLIM <- mlim(irisNA, m=5, tuning_time = 180, doublecheck = T, seed = 2022)

# create the mids object for MICE package
mids <- mlim.mids(MLIM, irisNA)

# run an analysis on the mids data (just as example)
fit <- with(data=mids, exp=glm(Species~ Sepal.Length, family = "binomial"))

# then, pool the results!
summary(pool(fit))
}

Run the code above in your browser using DataLab