update_formula_and_data function

Update data and formula for fitting cglmm model

Update data and formula for fitting cglmm model

update_formula_and_data( data, formula, family = "gaussian", quietly = TRUE, dispformula = ~1, ziformula = ~0 )

Arguments

  • data: input data for fitting cglmm model.
  • formula: model formula, specified by user including amp_acro().
  • family: the model family.
  • quietly: controls whether messages from amp_acro are displayed. TRUE by default
  • dispformula: The formula specifying the dispersion model
  • ziformula: The formula specifying the zero-inflation model

Returns

Returns a list.

Examples

# Use vitamind data but add a "patient" identifier used as a random effect vitamind2 <- vitamind vitamind2$patient <- sample( LETTERS[1:5], size = nrow(vitamind2), replace = TRUE ) # Use update_formula_and_data() to perform wrangling steps of cglmm() # without yet fitting the model data_and_formula <- update_formula_and_data( data = vitamind2, formula = vit_d ~ X + amp_acro(time, group = "X", period = 12 ) ) # print formula from above data_and_formula$newformula # fit model while adding random effect to cosinor model formula. mod <- fit_model_and_process( obj = data_and_formula, formula = update.formula( data_and_formula$newformula, . ~ . + (1 | patient) ) ) mod mod$fit # printing the `glmmTMB` model within shows Std.Dev. of random effect