circacompare {circacompare}R Documentation

circacompare

Description

circacompare performs a comparison between two rhythmic groups of data. It tests for rhythmicity and then fits a nonlinear model with parametrization to estimate and statistically support differences in mesor, amplitude, and phase between groups.

Usage

circacompare(
  x,
  col_time,
  col_group,
  col_outcome,
  period = 24,
  alpha_threshold = 0.05,
  timeout_n = 10000,
  control = list(),
  weights = NULL,
  suppress_all = FALSE
)

Arguments

x

data.frame. This is the data.frame which contains the rhythmic data for two groups in a tidy format.

col_time

The name of the column within the data.frame, x, which contains time in hours at which the data were collected.

col_group

The name of the column within the data.frame, x, which contains the grouping variable. This should only have two levels.

col_outcome

The name of the column within the data.frame, x, which contains outcome measure of interest.

period

The period of the rhythm. For circadian rhythms, leave this as the default value, 24.

alpha_threshold

The level of alpha for which the presence of rhythmicity is considered. Default is 0.05.

timeout_n

The upper limit for the model fitting attempts. Default is 10,000.

control

list. Used to control the parameterization of the model.

weights

An optional numeric vector of (fixed) weights. When present, the objective function is weighted least squares.

suppress_all

Logical. Set to TRUE to avoid seeing errors or messages during model fitting procedure. Default is FALSE.

Value

list

Examples

df <- make_data(phi1 = 6)
out <- circacompare(
  x = df, col_time = "time", col_group = "group",
  col_outcome = "measure"
)
out

# with sample weights (arbitrary weights for demonstration)
sw <- runif(n = nrow(df))
out2 <- circacompare(
  x = df, col_time = "time", col_group = "group",
  col_outcome = "measure", weights = sw
)
out2


[Package circacompare version 0.2.0 Index]