-
Notifications
You must be signed in to change notification settings - Fork 3
/
README.Rmd
96 lines (75 loc) · 2.86 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
---
output:
md_document:
variant: markdown_github
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# ImputeRobust: Multiple Imputation with GAMLSS
The `ImputeRobust` package adds
to [https://cran.r-project.org/web/packages/mice/index.html](MICE) 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.
## Installation
The latest version can be installed from GitHub as follows:
```{r eval = FALSE}
install.packages("devtools")
devtools::install_git(url = "https://github.com/dsalfran/ImputeRobust",
branch = "master")
```
## Main functions
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 |
## Examples
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:
```{r, echo = FALSE}
load('data/sample.rda')
suppressMessages(library(ImputeRobust))
```
```{r}
# First lines of the data set
head(sample.data)
```
```{r}
# Missing pattern
md.pattern(sample.data)
```
```{r, eval = FALSE}
# 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.
![](sample.png)
## References
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.