View source: R/pwutilityfunctions.R
analyze_cosinor_design | R Documentation |
This function analyzes a vector of time points and computes various metrics related to periodic sampling. It handles both absolute and modulo-per time representations.
analyze_cosinor_design(timepoints, per = 24, accuracy = 1e-04)
timepoints |
A numeric vector of time points to analyze. |
per |
The cosinor period |
accuracy |
Absolute accuracy for determining centeredness and phase invariance |
The function performs several analyses on the provided time points:
Computes the number of replicates for each unique time point.
Computes the number of unique time points and replicates modulo per.
Checks for balance in replicates, sampling intervals, and distribution within a cycle.
An object of class cosinor_design
containing the following
elements:
The total number of time points.
The number of unique time points (sorted).
A vector indicating the number of replicates per unique time point (sorted).
A vector of unique replicate counts across all time points.
The number of unique time points within a per-hour cycle.
A vector of replicate counts per unique time point modulo per.
A vector of unique replicate counts across all time points modulo per.
A vector of unique sampling intervals between consecutive time points (sorted).
A vector of the input time points sorted in ascending order.
A vector of the time points modulo per, sorted.
The index mapping the original input time points to the sorted time points.
The index mapping the original input time points to the sorted modulo-per time points.
Logical, indicating whether the number of replicates per unique time point modulo per is identical.
Logical, indicating whether time points are evenly spaced within a cycle, also considering wrap-around from end to beginning.
Logical, indicating whether the design is centered. Centered designs potentially reach the highest power.
Logical, indicating whether the design is phase-invariant. Phase-invariant designs lead to power independent of phase.
# Simulate a time point vector
set.seed(123)
timepoints <- rep(seq(0, 44, by = 4), each = 3) |> sample()
# Analyze time points
results <- analyze_cosinor_design(timepoints)
# View results
print(results)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.