JointAI

Joint Analysis and Imputation of generalized linear models and linear mixed models with missing values

https://github.com/nerler/jointai

Science Score: 26.0%

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

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (19.0%) to scientific vocabulary

Keywords

bayesian generalized-linear-models glm glmm imputation imputations jags joint-analysis linear-mixed-models linear-regression-models mcmc-sample mcmc-sampling missing-data missing-values rstats survival
Last synced: 6 months ago · JSON representation

Repository

Joint Analysis and Imputation of generalized linear models and linear mixed models with missing values

Basic Info
Statistics
  • Stars: 28
  • Watchers: 3
  • Forks: 4
  • Open Issues: 6
  • Releases: 0
Topics
bayesian generalized-linear-models glm glmm imputation imputations jags joint-analysis linear-mixed-models linear-regression-models mcmc-sample mcmc-sampling missing-data missing-values rstats survival
Created over 9 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog

README.Rmd

---
output: github_document
---



```{r, echo = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  fig.align = 'center'
)
```


# JointAI: Joint Analysis and Imputation of Incomplete Data 



[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version-last-release/JointAI)](https://CRAN.R-project.org/package=JointAI)
[![](https://cranlogs.r-pkg.org/badges/grand-total/JointAI)](https://CRAN.R-project.org/package=JointAI)
[![Download counter](https://cranlogs.r-pkg.org/badges/JointAI)](https://cran.r-project.org/package=JointAI)
[![codecov](https://codecov.io/gh/NErler/JointAI/branch/master/graph/badge.svg)](https://app.codecov.io/gh/NErler/JointAI)
[![R build status](https://github.com/NErler/JointAI/workflows/R-CMD-check/badge.svg)](https://github.com/NErler/JointAI/actions)




The package **JointAI** provides functionality to perform joint analysis and
imputation of a range of model types in the Bayesian framework. Implemented are
(generalized) linear regression models and extensions thereof, models for
(un-/ordered) categorical data, as well as multi-level (mixed) versions of these
model types.

Moreover, survival models and joint models for longitudinal and survival data
are available. It is also possible to fit multiple models of mixed types
simultaneously. Missing values in (if present) will be imputed automatically.

**JointAI** performs some preprocessing of the data and creates a
[JAGS](https://mcmc-jags.sourceforge.io/) model, which will then automatically be
passed to [JAGS](https://mcmc-jags.sourceforge.io/) with the help of the R
package [**rjags**](https://CRAN.R-project.org/package=rjags).

Besides the main modelling functions, **JointAI** also provides a number of
functions to summarize and visualize results and incomplete data.



    
## Installation

**JointAI** can be installed from [CRAN](https://cran.r-project.org/):
```{r CRAN-instalation, eval = FALSE}
install.packages('JointAI')
```

Alternatively, you can install **JointAI** from GitHub:
```{r gh-installation, eval = FALSE}
# install.packages("remotes")
remotes::install_github("NErler/JointAI")
```


## Main functions
**JointAI** provides the following main functions:

``` r
lm_imp()                 # linear regression
glm_imp()                # generalized linear regression
clm_imp()                # cumulative logit model
mlogit_imp()             # multinomial logit model
lognorm_imp()            # log-normal regression
betareg_imp()            # beta regression
lme_imp() / lmer_imp()   # linear mixed model
glme_imp() / glmer_imp() # generalized linear mixed model
clmm_imp()               # cumulative logit mixed model
mlogitmm_imp()           # multinomial logit model
lognormmm_imp()          # log-normal regression
betamm_imp()             # beta regression
survreg_imp()            # parametric (Weibull) survival model
coxph_imp()              # proportional hazards survival model
JM_imp()                 # joint model for longitudinal and survival data
```

The functions use specification similar to that of well known standard functions
like `lm()` and `glm()` from base R, `nlme::lme()` (from the package
[**nlme**](https://CRAN.R-project.org/package=nlme)) , `lme4::lmer()` or
`lme4::glmer()` (from the package
[**lme4**](https://CRAN.R-project.org/package=lme4)) and `survival::survreg()`
and `survival::coxph()` (from the package
[**survival**](https://CRAN.R-project.org/package=survival)).


Functions `summary()`, `coef()`, `traceplot()` and `densplot()` provide a
summary of the posterior distribution and its visualization.

`GR_crit()` and `MC_error()` implement the Gelman-Rubin diagnostic for
convergence and the Monte Carlo error of the MCMC sample, respectively.

**JointAI** also provides functions for exploration of the distribution of the
data and missing values, export of imputed values and prediction.


## Minimal Example
### Visualize the observed data and missing data pattern
```{r, echo = FALSE}
par(mar = c(2.5, 3, 2.5, 1), mgp = c(2, 0.8, 0))
```

```{r, fig.width = 8, fig.height = 4, message = FALSE, collapse=TRUE}
library(JointAI)

plot_all(NHANES[c(1, 5:6, 8:12)], fill = '#D10E3B', border = '#460E1B', ncol = 4, breaks = 30)
```


```{r, fig.height = 5}
md_pattern(NHANES, color = c('#460E1B', '#D10E3B'))
```

### Fit a linear regression model with incomplete covariates

```{r fit_lm1, message = F}
lm1 <- lm_imp(SBP ~ gender + age + WC + alc + educ + bili,
              data = NHANES, n.iter = 500, progress.bar = 'none', seed = 2020)
```

### Visualize the MCMC sample
```{r fig.width = 8, fig.height = 4, out.width = '100%', dpi = 300}
traceplot(lm1, col = c('#d4af37', '#460E1B', '#D10E3B'), ncol = 4)
```

```{r fig.width = 8, fig.height = 4, out.width = '100%', dpi = 300}
densplot(lm1, col = c('#d4af37', '#460E1B', '#D10E3B'), ncol = 4, lwd = 2)
```

### Summarize the Result
```{r}
summary(lm1)
```

```{r}
coef(lm1)

confint(lm1)
```

Owner

  • Name: Nicole Erler
  • Login: NErler
  • Kind: user
  • Location: Rotterdam
  • Company: Erasmus MC

GitHub Events

Total
  • Create event: 1
  • Commit comment event: 1
  • Issues event: 1
  • Delete event: 2
  • Push event: 5
  • Pull request review event: 2
  • Pull request event: 1
Last Year
  • Create event: 1
  • Commit comment event: 1
  • Issues event: 1
  • Delete event: 2
  • Push event: 5
  • Pull request review event: 2
  • Pull request event: 1

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 2,212
  • Total Committers: 5
  • Avg Commits per committer: 442.4
  • Development Distribution Score (DDS): 0.053
Past Year
  • Commits: 37
  • Committers: 2
  • Avg Commits per committer: 18.5
  • Development Distribution Score (DDS): 0.027
Top Committers
Name Email Commits
Nicole Erler n****r@e****l 2,094
N.S. Erler 2****5@e****l 95
Nicole Erler N****r 12
NErler e****e@g****m 9
GitHub Actions a****s@g****m 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 15
  • Total pull requests: 2
  • Average time to close issues: 3 months
  • Average time to close pull requests: N/A
  • Total issue authors: 11
  • Total pull request authors: 2
  • Average comments per issue: 1.2
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • amirabadiza921 (3)
  • KentSLDES (2)
  • bbb801 (2)
  • axinaxia (1)
  • jenniejester (1)
  • SiljeHS (1)
  • jlhanson5 (1)
  • YushuShi (1)
  • Erfanit64 (1)
  • harryparr (1)
  • johnsonra (1)
  • mikoSL (1)
Pull Request Authors
  • johnsonra (1)
  • NErler (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 591 last-month
  • Total docker downloads: 42,767
  • Total dependent packages: 2
  • Total dependent repositories: 3
  • Total versions: 16
  • Total maintainers: 1
cran.r-project.org: JointAI

Joint Analysis and Imputation of Incomplete Data

  • Versions: 16
  • Dependent Packages: 2
  • Dependent Repositories: 3
  • Downloads: 591 Last month
  • Docker Downloads: 42,767
Rankings
Docker downloads count: 0.6%
Stargazers count: 10.2%
Forks count: 12.2%
Average: 12.2%
Dependent packages count: 13.6%
Dependent repos count: 16.4%
Downloads: 20.3%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • MASS * imports
  • coda * imports
  • future * imports
  • mathjaxr * imports
  • mcmcse * imports
  • rjags * imports
  • rlang * imports
  • survival * imports
  • bookdown * suggests
  • covr * suggests
  • foreign * suggests
  • ggplot2 * suggests
  • ggpubr * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • testthat * suggests