I combined several data-frames into a data-frame dfc with a fifth column called model specifying which model was used for imputation. I want to plot the distributions by grouping them by model.
dfc looks something like: (1000 rows, 5 columns)
X1        X2        X3        X4      model
1500000 400000    0.542      7.521    actual
250000  32000     2.623     11.423   missForest
...
I use the lines below to plot:
library(lattice)
densityplot(X1 + X2 + X3 + X4, group = dfc$model)
giving:
Note that X1 <- dfc$X1 (and likewise)
My questions are:
- How can I add a legend to this plot? (this plot is useless if one can't tell which colour belongs to which model)
- Is there, perhaps, a more visually appealing way to plot this? Using ggplot, perhaps?
- Is there a better way to compare these models? For example, I could plot for each column separately.





