Skip to contents

This function combines two mids objects rowwise into a single mids object, or combines a mids object with a vector, matrix, factor or dataframe rowwise into a mids object.

Usage

rbind.mids(x, y = NULL, ...)

Arguments

x

A mids object.

y

A mids object, or a data.frame, matrix, factor or vector.

...

Additional data.frame, matrix, vector or factor. These can be given as named arguments.

Value

An S3 object of class mids

Details

If y is a mids object, then rbind requires that the number of multiple imputations in x and y is identical. Also, columns of x$data and y$data should match.

If y is not a mids object, the columns of x$data and y should match. The where matrix for y is set to FALSE, signaling that any missing values in y were not imputed. The ignore vector for y is set to FALSE, elements of y will therefore influence the parameters of the imputation model in future iterations.

Note

The function construct the elements of the new mids object as follows:

dataRowwise combination of the (incomplete) data in x and y
impEquals rbind(x$imp[[j]], y$imp[[j]]) if y is mids object; otherwise the data of y will be copied
mEquals x$m
whereRowwise combination of where arguments
blocksEquals x$blocks
callVector, call[1] creates x, call[2] is call to rbind.mids
nmisx$nmis + y$nmis
methodTaken from x$method
predictorMatrixTaken from x$predictorMatrix
visitSequenceTaken from x$visitSequence
formulasTaken from x$formulas
postTaken from x$post
blotsTaken from x$blots
ignoreConcatenate x$ignore and y$ignore
seedTaken from x$seed
iterationTaken from x$iteration
lastSeedValueTaken from x$lastSeedValue
chainMeanSet to NA
chainVarSet to NA
loggedEventsTaken from x$loggedEvents
versionTaken from x$version
dateTaken from x$date

References

van Buuren S and Groothuis-Oudshoorn K (2011). mice: Multivariate Imputation by Chained Equations in R. Journal of Statistical Software, 45(3), 1-67. doi:10.18637/jss.v045.i03

See also

Author

Karin Groothuis-Oudshoorn, Stef van Buuren

Examples

imp1 <- mice(nhanes[1:13, ], m = 2, maxit = 1, print = FALSE)
#> Warning: Number of logged events: 1
imp5 <- mice(nhanes[1:13, ], m = 2, maxit = 2, print = FALSE)
#> Warning: Number of logged events: 1
mylist <- list(age = NA, bmi = NA, hyp = NA, chl = NA)

nrow(complete(rbind(imp1, imp5)))
#> Warning: iterations differ, so no convergence diagnostics calculated
#> [1] 26
nrow(complete(rbind(imp1, mylist)))
#> [1] 14

nrow(complete(rbind(imp1, data.frame(mylist))))
#> [1] 14
nrow(complete(rbind(imp1, complete(imp5))))
#> [1] 26