periodogram: Computes periodograms

View source: R/periodogram.R

periodogramR Documentation

Computes periodograms

Description

This function builds periodograms, with one of several methods, for each individual of a behavr table

Usage

periodogram(var, data, period_range = c(hours(16), hours(32)),
  resample_rate = 1/mins(15), alpha = 0.01, FUN = chi_sq_periodogram,
  ...)

Arguments

var

variable to analyse

data

behavr table

period_range

vector of size 2 defining minimal and maximal range of period to study (in seconds)

resample_rate

frequency to resample (up or down) the data at (in hertz)

alpha

significance level

FUN

function used to compute periodogram (see periodogram_methods)

...

additional arguments to be passed to FUN

Value

A behavr::behavr table. In addition to the metadata, it contains data that encodes a periodogram (i.e. power vs period). The data contains the columns:

  • power – the power the or equivalent (according to FUN)

  • period – the period at which power is computed (in seconds)

  • p_value – the p value associated to the power estimation

  • signif threshold – the threshold above which power is considered significant

References

See Also

  • periodogram_methods – the list of built-in methods

  • find_peaks – to find peaks in the periodogram

  • ggetho::ggperio – to plot periodograms

Examples

data(dams_sample)
# only a half of the individuals for the sake of the example
dt <- dams_sample[xmv(region_id) %in% (1:16 * 2)]
pdt <- periodogram(activity, dt, FUN = ls_periodogram, oversampling = 4)
pdt <- periodogram(activity, dt, FUN = chi_sq_periodogram)

require(ggetho)
ggperio(pdt, aes(colour=period_group)) + stat_pop_etho()



rethomics/zeitgebr documentation built on April 11, 2024, 2:28 a.m.