cbind.mids {mice} | R Documentation |
Columnwise combination of mids
objects
cbind.mids(x,y,...)
x |
A mids object. |
y |
A mids object or a dataframe, matrix, factor or vector. |
... |
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 mice() statement that created x
and second argument the call to cbind.mids() . |
data |
The cbind of the (incomplete) data in x$data and y$data . |
m |
The number of imputations. |
nmis |
An array containing the number of missing observations per column. |
imp |
A list of nvar components with the generated multiple imputations.
Each part of the list is a nmis[j] by m matrix of imputed values for
variable j . The original data of y will be copied into this list,
including the missing values of y then y is not imputed. |
method |
A vector of strings of length(nvar) specifying the elementary
imputation method per column. If y is a mids object this vector is a combination of
x$method and y$method ,
otherwise this vector is x$method and for the columns of y the method is set to "" .
|
predictorMatrix |
A square matrix of size ncol(data) containing code 0/1 data specifying
the predictor set. If x and y are mids objects then
the predictor matrices of x and y are
combined with zero matrices on the off diagonal blocks. Otherwise the variables in y are included
in the predictor matrix of x such that y is not used as predictor(s) and not imputed as well. |
visitSequence |
The sequence in which columns are visited. The same as x$visitSequence . |
seed |
The seed value of the solution, x$seed . |
iteration |
Last Gibbs sampling iteration number, x$iteration . |
lastSeedValue |
The most recent seed value, x$lastSeedValue |
chainMean |
Combination of x$chainMean and y$chainMean . If y$chainMean does not exist this element
equals x$chainMean . |
chainVar |
Combination of x$chainVar and y$chainVar . If y$chainVar does not exist this element equals
x$chainVar . |
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 x$pad and
y$pad if y is a
mids object. Otherwise, it is defined by the settings of x and the combination of the data
x$data and y . |
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)