Title: | Visualizations for 'mice' with 'ggplot2' |
Version: | 0.1.0 |
Description: | Enhance a 'mice' imputation workflow with visualizations for incomplete and/or imputed data. The plotting functions produce 'ggplot' objects which may be easily manipulated or extended. Use 'ggmice' to inspect missing data, develop imputation models, evaluate algorithmic convergence, or compare observed versus imputed data. |
License: | GPL (≥ 3) |
URL: | https://github.com/amices/ggmice, https://amices.org/, https://amices.org/ggmice/ |
BugReports: | https://github.com/amices/ggmice |
Imports: | cli, dplyr, ggplot2, magrittr, mice, purrr, rlang, stats, stringr, tidyr, tidyselect, utils |
Suggests: | covr, knitr, patchwork, plotly, rmarkdown, testthat (≥ 3.0.0) |
VignetteBuilder: | knitr |
Config/testthat/edition: | 3 |
Copyright: | 'ggmice' authors |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
NeedsCompilation: | no |
Packaged: | 2023-08-07 13:33:30 UTC; 4216318 |
Author: | Hanne Oberman |
Maintainer: | Hanne Oberman <h.i.oberman@uu.nl> |
Repository: | CRAN |
Date/Publication: | 2023-08-07 14:20:02 UTC |
Pipe operator
Description
See magrittr::%>%
for details.
Usage
lhs %>% rhs
Arguments
lhs |
A value or the magrittr placeholder. |
rhs |
A function call using the magrittr semantics. |
Value
The result of calling rhs(lhs)
.
Box-and-whisker plot of observed and imputed data
Description
Box-and-whisker plot of observed and imputed data
Usage
bwplot(...)
Arguments
... |
Any arguments passed to the function. |
Value
The output of mice::bwplot and a message about the ggmice
equivalent.
Examples
imp <- mice::mice(mice::nhanes, maxit = 1, printFlag = FALSE)
bwplot(imp)
Densityplot of observed and imputed data
Description
Densityplot of observed and imputed data
Usage
densityplot(...)
Arguments
... |
Any arguments passed to the function. |
Value
The output of mice::densityplot and a message about the ggmice
equivalent.
Examples
imp <- mice::mice(mice::nhanes, maxit = 1, printFlag = FALSE)
densityplot(imp)
Plot incomplete or imputed data
Description
Plot incomplete or imputed data
Usage
ggmice(data = NULL, mapping = ggplot2::aes())
Arguments
data |
An incomplete dataset (of class |
mapping |
A list of aesthetic mappings created with |
Value
An object of class ggplot2::ggplot
.
See Also
See the ggmice
vignette to use the ggmice()
function on
incomplete data
or imputed data.
Examples
dat <- mice::nhanes
ggmice(dat, ggplot2::aes(x = age, y = bmi)) + ggplot2::geom_point()
Plot correlations between (incomplete) variables
Description
Plot correlations between (incomplete) variables
Usage
plot_corr(
data,
vrb = "all",
label = FALSE,
square = TRUE,
diagonal = FALSE,
rotate = FALSE,
caption = TRUE
)
Arguments
data |
A dataset of class |
vrb |
String, vector, or unquoted expression with variable name(s), default is "all". |
label |
Logical indicating whether correlation values should be displayed. |
square |
Logical indicating whether the plot tiles should be squares. |
diagonal |
Logical indicating whether the correlation of each variable with itself should be displayed. |
rotate |
Logical indicating whether the variable name labels should be rotated 90 degrees. |
caption |
Logical indicating whether the figure caption should be displayed. |
Value
An object of class ggplot2::ggplot.
Examples
plot_corr(mice::nhanes, label = TRUE)
Plot the influx and outflux of a multivariate missing data pattern
Description
Plot the influx and outflux of a multivariate missing data pattern
Usage
plot_flux(data, vrb = "all", label = TRUE, caption = TRUE)
Arguments
data |
An incomplete dataset of class |
vrb |
String, vector, or unquoted expression with variable name(s), default is "all". |
label |
Logical indicating whether variable names should be displayed within the plot (the default) or with colors in the legend. |
caption |
Logical indicating whether the figure caption should be displayed. |
Value
An object of class ggplot2::ggplot.
Examples
plot_flux(mice::nhanes)
Plot the missing data pattern of an incomplete dataset
Description
Plot the missing data pattern of an incomplete dataset
Usage
plot_pattern(
data,
vrb = "all",
square = TRUE,
rotate = FALSE,
cluster = NULL,
npat = NULL,
caption = TRUE
)
Arguments
data |
An incomplete dataset of class |
vrb |
String, vector, or unquoted expression with variable name(s), default is "all". |
square |
Logical indicating whether the plot tiles should be squares, defaults to squares to mimick |
rotate |
Logical indicating whether the variable name labels should be rotated 90 degrees. |
cluster |
Optional character string specifying which variable should be used for clustering (e.g., for multilevel data). |
npat |
Optional numeric input specifying the number of missing data patterns to be visualized, defaults to all patterns. |
caption |
Logical indicating whether the figure caption should be displayed. |
Value
An object of class ggplot2::ggplot.
Examples
plot_pattern(mice::nhanes)
Plot the predictor matrix of an imputation model
Description
Plot the predictor matrix of an imputation model
Usage
plot_pred(
data,
vrb = "all",
method = NULL,
label = TRUE,
square = TRUE,
rotate = FALSE
)
Arguments
data |
A predictor matrix for |
vrb |
String, vector, or unquoted expression with variable name(s), default is "all". |
method |
Character string or vector with imputation methods. |
label |
Logical indicating whether predictor matrix values should be displayed. |
square |
Logical indicating whether the plot tiles should be squares. |
rotate |
Logical indicating whether the variable name labels should be rotated 90 degrees. |
Value
An object of class ggplot2::ggplot
.
Examples
pred <- mice::quickpred(mice::nhanes)
plot_pred(pred)
Plot the trace lines of the imputation algorithm
Description
Plot the trace lines of the imputation algorithm
Usage
plot_trace(data, vrb = "all")
Arguments
data |
An object of class mice::mids. |
vrb |
String, vector, or unquoted expression with variable name(s), default is "all". |
Value
An object of class ggplot2::ggplot.
Examples
imp <- mice::mice(mice::nhanes, print = FALSE)
plot_trace(imp)
Stripplot of observed and imputed data
Description
Stripplot of observed and imputed data
Usage
stripplot(...)
Arguments
... |
Any arguments passed to the function. |
Value
The output of mice::stripplot and a message about the ggmice
equivalent.
Examples
imp <- mice::mice(mice::nhanes, maxit = 1, printFlag = FALSE)
stripplot(imp)
Theme for mice style ggplot2::ggplot objects
Description
Theme for mice style ggplot2::ggplot objects
Usage
theme_mice()
Value
A ggplot2 theme.
Minimal theme for mice style ggplot2::ggplot objects
Description
Minimal theme for mice style ggplot2::ggplot objects
Usage
theme_minimice()
Value
A ggplot2 theme.
Scatterplot of observed and imputed data
Description
Scatterplot of observed and imputed data
Usage
xyplot(...)
Arguments
... |
Any arguments passed to the function. |
Value
The output of mice::xyplot and a message about the ggmice
equivalent.
Examples
imp <- mice::mice(mice::nhanes, maxit = 1, printFlag = FALSE)
xyplot(imp, bmi ~ age)