formula: A formula specifying the cosinor model to be fit. The cosinor portion of the formula is controlled by including amp_acro() on the right hand side of the formula. See amp_acro for more details.
data: A data.frame containing the variables used in the model.
family: A family function or a character string naming a family function. See ?family and ?glmmTMB::family_glmmTMB for options.
quietly: A logical. If TRUE, shows warning messages when wrangling data and fitting model. Defaults to TRUE.
dispformula: A one-sided (i.e., no response variable) formula
for dispersion combining fixed and random effects, including cosinor components using amp_acro(). Defaults to ~1.
ziformula: A one-sided (i.e., no response variable) formula
for zero-inflation combining fixed and random effects, including cosinor components using amp_acro(). Defaults to ~0.
...: Optional additional arguments passed to glmmTMB::glmmTMB().
Returns
Returns a fitted cosinor model as a cglmm object.
Examples
# Single component cosinor modelcglmm( vit_d ~ amp_acro(time_col = time, group ="X", period =12), data = vitamind
)# 2-component cosinor model with simulated datasim_data <- simulate_cosinor( n =500, mesor =5, amp = c(2,1), acro = c(1,1.5), beta.mesor =2, beta.amp = c(2,1), beta.acro = c(1,1.5), family ="gaussian", period = c(12,6), n_components =2, beta.group =TRUE,)cglmm( Y ~ group + amp_acro(times, n_components =2, group ="group", period = c(12,6)), data = sim_data, family = gaussian
)