plot_impute {imputeTestbench} | R Documentation |
Plot imputations
Description
Plot imputations for data from multiple methods
Usage
plot_impute(dataIn, smps = "mcar", methods = c("na.approx",
"na.interp", "na_interpolation", "na.locf", "na_mean"),
methodPath = NULL, blck = 50, blckper = TRUE, missPercent = 50,
showmiss = FALSE, addl_arg = NULL)
Arguments
dataIn |
input |
smps |
chr string indicating sampling type for generating missing data, see details |
methods |
chr string of imputation methods to use, one to many. A user-supplied function can be included if |
methodPath |
chr string of location of script containing one or more functions for the proposed imputation method(s) |
blck |
numeric indicating block sizes as a percentage of the sample size for the missing data, applies only if |
blckper |
logical indicating if the value passed to |
missPercent |
numeric for percent of missing values to be considered |
showmiss |
logical if removed values missing from the complete dataset are plotted |
addl_arg |
arguments passed to other imputation methods as a list of lists, see details. |
Details
See the documentation for impute_errors
for an explanation of the arguments.
Value
A ggplot
object showing the imputed data for each method. Red points are labelled as 'imputed' and blue points are labelled as 'retained' from the original data set. Missing data that were removed can be added to the plot as open circles if showmiss = TRUE
. See the examples for modifying the plot.
Examples
# default
plot_impute(dataIn = nottem)
# change missing percent total
plot_impute(dataIn = nottem, missPercent = 10)
# show missing values
plot_impute(dataIn = nottem, showmiss = TRUE)
# use mar sampling
plot_impute(dataIn = nottem, smps = 'mar')
# change the plot aesthetics
## Not run:
library(ggplot2)
p <- plot_impute(dataIn = nottem, smps = 'mar')
p + scale_colour_manual(values = c('black', 'grey'))
p + theme_minimal()
p + ggtitle('Imputation examples with different methods')
p + scale_y_continuous('Temp at Nottingham Castle (F)')
## End(Not run)