Multiple imputation of categorical data in R

Askia Asmara Source

I used multiple imputations with R software to complete my data set.

See the example below: x3 (minimum value=0 and maximum value=6); x4 (minimum value=1 and maximum value=5).

After imputed my data set via mice (with m=5), I would like to yield the new proportions after imputation (that is the imputed proportions) of these two variables (A3 and A4) for each imputation data set (m=1 to 5). Do you know how to pool the results of the five estimations then into one (proportion and standard error) like this : A3= x%, x%, x%, x%, x%, x% and for A4 = y%, y%, y%, y%, y% ?

Do you know any R code to deal with this?

A1 =c(2, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 2, 2, 2, 1, 1, 2, 2, 1, 2, 1, 2)
A2 =c(1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2)
A3 =c(NA, NA, NA, 0, 0, 4, 0, 0, 2, 2 , 0, 3, 4, 0, 5, 6, NA, 2, 1, 0, NA, NA, NA, NA, NA, NA, 1, 2, 6, NA, 0, 6, NA, 6, 2)
A4 =c(1, NA, NA, NA, NA, 2, 2, 5, NA, 4, 3, 1, 2, NA, 3, 6, 2, 1, 2, 3, 3, 1, 2, 3, 4, 5, 4, 1, 2, 3, 5, 3, NA, 1, NA)

df =data.frame(x1=x1, x2=x2, x3=x3, x4=x4)

imp <- mice(df, m=5)
rimputationr-mice

Answers

comments powered by Disqus