Last data update: 2014.03.03

R: Combine Multiple Results From Multiply Imputed Datasets
mi.meldR Documentation

Combine Multiple Results From Multiply Imputed Datasets

Description

Combine sets of estimates (and their standard errors) generated from different multiply imputed datasets into one set of results.

Usage

mi.meld(q, se, byrow = TRUE)

Arguments

q

A matrix or data frame of (k) quantities of interest (eg. coefficients, parameters, means) from (m) multiply imputed datasets. Default is to assume the matrix is m-by-k (see byrow), thus each row represents a set of results from one dataset, and each column represents the different values of a particular quantity of interest across the imputed datasets.

se

A matrix or data frame of standard errors that correspond to each of the elements of the quantities of interest in q. Should be the same dimensions as q.

byrow

logical. If TRUE, q and se are treated as though each row represents the set of results from one dataset (thus m-by-k). If FALSE, each column represents results from one dataset (thus k-by-m).

Details

Uses Rubin's rules for combining a set of results from multiply imputed datasets to reflect the average result, with standard errors that both average uncertainty across models and account for disagreement in the estimated values across the models.

Value

q.mi

Average value of each quantity of interest across the m models

se.mi

Standard errors of each quantity of interest

References

Rubin, D. (1987). Multiple Imputation for Nonresponse in Surveys. New York: Wiley.

Honaker, J., King, G., Honaker, J. Joseph, A. Scheve K. (2001). Analyzing Incomplete Political Science Data: An Alternative Algorithm for Multiple Imputation American Political Science Review, 95(1), 49–69. (p53)

Examples

data(africa)
m <- 5
a.out <- amelia(x = africa, m=m, cs = "country", ts = "year", logs = "gdp_pc")

b.out<-NULL
se.out<-NULL
for(i in 1:m) {
  ols.out <- lm(civlib ~ trade ,data = a.out$imputations[[i]])
  b.out <- rbind(b.out, ols.out$coef)
  se.out <- rbind(se.out, coef(summary(ols.out))[,2])
}

combined.results <- mi.meld(q = b.out, se = se.out)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Amelia)
Loading required package: Rcpp
## 
## Amelia II: Multiple Imputation
## (Version 1.7.4, built: 2015-12-05)
## Copyright (C) 2005-2016 James Honaker, Gary King and Matthew Blackwell
## Refer to http://gking.harvard.edu/amelia/ for more information
## 
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Amelia/mi.meld.Rd_%03d_medium.png", width=480, height=480)
> ### Name: mi.meld
> ### Title: Combine Multiple Results From Multiply Imputed Datasets
> ### Aliases: mi.meld
> 
> ### ** Examples
> 
> data(africa)
> m <- 5
> a.out <- amelia(x = africa, m=m, cs = "country", ts = "year", logs = "gdp_pc")
-- Imputation 1 --

  1  2  3

-- Imputation 2 --

  1  2

-- Imputation 3 --

  1  2

-- Imputation 4 --

  1  2  3

-- Imputation 5 --

  1  2

> 
> b.out<-NULL
> se.out<-NULL
> for(i in 1:m) {
+   ols.out <- lm(civlib ~ trade ,data = a.out$imputations[[i]])
+   b.out <- rbind(b.out, ols.out$coef)
+   se.out <- rbind(se.out, coef(summary(ols.out))[,2])
+ }
> 
> combined.results <- mi.meld(q = b.out, se = se.out)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>