JointAI (version 0.5.1)

set_refcat: Set the reference categories for all categorical covariates in the model

Description

The function asks questions and, depending on the answers given by the user, returns the input for the argument refcats in the functions lm_imp, glm_imp, clm_imp, lme_imp, glme_imp, clmm_imp, survreg_imp and coxph_imp.

Usage

set_refcat(data, formula, covars, auxvars)

Arguments

data

a data.frame

formula

optional; model formula (used to select subset of relevant columns of data)

covars

optional; vector containing the names of relevant columns of data

auxvars

optional; vector containing the names of relevant columns of data that should be considered additionally to the columns occurring in the formula

Examples

Run this code
# NOT RUN {
# Example 1: set reference categories for the whole dataset and choose answer option 3:
set_refcat(data = NHANES)
3

# insert the returned string as argument refcats
mod1 <- lm_imp(SBP ~ age + race + creat + educ, data = NHANES, refcats = 'largest')

# Example 2:
# specify a model formula
fmla <- SBP ~ age + gender + race + bili + smoke + alc

# write the output of set_refcat to an object
ref_mod2 <- set_refcat(data = NHANES, formula = fmla)
4
2
5
1
1

# enter the output in the model specification
mod2 <- lm_imp(formula = fmla, data = NHANES, refcats = ref_mod2, n.adapt = 0)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab