knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
The ImputeRobust
package adds
to https://cran.r-project.org/web/packages/mice/index.html an
imputation method based on generalized additive models for location,
scale, and shape introduced by de Jong (2012), de Jong, van Buuren and
Spiess (2016). It has been tested mostly with continous variables,
count, and binary data.
The latest version can be installed from GitHub as follows:
install.packages("devtools") devtools::install_git(url = "https://github.com/dsalfran/ImputeRobust", branch = "master")
The main function in the ImputeRobust
package is
mice.impute.gamlss()
which model the response distribution with a
Normal distribution. All other functions are variants of the main
function with a different fixed response distribution.
|Function Name | Response distribution |
|--------------------------|---------------------------------------------------------------------- |
|mice.impute.gamlss()
| Normal |
|mice.impute.gamlssBI()
| Binomial |
|mice.impute.gamlssJSU()
| Johnson's SU |
|mice.impute.gamlssPO()
| Poisson |
|mice.impute.gamlssTF()
| t-distribution |
|mice.impute.gamlssZIBI()
| Zero inflated binomial |
|mice.impute.gamlssZIP()
| Zero inflated Poisson |
The package is intended to be used with mice, adding new methods based on GAMLSS. For example, let's say we have a data sets with missing values:
load('data/sample.rda') suppressMessages(library(ImputeRobust))
# First lines of the data set head(sample.data)
# Missing pattern md.pattern(sample.data)
# Create the imputed data sets imputed.sets <- mice(sample.data, method = c("gamlss", "gamlssPO", "gamlssJSU", "gamlssBI", "gamlss"), visitSequence = "monotone", maxit = 1, seed = 97123)
In the following plot the red circles represent the imputed values and the blue circles the observed data.
de Jong, R., van Buuren, S. & Spiess, M. (2016) Multiple Imputation of Predictor Variables Using Generalized Additive Models. Communications in Statistics -- Simulation and Computation, 45(3), 968--985.
de Jong, Roel. (2012). “Robust Multiple Imputation.” Universität Hamburg. \url{http://ediss.sub.uni-hamburg.de/volltexte/2012/5971/}.
Rigby, R. A., and Stasinopoulos, D. M. (2005). Generalized Additive Models for Location, Scale and Shape. Journal of the Royal Statistical Society: Series C (Applied Statistics) 54 (3): 507–54.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.