circa_single {circacompare} | R Documentation |
circa_single
Description
circa_single
performs an analysis on a single rhythmic dataset. It estimates the mesor, amplitude and phase of the data provided.
Usage
circa_single(
x,
col_time,
col_outcome,
period = 24,
alpha_threshold = 0.05,
timeout_n = 10000,
return_figure = TRUE,
control = list(),
weights = NULL,
suppress_all = FALSE
)
Arguments
x |
data.frame. This is the data.frame which contains the rhythmic data 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_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. |
return_figure |
Whether or not to return a ggplot graph of the rhythm and cosine model. |
control |
|
weights |
An optional numeric vector of (fixed) weights. When present, the objective function is weighted least squares. |
suppress_all |
Logical. Set to |
Value
list
Examples
df <- make_data()
df <- df[df$group == "g1", ]
out <- circa_single(x = df, col_time = "time", col_outcome = "measure")
out
# with sample weights (arbitrary weights for demonstration)
sw <- runif(n = nrow(df))
out2 <- circa_single(
x = df,
col_time = "time",
col_outcome = "measure",
weights = sw,
suppress_all = TRUE
)
out2