cbind.mids {mice} | R Documentation |
Columnwise combination of mids
objects
cbind.mids(x,y,...)
x |
A |
y |
A |
... |
Dataframes, matrices, vectors or factors. These can be given as named arguments. |
This function combines two mids
objects columnwise into a
single object of class mids
, or combines a mids
object with a vector, matrix, factor or dataframe
columnwise into an object of class mids
. The number of rows in the (incomplete) data x$data
and y
(or y$data
if y
is a mids
object)
should be equal. If y
is a mids
object then the number of imputations in x
and y
should be equal. Note: If y
is a vector or factor its
original name is lost and it will be denoted with y
in the mids
object.
call |
A vector, with first argument the |
data |
The |
m |
The number of imputations. |
nmis |
An array containing the number of missing observations per column. |
imp |
A list of |
method |
A vector of strings of |
predictorMatrix |
A square matrix of size |
visitSequence |
The sequence in which columns are visited. The same as |
seed |
The seed value of the solution, |
iteration |
Last Gibbs sampling iteration number, |
lastSeedValue |
The most recent seed value, |
chainMean |
Combination of |
chainVar |
Combination of |
pad |
A list containing various settings of the padded imputation model,
i.e. the imputation model after creating dummy variables. This list is defined by combining |
Remark that if a column of y
is categorical this is ignored in the padded model since that column
is not used as predictor for another column.
Karin Groothuis-Oudshoorn, Stef van Buuren, 2009
# append 'forgotten' variable bmi to imp temp <- boys[,c(1:3,5:9)] imp <- mice(temp,maxit=1) imp2 <- cbind.mids(imp, data.frame(bmi=boys$bmi)) # append maturation score to imp (numerical) mat <- (as.integer(temp$gen) + as.integer(temp$phb) + as.integer(cut(temp$tv,breaks=c(0,3,6,10,15,20,25)))) imp2 <- cbind.mids(imp, as.data.frame(mat)) # append maturation score to imp (factor) # known issue: new column name is 'y', not 'mat' mat <- as.factor(mat) imp2 <- cbind.mids(imp, mat) # append data frame with two columns to imp temp2 <- data.frame(bmi=boys$bmi,mat=as.factor(mat)) imp2 <- cbind.mids(imp, temp2) # combine two mids objects impa <- mice(temp, maxit=2) impb <- mice(temp2, maxit=3) # first a then b impab <- cbind.mids(impa, impb) # first b then a impba <- cbind.mids(impb, impa)