amp_acro {GLMMcosinor}R Documentation

Used to specify a cosinor component in the model formula.

Description

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

Usage

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.

Value

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
)

[Package GLMMcosinor version 0.2.0 Index]