amp_acro function

Used to specify a cosinor component in the model formula.

Used to specify a cosinor component in the model formula.

Checks the validity of user inputs before creating an updated formula and associated modifications to the data.frame.

amp_acro(time_col, n_components = 1, group, period, ...)

Arguments

  • time_col: A numeric column within the data.frame()

    passed by via the data arg containing the time values.

  • n_components: The Number of cosinor components in the model.

  • group: A vector of the names for the group factors (column names within the data.frame() passed by via the data arg).

  • period: A numeric value or vector containing the period. The number of values should be equal to n_components.

  • ...: Extra arguments for use within GLMMcosinor.

Returns

A data.frame and formula appropriate for use by data_processor().

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 )