extract_varnames: Function to extract the different elements of a formula

Description Usage Arguments Value

Description

The function searches for the target variable, fixed effects variables, if there is a cluster ID: this and the random effects variables.
The names of the fixed and random intercepts variable (if existent) are explicitly labeled In imputation models, the target variable can act as covariate for other covariates - so we treat the target variable as fix effect variable.

Usage

1
2
3
4
5
6
extract_varnames(
  model_formula = NULL,
  constant_variables,
  variable_names_in_data = colnames(data),
  data
)

Arguments

model_formula

A formula (from class formula)

constant_variables

A Boolean-vector of length equal to the number of columns in the data set specifying whether a variable is a constant variable (eg. an intercept variable) or not.

variable_names_in_data

A character-vector with the column names of the data set.

data

The data.frame the formula belongs to.

Value

A list with the names of the target variable, the intercept variable, the fixed and random effects covariates (which includes the name of the target variable), the variables with interactions and the cluster id variable.
If some of them don't exist, they get the value "".


hmi documentation built on Oct. 23, 2020, 7:31 p.m.