Skip to contents

This function provides overimputation diagnostics for assessing imputations generated by 'mice', 'mixgb' or other imputers. It supports evaluation on both training and test data.

Usage

vismi_overimp(
  obj,
  x = NULL,
  y = NULL,
  z = NULL,
  m = NULL,
  imp_idx = NULL,
  integerAsFactor = FALSE,
  title = "auto",
  subtitle = "auto",
  num_plot = "cv",
  fac_plot = "cv",
  train_color_pal = NULL,
  test_color_pal = NULL,
  stack_y = FALSE,
  diag_color = NULL,
  gg_style = list(),
  seed = 2025,
  ...
)

Arguments

obj

Overimputation object of class 'overimp' created by the overimp() function.

x

A character string specifying the name of the variable to plot on the x axis. Default is NULL.

y

A character string specifying the name of the variable to plot on the y axis. Default is NULL.

z

A character string specifying the name of the variable to plot on the z axis. Default is NULL.

m

A single positive integer specifying the number of imputed datasets to plot. It should be smaller than the total number of imputed datasets in the object.

imp_idx

A vector of integers specifying the indices of imputed datasets to plot.

integerAsFactor

A logical indicating whether integer variables should be treated as factors. Default is FALSE (treated as numeric).

title

A string specifying the title of the plot. Default is "auto" (automatic title based on x,y,z input). If NULL, no title is shown.

subtitle

A string specifying the subtitle of the plot. Default is "auto" (automatic subtitle based on x,y,z input). If NULL, no subtitle is shown.

num_plot

A character string specifying the type of plot for numeric variables.

fac_plot

A character string specifying the type of plot for categorical variables.

train_color_pal

A vector of colors for the training data. If NULL, default colors will be used.

test_color_pal

A vector of colors for the test data. If NULL, default colors will be used.

stack_y

A logical indicating whether to stack y values in certain plots. Default is FALSE.

diag_color

A character string specifying the color of the diagonal line in scatter plots. Default is NULL.

gg_style

A named list of style overrides. Supplied entries are merged onto the defaults, so only the keys you wish to change need to be given. Unrecognised keys are silently ignored. Default is list() (use all defaults). Valid keys:

title_color

Title colour (default "#242429").

title_size

Title font size (default 14).

title_face

Title font face, one of "plain" (default), "bold", "italic" or "bold.italic".

subtitle_color

Subtitle colour (default "#242429").

subtitle_size

Subtitle font size (default 14).

subtitle_face

Subtitle font face (default "plain").

axis_title_color

Axis title colour (default "#35353d").

axis_title_size

Axis title font size (default 10).

axis_title_face

Axis title font face (default "bold").

axis_text_size

Axis tick label font size (default 9).

axis_text_angle_x

Rotation of x-axis tick labels, in degrees (default 0).

axis_text_angle_y

Rotation of y-axis tick labels, in degrees (default 0).

panel_bg_fill

Panel background fill (default "gray95").

panel_bg_color

Panel border colour; NA (default) draws no border.

strip_bg_fill

Facet strip background fill (default "gray85").

strip_bg_color

Facet strip border colour; NA (default) draws no border.

strip_text_size

Facet strip label font size (default 8).

grid_major_color

Major grid line colour (default "white").

grid_major_linewidth

Major grid line width (default 0.3).

grid_minor_color

Minor grid line colour (default "white").

grid_minor_linewidth

Minor grid line width (default 0.2).

seed

An integer specifying the random seed for reproducibility. Default is 2025.

...

Additional arguments to customize the plots, such as position, point_size, linewidth, alpha, xlim, ylim, boxpoints, width.

Value

An overimp_plot object displaying the overimputation plots for training and test data (if users set test_ratio > 0 in the overimp() function.)

Examples

if (requireNamespace("mixgb", quietly = TRUE)) {
  obj <- overimp(data = nhanes3, m = 3, p = 0.2, test_ratio = 0.2, method = "mixgb")
  vismi_overimp(obj = obj, x = "head_circumference_cm", num_plot = "cv")
}