compare.density: Compare observed versus imputed densities

View source: R/diag.r

compare.densityR Documentation

Compare observed versus imputed densities

Description

Plots smoothed density plots of observed and imputed values from output from the amelia function.

Usage

compare.density(
  output,
  var,
  col = c("indianred", "dodgerblue"),
  scaled = FALSE,
  lwd = 1,
  main,
  xlab,
  ylab,
  legend = TRUE,
  frontend = FALSE,
  ...
)

Arguments

output

output from the function amelia.

var

column number or variable name of the variable to plot.

col

a vector of length 2 containing the color to plot the (1) imputed density and (2) the observed density.

scaled

a logical indicating if the two densities should be scaled to reflect the difference in number of units in each.

lwd

the line width of the density plots.

main

main title of the plot. The default is to title the plot using the variable name.

xlab

the label for the x-axis. The default is the name of the variable.

ylab

the label for the y-axis. The default is "Relative Density."

legend

a logical value indicating if a legend should be plotted.

frontend

a logical value used internally for the Amelia GUI.

...

further graphical parameters for the plot.

Details

This function first plots a density plot of the observed units for the variable var in col[2]. The the function plots a density plot of the mean or modal imputations for the missing units in col[1]. If a variable is marked "ordinal" or "nominal" with the ords or noms options in amelia, then the modal imputation will be used. If legend is TRUE, then a legend is plotted as well.

References

Abayomi, K. and Gelman, A. and Levy, M. 2005 "Diagnostics for Multivariate Imputations," Applied Statistics. 57,3: 273–291.

See Also

For more information on how densities are computed, density; Other imputation diagnostics are overimpute, disperse, and tscsPlot.

Examples

data(africa)


Amelia documentation built on Nov. 20, 2022, 1:05 a.m.