mi_marginplot: Marginplot Including Imputed Values

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/mi_marginplot.R

Description

In addition to a standard scatterplot, information about missing and imputed values is shown in the plot margins.

Usage

1
2
3
4
5
6
mi_marginplot(x, input, leg=TRUE, col = c("skyblue","red","red4"),
           alpha = NULL, pch = c(1,16), cex = par("cex"),
           numbers = TRUE, cex.numbers = par("cex"),
           zeros = FALSE, xlim = NULL, ylim = NULL,
           main = NULL, sub = NULL, xlab = NULL, ylab = NULL,
           ann = par("ann"), axes = TRUE, frame.plot = axes, ...)

Arguments

x

vector of two variablenames.

input

MI object produced by mi, mice or Amelia.

leg

draw a legend, TRUE or FALSE.

col

a vector of length three defining the colors to be used in the plot. The first color is used for the scatterplot and the boxplots for the available data, the second color for the univariate scatterplots and boxplots for the missing values in one variable, and the third color for the frequency of missing values in both variables (see 'Details'). If only one color is supplied, it is used for the bivariate and univariate scatterplots and the boxplots for missing values in one variable, whereas the boxplots for the available data are transparent. Else if two colors are supplied, the second one is recycled.

alpha

a numeric value between 0 and 1 giving the level of transparency of the colors, or NULL. This can be used to prevent overplotting.

pch

a vector of length two giving the plot symbols to be used for the scatterplot and the univariate scatterplots. If a single plot character is supplied, it is used for the scatterplot and the default value will be used for the univariate scatterplots (see 'Details').

cex

the character expansion factor to be used for the bivariate and univariate scatterplots.

numbers

a logical indicating whether the frequencies of missing values should be displayed in the lower left of the plot (see 'Details').

cex.numbers

the character expansion factor to be used for the frequencies of the missing values.

zeros

a logical vector of length two indicating whether the variables are semi-continuous, i.e., contain a considerable amount of zeros. If TRUE, only the non-zero observations are used for drawing the respective boxplot. If a single logical is supplied, it is recycled.

xlim, ylim

axis limits.

main, sub

main and sub title.

xlab, ylab

axis labels.

ann

a logical indicating whether plot annotation (main, sub, xlab, ylab) should be displayed.

axes

a logical indicating whether both axes should be drawn on the plot. Use graphical parameter "xaxt" or "yaxt" to suppress only one of the axes.

frame.plot

a logical indicating whether a box should be drawn around the plot.

...

graphical parameters, see par.

Details

Modified version of the marginplot which is included in the VIM package. Thanks to Matthias Templ, Andreas Alfons for letting me use their source code.

Boxplots for available, missing and imputed data, as well as scatterplots of the observed values. Missing values in one variable are shown in the plot margins.

Furthermore, the frequencies of the missing values can be displayed by a number (lower left of the plot). The number in the lower left corner is the number of observations that are missing in both variables.

Author(s)

Original code by Andreas Alfons and Matthias Templ, modifications by Paul Brix

References

R package "VIM: Visualization and Imputation of Missing Values" by Matthias Templ, Andreas Alfons, Alexander Kowarik. cran.r-project.org/package=VIM

See Also

marginplot from VIM.

Examples

1
2
3
4
data(FLAS)
require("mice")
FLASmi <- mice(FLAS)
mi_marginplot(c("MLAT","eng"), FLASmi, pch=16)

mmaechler/miP documentation built on May 23, 2019, 5 a.m.