Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

long2mitml.list

Convert imputations from long format to mitml.list


Description

These functions convert data sets containing multiple imputations in long format to objects of class mitml.list. The resulting object can be used in further analyses.

Usage

long2mitml.list(x, split, exclude = NULL)

jomo2mitml.list(x)

Arguments

x

A data frame in long format containing multiple imputations (see 'Details').

split

A character string denoting the column in x that identifies different imputations (see 'Details').

exclude

A vector denoting the values of split that should be excluded.

Details

The function long2mitml.list converts data frames from the long format to mitml.list (i.e., a list of imputed data sets). In long format, all imputations are contained in a single data frame, where different imputations are denoted by split. This function splits the data frame into a list of imputed data sets according to split, excluding the values specified by exclude (see the 'Examples').

The jomo2mitml.list function is a special case of long2mitml.list which converts imputations that have been generated with jomo (see the jomo package)).

Value

A list of imputed data sets with class mitml.list.

Author(s)

Simon Grund

See Also

Examples

data(studentratings)
require(jomo)

# impute data using jomo (native functions)
clus <- studentratings[, "ID"]
Y <- studentratings[, c("ReadAchiev", "ReadDis")]
imp <- jomo(Y = Y, clus = clus, nburn = 1000, nbetween = 100, nimp = 5)

# split imputations
impList <- long2mitml.list(imp, split = "Imputation", exclude = 0)
impList <- jomo2mitml.list(imp)

mitml

Tools for Multiple Imputation in Multilevel Modeling

v0.4-1
GPL (>= 2)
Authors
Simon Grund [aut,cre], Alexander Robitzsch [aut], Oliver Luedtke [aut]
Initial release
2021-02-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.