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.dichotomous, ANY': mi.hist( object, Yobs, ... ) ## S4 method for signature 'mi.mixed, ANY': mi.hist( object, Yobs, ... ) ## S4 method for signature 'mi.polr, ANY': mi.hist( object, Yobs, ... ) ## S4 method for signature 'mi.sqrtcontinuous, 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, M.Grazia Pittau grazia@stat.columbia.edu, Andrew Gelman gelman@stat.columbia.edu
Andrew Gelman and Jennifer Hill, Data Analysis Using Regression and Multilevel/Hierarchical Models, Cambridge University Press, 2007.
# 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)