JointAI (version 0.6.1)

get_models: Specify the default (imputation) model types

Description

Specify the default (imputation) model types

Usage

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

Arguments

fixed

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

random

only for multi-level models: 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 one-sided formula of variables 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 implies the assumptions of independence between the excluded variable and the incomplete variables.

models

optional named vector specifying the types of models for (incomplete) covariates. This arguments replaces the argument meth used in earlier versions. If NULL (default) models will be determined automatically based on the class of the respective columns of data.

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 (imputation) models as well as models for variables for which the user has specified a model. 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_models(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)

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

# }

Run the code above in your browser using DataLab