mi.hist {mi} | R Documentation |
A function for plotting the histogram of each variable and of its observed and imputed values.
mi.hist( object, Yobs, ...) ## S4 method for signature 'mi.method, ANY': mi.hist( object, Yobs, ...) ## S4 method for signature 'mi.categorical, ANY': mi.hist( object, Yobs, ...) ## S4 method for signature 'mi.binary, ANY': mi.hist( object, Yobs,...) ## S4 method for signature 'mi.polr, ANY': mi.hist( object, Yobs, ...) ## S4 method for signature 'mi.pmm, ANY': mi.hist( object, Yobs, ...)
Yobs |
observed values. |
object |
imputed values or member object of mi.method object family. |
... |
Other options for plot function. |
The histogram (in black) of the complete variable, the histogram (in blue) of the observed values and the histogram (in red) of the imputed values.
The histogram of the completed values (observed plus imputed) is in black, the histogram of the imputed values in red, while the one of the observed values in blue.
Masanao Yajima yajima@stat.columbia.edu, Yu-Sung Su ys463@columbia.edu, M.Grazia Pittau grazia@stat.columbia.edu, Andrew Gelman gelman@stat.columbia.edu
Kobi Abayomi, Andrew Gelman and Marc Levy. (2008). “Diagnostics for multivariate imputations”. Applied Statistics 57, Part 3: 273–291.
Yu-Sung Su, Andrew Gelman, Jennifer Hill, Masanao Yajima. Forthcoming. “Multiple Imputation with Diagnostics (mi) in R: Opening Windows into the Black Box”. Journal of Statistical Software.
Andrew Gelman and Jennifer Hill. (2007). Data Analysis Using Regression and Multilevel/Hierarchical Models. Cambridge University Press.
# true data x<-rnorm(100,0,1) # N(0,1) y<-rnorm(100,(1+2*x),1.2) # y ~ 1 + 2*x + N(0,1.2) # create artificial missingness on y y[seq(2,100,10)]<-NA dat.xy <- data.frame(x,y) # imputation dat.cont.mi <- mi.continuous(y~x, data = dat.xy) mi.hist( dat.cont.mi, y) # imputation dat.mi <- mi(dat.xy) mi.hist( imp(dat.mi,1)[["y"]], y)