JointAI (version 0.5.1)

get_models: Set default (imputation) models and order

Description

Set default (imputation) models and order

Usage

get_models(fixed, random = NULL, data, auxvars = NULL,
  no_model = NULL)

get_imp_meth(fixed, random = NULL, data, auxvars = NULL, no_model = NULL)

Arguments

fixed

a two sided formula describing the fixed-effects part of the model (see formula)

random

only for lme_imp, glme_imp and clmm_imp: a one-sided formula of the form ~x1 + ... + xn | g, where x1 + ... + xn specifies the model for the random effects and g the grouping variable

data

a data.frame

auxvars

optional vector of variable names that should be used as predictors in the imputation procedure (and will be imputed if necessary) but are not part of the analysis model

no_model

names of variables for which no model should be specified. Note that this is only possible for completely observed variables and may imply assumptions of independence between the excluded variable and incomplete variables.

Value

get_models() returns a list of two vectors named models and meth. models is a named vector containing the names of covariates that either have missing values and/or are longitudinal (level-1) covariates and the corresponding default (imputation) models. meth is a subset of models containing only the variables that have missing values.

Examples

Run this code
# NOT RUN {
get_models(y ~ C1 + C2 + B2 + O2 + M2, data = wideDF)
get_imp_meth(y ~ C1 + C2 + B2 + O2 + M2, data = wideDF)

get_models(y ~ C1 + O2 + c2 + b1 + o2 + time, random = ~ 1 | id, data = longDF)
get_imp_meth(y ~ C1 + O2 + c2 + b1 + o2 + time, random = ~ 1 | id, data = longDF)

get_models(y ~ C1 + O2 + c2 + b1 + o2 + time, random = ~ 1 | id,
           no_model = 'time', data = longDF)

# }

Run the code above in your browser using DataCamp Workspace