Provides joint analysis and imputation of (generalized) linear regression models, (generalized) linear mixed models and parametric survival models with incomplete (covariate) data in the Bayesian framework. The package performs some preprocessing of the data and creates a 'JAGS' model, which will then automatically be passed to 'JAGS' < http://mcmc-jags.sourceforge.net> with the help of the package 'rjags'. It also provides summary and plotting functions for the output.

The package **JointAI** provides joint analysis and imputation of linear
regression models, generalized linear regression models or linear mixed
models with incomplete (covariate) data in the Bayesian framework.

The package performs some preprocessing of the data and creates a
JAGS model, which will then
automatically be passed to JAGS with
the help of the R package
**rjags**.

**JointAI** also provides summary and plotting functions for the output.

You can install **JointAI** from GitHub with:

# install.packages("devtools")devtools::install_github("NErler/JointAI")

Currently, there are three main functions that perform linear, generalized linear or linear mixed regression:

lm_imp()glm_imp()lme_imp()

`lm_imp()`

and `glm_imp()`

use specification similar to their complete
data counterparts `lm()`

and `glm()`

, whereas `lme_imp()`

uses similar
specification as `lme()`

from the package
**nlme**.

Functions `summary()`

, `traceplot()`

, `densityplot()`

provide a summary
of the posterior distribution and its visualization.

`gr_crit()`

and `mc_error()`

provide the Gelman-Rubin diagnostic for
convergence and the Monte Carlo error of the MCMC sample, respectively.

`monitor_params`

is now checked to avoid problems when only part of the main parameters is selected- categorical imputation models now use min-max trick to prevent probabilities outside [0, 1]
- initial value generation for logistic analysis model fixed
- bugfix in re-ordering columns when a function is part of the linear predictor
- bugfix in intial values for categorical covariates
- bugfix in finding imputation method when function of variable is specified as auxiliary variable

`md.pattern()`

now uses ggplot, which scales better than the previous version`lm_imp()`

,`glm_imp()`

and`lme_imp()`

now ask about overwriting a model file`analysis_main = T`

stays selected when other parameters are followed as well`get_MIdat()`

: argument`include`

added to select if original data are included and id variable`.id`

is added to the dataset`subset`

argument uses same logit as`monitor_params`

argument- added switch to hide messages; distinction between messages and warnings
`lm_imp()`

,`glm_imp()`

and`lme_imp()`

now take argument`trunc`

in order to truncate the distribution of incomplete variables`summary()`

now omits auxiliary variables from the output`imp_par_list`

is now returned from JointAI models`cat_vars`

is no longer returned from`lm_imp()`

,`glm_imp()`

and`lme_imp()`

, because it is contained in`Mlist$refs`

`plot_all()`

function added`densplot()`

and`traceplot()`

optional with ggplot`densplot()`

option to combine chains before plotting- example datasets
`NHANES`

,`simLong`

and`simWide`

added `list_impmodels`

to print information on the imputation models and hyperparameters`parameters()`

added to display the parameters to be/that were monitored`set_refcat()`

added to guide specification of reference categories- extension of possible functions of variables in model formula to (almost all) functions that are available in JAGS
- added vignettes
*Minimal Example*,*Visualizing Incomplete Data*,*Parameter Selection*and*Model Specification*

`md_pattern()`

: does not generate duplicate plot any more- corrected names of imputation methods in help file
- scaling when no continuous covariates are in the model or scaling is deselected fixed
- initial value specification for coefficient for auxiliary variables fixed
`get_MIdat()`

: imputed values are now filled in in the correct order`get_MIdat()`

: variables imputed with`lognorm`

are now included when extracting an imputed dataset`get_MIdat()`

: imputed values of transformed variables are now included in imputed datasets- problem with non valid names of factor labels fixed
- data matrix is now ordered according to order in user-specified
`meth`

argument

`md.pattern()`

: adaptation to new version of`md.pattern()`

from the**mice**package- internally change all
`NaN`

to`NA`

- allow for scaling of incomplete covariates with quadratic effects
- changed hyperparameter for precision in models with logit link from 4/9 to 0.001

`gamma`

and`beta`

imputation methods implemented