plot_impute: Plot imputations

Description Usage Arguments Details Value Examples

Description

Plot imputations for data from multiple methods

Usage

1
2
3
4
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 ts for testing

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 is used.

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 smps = 'mar'

blckper

logical indicating if the value passed to blck is a percentage of the sample size for missing data, otherwise blck indicates number of observations

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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)

Example output



imputeTestbench documentation built on July 6, 2019, 1:03 a.m.