missdiag

Comparing Observed and Imputed Values under MAR and MCAR

https://github.com/sumtxt/missdiag

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.1%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

Comparing Observed and Imputed Values under MAR and MCAR

Basic Info
  • Host: GitHub
  • Owner: sumtxt
  • Language: R
  • Default Branch: master
  • Homepage:
  • Size: 130 KB
Statistics
  • Stars: 4
  • Watchers: 1
  • Forks: 2
  • Open Issues: 2
  • Releases: 0
Created about 5 years ago · Last pushed about 4 years ago
Metadata Files
Readme

README.Rmd

---
output:
  github_document:
    html_preview: false
---

```{r, echo=FALSE, messages=FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(knitr)
```

Incomplete data is a common challenge when analyzing real-world data. Another challenge is choosing from many available multiple imputation approaches to fill-in the missing values. Marbach (2021) suggests adopting the imputation approach that generates a density of imputed values most similar to those of the observed values for an incomplete variable after balancing all other covariates. The package facilitates the computation of discrepancy statistics summarizing differences between the density of imputed and observed values and the construction of weights to balance covariates.  


### Installation

```{r, eval=FALSE}
remotes:::install_github("sumtxt/missDiag")
```

To install the `remotes` package use `install.packages("remotes")`. 


### Requirements 

The package can be installed with few dependencies but to construct weights the package relies on either the [ebal](https://cran.r-project.org/web/packages/ebal/index.html) package (Hainmueller, 2012) or the [sbw](https://cran.r-project.org/web/packages/sbw/index.html) package (Zubizarreta 2015). These two packages have be installed by the users separately. 

To install these packages from CRAN use: 

```{r, eval=FALSE}
remotes::install_cran("ebal")
remotes::install_cran("sbw")
```

### Usage 

The package comes with some example data from the 2008 American National Election Study (`anes08`) in which, for example, about 11% of the values in the vote-choice variable are missing. The data have been imputed five times using random value imputation (output data: `anes08_rng`) and predictive mean matching imputation (`anes08_pmm`). We use the `missDiag` package to corroborate that predictive mean matching produces a density of imputed values that is more similar to the (reweighted) density of observed values and should therefore be preferred over random value imputation. We use entropy-balancing weights from the `ebal` package as their computation is faster but stable weights from the `sbw` package are preferable as their variance is smaller. 


```{r}
library(tidyverse)
library(missDiag)

diag_rng <- missDiag( 
 original=anes08, 
 imputed=anes08_rng, 
 adjust = 'ebal',
 formula = vote ~ .)

diag_pmm <- missDiag( 
 original=anes08, 
 imputed=anes08_pmm, 
 adjust = 'ebal',
 formula = vote ~ .)
```

Averaging across the five multiple imputed datasets, we compare the standardized mean differences (SMD) for each of the vote choice categories and find that predictive mean matching does much better than random value imputation. The standardized mean differences are, on average, lower for predictive mean matching. 


```{r}
diag_rng %>% group_by(vname) %>% 
	summarize( smd=mean(diff_adj) )

diag_pmm %>% group_by(vname) %>% 
	summarize( smd=mean(diff_adj) )
```


### References 

Moritz Marbach. 2021. [Choosing Imputation Models](https://arxiv.org/abs/2107.05427), Political Analysis (forthcoming).

José R Zubizarreta. 2015. [Stable Weights that Balance Covariates for Estimation with Incomplete Outcome Data](https://doi.org/10.1080/01621459.2015.1023805), Journal of the American Statistical Association, 110(511): 910-922.
 
Jens Hainmueller. 2012. [Entropy Balancing for Causal Effects: A Multivariate Reweighting Method to Produce Balanced Samples in Observational Studies](https://doi.org/10.1093/pan/mpr025), Political Analysis 20(1): 25–46.

Owner

  • Login: sumtxt
  • Kind: user
  • Location: Germany

GitHub Events

Total
Last Year

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 6
  • Total Committers: 1
  • Avg Commits per committer: 6.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
MM 6

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 1
  • Total pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 1.0
  • Average comments per pull request: 2.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • pdwaggoner (1)
Pull Request Authors
  • pdwaggoner (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 214 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
cran.r-project.org: missDiag

Comparing Observed and Imputed Values under MAR and MCAR

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 214 Last month
Rankings
Forks count: 17.8%
Stargazers count: 24.2%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Average: 38.3%
Downloads: 84.1%
Maintainers (1)
Last synced: 11 months ago

Dependencies

DESCRIPTION cran
  • R >= 2.10 depends
  • Formula >= 1.2 imports
  • cobalt >= 4.1.0 imports
  • ebal >= 0.1 suggests
  • mice >= 3.13.0 suggests
  • sbw >= 1.1.3 suggests