cglmm {GLMMcosinor} | R Documentation |
Fit cosinor model with {glmmTMB}
Description
Given an outcome and time variable, fit the cosinor model with optional covariate effects.
Usage
cglmm(
formula,
data,
family = stats::gaussian(),
quietly = TRUE,
dispformula = ~1,
ziformula = ~0,
...
)
Arguments
formula |
A |
data |
A |
family |
A |
quietly |
A |
dispformula |
A one-sided (i.e., no response variable) |
ziformula |
A one-sided (i.e., no response variable) |
... |
Optional additional arguments passed to |
Value
Returns a fitted cosinor model as a cglmm
object.
References
Tong, YL. Parameter Estimation in Studying Circadian Rhythms, Biometrics (1976). 32(1):85–94.
Examples
# Single component cosinor model
cglmm(
vit_d ~ amp_acro(time_col = time, group = "X", period = 12),
data = vitamind
)
# 2-component cosinor model with simulated data
sim_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
)