allPeriodogramsSleep {phase} | R Documentation |
Periodogram analysis for sleep data
Description
This function generates a composite figure with periodogram plots for all flies in a DAM scanned monitor file. Input for this function must be an output from the sleepData() function. The output of this function is a list with two components - (a) large plotly object with periodogram plots for all flies, and (b) a table which has channel wise information of significant period and adjusted power values, from the chosen time-series analysis method. This function requires the packages "plotly" and "zeitgebr".
Usage
allPeriodogramsSleep(
data,
bin = 30,
method = "ChiSquare",
low.per = 16,
high.per = 32,
alpha = 0.05,
time.res = 20
)
Arguments
data |
Input data file. The input for this function must be an output from one of either sleepData(). See ??sleepData(). |
bin |
Intervals in which input data is saved (in minutes). This defaults to 30. |
method |
Choose the method for performing time-series analysis. Currently, three methods are implemented for analysis - "ChiSquare", "Autocorrelation", and "LombScargle". This defaults to "ChiSquare". |
low.per |
Choose the lowest period (in hours) for analysis. This defaults to 16. |
high.per |
Choose the highest period (in hours) for analysis. This defaults to 32. |
alpha |
Choose the significance level for periodogram analysis. This defaults to 0.05. |
time.res |
Resolution of periods (in minutes) to analyse while using the ChiSquare periodogram. For instance, if users wish to scan periods from low.per to high.per in the following manner: 16, 16.5, 17, 17.5, and so on, then time.res must be 30. This defaults to 20. |
Value
A list
with two items:
- Plots
A
plotly
htmlwidget
with all periodograms in a 4-by-8 array.- Data
A
matrix
array
with 32 rows (one for each fly) and 2 columns (Period and Adjusted Power).
Examples
td <- trimData(data = df, start.date = "19 Dec 20", start.time = "21:00",
n.days = 5, bin = 1, t.cycle = 24)
sd <- sleepData(td)
all.periodograms.sleep <- allPeriodogramsSleep(data = sd[,1:6])