Learn R Programming

zeitgebr (version 0.3.5)

periodogram: 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

Examples

Run this code
# NOT RUN {
data(dams_sample)
# only four individuals for the sake of the example
dt <- dams_sample[xmv(region_id) %in% c(1, 7, 21, 31)]
pdt <- periodogram(activity, dt, FUN = ls_periodogram, oversampling = 4)
pdt <- periodogram(activity, dt, FUN = chi_sq_periodogram)
# }
# NOT RUN {
require(ggetho)
ggperio(pdt, aes(colour=period_group)) + stat_pop_etho()
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab