Learn R Programming

mi (version 0.06-5)

mi.hist: Multiple Imputation Histogram

Description

A function for plotting the histogram of each variable and of its observed and imputed values.

Usage

mi.hist( object, Yobs, ...)
## S3 method for class 'mi.method,ANY':
mi.hist( object, Yobs, ... )
## S3 method for class 'mi.categorical,ANY':
mi.hist( object, Yobs, ... )
## S3 method for class 'mi.dichotomous,ANY':
mi.hist( object, Yobs, ... )
## S3 method for class 'mi.polr,ANY':
mi.hist( object, Yobs, ... )
## S3 method for class 'mi.pmm,ANY':
mi.hist( object, Yobs, ... )

Arguments

Yobs
observed values.
object
imputed values or member object of mi.method object family.
...
Other options for plot function.

Value

  • 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.

References

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.

See Also

plot.mi, hist

Examples

Run this code
# 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)

Run the code above in your browser using DataLab