Difference in success of mice imputation across variables I'm trying to use mice package to do imputations, I'm pretty new to all of this. I have 9 continuous variables and I used the following code to impute, using the 'cart' (Classification and regression trees) method:
imp <- mice(incomplete.data, method="cart", m=10, maxit=20, seed=456, 
            pred=quickpred(incomplete.data, method="spearman"))

All imputations look fine, except two: '2' and '8' (see density plots below). I am puzzled why these two do not perform well and what could be done to improve them.
Initially I tried to use the default 'pmm' method for all of the imputations. However I got the following error code:
Error in solve.default(xtx + diag(pen)) : system is computationally singular: 
 reciprocal condition number = 1.83676e-18'

This is why I switched to the method 'cart'. Any ideas how to improve this please? I'm stuck. 

 A: Based on your plots, you can not say which of the distributions are correct or wrong. These kind of plots are usually used to see whether the multiple imputations lead to similar imputed values (i.e. when the red lines of one plot would be completely different from each other, your imputation might be too unstable).
The difference of the red and blue lines in plot 2 and 8 might result from the response mechanism of your data. Consider the following example in R:
set.seed(3456789) # Reproducible example
N <- 1000 # Sample size

y_all <- rnorm(N, 10, 2) # Dependent variable
x1 <- y_all + rnorm(N, 0, 5) # Predictor 1
x2 <- y_all + rnorm(N, 20, 2) # Predictor 2
x3 <- y_all + rnorm(N, 5, 3) # Predictor 3
x4 <- y_all + rnorm(N, 15, 10) # Predictor 4
x5 <- y_all + rnorm(N, 10, 3) # Predictor 5

# Insert missing values according the response mechanism Missing At Random (MAR)
y_obs <- y_all
y_obs[(x1 + x2 + x3 + x4 + x5) > mean(x1 + x2 + x3 + x4 + x5)] <- NA # Observed values of Y
y_miss <- y_all[is.na(y_obs)] # Missing values of Y (for comparison)

# Plot observed and missing Values of Y
# This is only possible because we know the missing values - impossible in real life
plot(density(y_all), 
     xlim = c(2.5, 17.5), 
     ylim = c(0, 0.4), 
     xlab = "Y", 
     main = "Observed and Missing Values of Y", 
     lwd = 2)
lines(density(y_obs[!is.na(y_obs)]), 
      col = "cornflowerblue", 
      lwd = 2)
lines(density(y_miss), 
      col = "firebrick3", 
      lwd = 2)
legend("topleft", 
       c("All", "Observed", "Missing"), 
       lty = 1, 
       col = c(1, "cornflowerblue", "firebrick3"))

incomplete.data <- data.frame(y_obs, x1, x2, x3, x4, x5) # Create data.frame


# Impute data with your specifications
library("mice")

# Apply mice function
imp <- mice(incomplete.data,
            method = "cart", 
            pred = quickpred(incomplete.data, method = "spearman"), 
            m = 10, 
            maxit = 20, 
            seed = 456)

# Density plot of observed and imputed values
densityplot(imp, xlim = c(2.5, 17.5), ylim = c(0, 0.4))


In the second graphic you can see that the imputed values are very different from the observed values. However, they are much closer (i.e. much better) to the missing values that are indicated by the red line in the first graphic. In other words, by imputing different/higher values compared to your observed values, you are reducing bias (which is exactly what you want).
To get back to your example: You should evaluate whether it is logical from a theoretical viewpoint that the imputed values of plots 2 and 8 are higher than the observed values.
Furthermore, I would encourage you to investigate why your code has problems with pmm, since predictive mean matching is usually better than cart.
