plot_1num1fac {mixgb} | R Documentation |
Box plots with points for one numeric variable vs one factor (or integer) variable.
Description
Plot observed values versus m sets of imputed values for one numeric variable vs one factor (or integer) variable using ggplot2.
Usage
plot_1num1fac(
imputation.list,
var.num,
var.fac,
original.data,
true.data = NULL,
color.pal = NULL,
shape = FALSE
)
Arguments
imputation.list |
A list of |
var.num |
A numeric variable |
var.fac |
A factor variable |
original.data |
The original data with missing data |
true.data |
The true data without missing values. This is generally unknown in practice. If the true data is known (e.g., in cases where it is generated by simulation), it can be specified in this argument. The output will then have an extra panel called |
color.pal |
A vector of hex color codes for the observed and m sets of imputed values panels. The vector should be of length |
shape |
Whether to plot shapes for different types of missing values. By default, this is set to FALSE to speed up plotting. We only recommend using 'shape = TRUE' for small datasets. |
Value
Box plot with jittered data points for a numeric/integer variable; Bar plot for a categorical variable.
Examples
# obtain m multiply datasets
params <- list(max_depth = 3, subsample = 0.8, nthread = 2)
imputed.data <- mixgb(data = nhanes3, m = 3, xgb.params = params, nrounds = 30)
# plot the multiply imputed values for variables "BMPHEAD" versus "HSSEX"
plot_1num1fac(
imputation.list = imputed.data, var.num = "BMPHEAD", var.fac = "HSSEX",
original.data = nhanes3
)