mi.scatterplot {mi} | R Documentation |
A function for plotting observed and imputed values for a variable .
mi.scatterplot( Yobs, Yimp, X = NULL, xlab = NULL, ylab = NULL, main = "Imputed Variable Scatter Plot", display.zero = TRUE, gray.scale = FALSE, obs.col = rgb( 0, 0, 1, alpha = 0.3 ), imp.col = rgb( 1, 0, 0 ), obs.pch = 20 , imp.pch = 20, obs.cex = 0.3, imp.cex = 0.3, obs.lty = 1 , imp.lty = 1, obs.lwd = 2.5, imp.lwd = 2.5, ... ) marginal.scatterplot ( data, object, use.imputed.X = FALSE, ... )
Yobs |
observed values. |
Yimp |
imputed values. |
X |
variable to plot on the x axis. |
xlab |
label on the x axis. |
ylab |
label on the y axis. |
display.zero |
if set to FALSE zeros will not be displayed. Default is TRUE. |
main |
main title of the plot. |
gray.scale |
When set to TRUE, makes the plot into gray scale with predefined color and line type. |
obs.col |
color for the observed variable. Default is "blue". |
imp.col |
color for the imputed variable. Default is "red". |
obs.pch |
data symbol for observed variable. Default is 20. |
imp.pch |
data symbol for imputed variable. Default is 20. |
obs.cex |
text size for observed variable. Default is 0.3. |
imp.cex |
text size for imputed variable. Default is 0.3. |
obs.lty |
line type for observed variable. Default is 1. |
imp.lty |
line type for imputed variable. Default is 1. |
obs.lwd |
line width for observed variable. Default is 2.5. |
imp.lwd |
line width for imputed variable. Default is 2.5. |
... |
Other options for 'plot' function. |
data |
missing data. |
object |
mi object. |
use.imputed.X |
If you want to use the imputed X. Default is FALSE. |
Since several data points can have the same data values, especially in discrete variables,
small random number is added to each value so that points do not fall on top of each other.
See help on jitter
for more details.
Lowess line is fitted to both imputed and observed data.
A scatterplot with the observed and the imputed values plotted against a chosen variable.
By default imputed values are in red, while the observed values are in blue.
Masanao Yajima yajima@stat.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.
Andrew Gelman and Maria Grazia Pittau. “A flexible program for missing-data imputation and model checking.” Technical report. Columbia University, New York.
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(1,100,10)]<-NA dat.xy <- data.frame(x,y) # imputation imp.cont<-mi.continuous(y~x, data = dat.xy) mi.scatterplot(y,imputed(imp.cont,y))