rythm_analysis_by_window_2: Helper function to analyze the period of a time series

View source: R/rythm_analysis_by_window_2.R

rythm_analysis_by_window_2R Documentation

Helper function to analyze the period of a time series

Description

Helper function which takes the output from process_timeseries and runs: autocorrelation, lomb-scargle periodogram, and COSINOR analysis.

Usage

multivariate_rythm_analysis(df = NULL, sampling_rate = NULL, auto_correlation = TRUE, lomb_scargle = TRUE,
from = NULL, to = NULL, ofac = 1, multipeak_period = TRUE, peak_of_interest = Inf,
datetime = NULL, window = NULL, values = NULL)

Arguments

df

The output from multivariate_process_timeseries

sampling_rate

A character string indicating the sampling rate of the data. Examples: '30 minutes', '1 hour', '4 seconds', '100 days'.

from

An optional numeric indicating from which period or frequency to start looking for peaks. Must be in hours. Default = 18.

to

An optional numeric indicating up to which period or frequency to start looking for peaks. Must be in hours. Default = 30.

ofac

[lomb::lsp()] The oversampling factor. Must be an integer>=1. Larger values of ofac lead to finer scanning of frequencies but may be time-consuming for large datasets and/or large frequency ranges (from...to).

autocorrelation

Logical. If TRUE (default) runs an autocorrelation on each window of the data. If FALSE, does not run.

lomb_scargle

Logical. If TRUE (default) runs the Lomb-Scargle Periodogram on each window on the data. If FALSE, does not run.

datetime

optional if a data.frame is supplied. A list of multiple POSIXct vectors corresponding to each mearument variable.

window

optional if a data.frame is supplied. A list of multiple window vectors corresponding to each mearument variable.

values

optional if a data.frame is supplied. A list of multiple value vectors corresponding to each mearument variable.

Value

A names list of data.frames with the combined output of [acf_by_window()], [lsp_by_window()], and [cosinor_lm()].

Examples

analysis <- rythm_analysis(df = processed_data, sampling_rate = "30 min", auto_correlation = TRUE,
lomb_scargle = TRUE, from = 36, to = 48, multipeak_period = TRUE)


edpclau/circadian-dynamics documentation built on Aug. 25, 2023, 12:18 p.m.