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,zinput). If NULL, no title is shown.- subtitle
A string specifying the subtitle of the plot. Default is "auto" (automatic subtitle based on
x,y,zinput). 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_colorTitle colour (default
"#242429").title_sizeTitle font size (default 14).
title_faceTitle font face, one of
"plain"(default),"bold","italic"or"bold.italic".subtitle_colorSubtitle colour (default
"#242429").subtitle_sizeSubtitle font size (default 14).
subtitle_faceSubtitle font face (default
"plain").axis_title_colorAxis title colour (default
"#35353d").axis_title_sizeAxis title font size (default 10).
axis_title_faceAxis title font face (default
"bold").axis_text_sizeAxis tick label font size (default 9).
axis_text_angle_xRotation of x-axis tick labels, in degrees (default 0).
axis_text_angle_yRotation of y-axis tick labels, in degrees (default 0).
panel_bg_fillPanel background fill (default
"gray95").panel_bg_colorPanel border colour;
NA(default) draws no border.strip_bg_fillFacet strip background fill (default
"gray85").strip_bg_colorFacet strip border colour;
NA(default) draws no border.strip_text_sizeFacet strip label font size (default 8).
grid_major_colorMajor grid line colour (default
"white").grid_major_linewidthMajor grid line width (default 0.3).
grid_minor_colorMinor grid line colour (default
"white").grid_minor_linewidthMinor 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")
}
