analyze_timeseries.acf: Auto Correlation with a moving window

View source: R/analyze_timeseries.acf.R

analyze_timeseries.acfR Documentation

Auto Correlation with a moving window

Description

Uses autocorrelation to find a circadian period for a given timeseries

Usage

function(df = NULL,  from = 18, to = 30,
sampling_rate = "1 hour", window_vector = NULL, values = NULL)

Arguments

df

A data.frame with 2 columns. Column 1 must contain the windows to iterate over. Column 2 must supply the values. This parameter is optional if window_vector and values are supplied. df must not have gaps in the dates, acf asumes data is evenly spaced.

from

The period (in hours) from which to start looking for peaks in the autocorrelation. Default = 18.

to

The period (in hours) up to which to look for peaks in the autocorrelation. Default = 30.

sampling_rate

A charater string which indicates the sampling rate of the data. For example: "1 second", "2 minutes", "1 hour" (default),"3 days", "11 months".

Value

A data.frame with the autocorrelation results for each window which include: period, peaks, power, lags for the peaks.

See Also

[stats::acf()] which this functions uses to run the autocorrelation.

Examples

autocorrelations_multipeak <- acf_window(df = df_with_windows,
multipeak_period = FALSE, peak_of_interest = 2,
sampling_unit = "hours")


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