bicoherence {rhosa}R Documentation

Estimate bicoherence from given time series data.

Description

Estimate magnitude-squared bicoherence from given real- or complex-valued time series data.

Usage

bicoherence(
  data,
  window_function = NULL,
  mc = FALSE,
  mc_cores = getOption("mc.cores", 2L),
  alpha = 0.05,
  p_adjust_method = "BH"
)

Arguments

data

Given time series, as a data frame or matrix with which columns correspond to sampled stretches.

window_function

A window function's name for tapering. Defaults to NULL ("no tapering").

Currently the following window functions are available: Hamming window ("hamming"), Hann window ("hann"), and Blackman window ("blackman").

mc

If TRUE, calculation is done in parallel computation. Defaults to FALSE.

mc_cores

The number of cores in use for parallel computation, passed parallel::mcmapply() etc. as mc.cores.

alpha

The alpha level of the hypotesis test. Defaults to 0.05.

p_adjust_method

The correction method for p-values, given to p.adjust(). Defaults to "BH" (Benjamini and Hochberg). No correction if a non-character is given.

Value

A data frame including the following columns:

f1:

The first elements of frequency pairs.

f2:

The second elements of frequency pairs.

value:

The estimate of magnitude-squared bicoherence at the respective frequency pair.

p_value:

The (corrected, if requested) p-value for hypothesis testing under null hypothesis that bicoherence is 0.

significance:

TRUE if the null hypothesis of the above hypothesis test is rejected with given alpha level.

References

Brillinger, D.R. and Irizarry, R.A. "An investigation of the second- and higher-order spectra of music." Signal Processing, Volume 65, Issue 2, 30 March 1998, Pages 161-179.

Examples

f <- function(x) {
    sin(2 * x) + sin(3 * x + 1) + sin(2 * x) * sin(3 * x + 1)
}
v <- sapply(seq_len(1280), f) + rnorm(1280)
m <- matrix(v, nrow = 128)
bc1 <- bicoherence(m)
bc2 <- bicoherence(m, "hamming")
bc3 <- bicoherence(m, "hann", mc = TRUE, mc_cores = 1L)


[Package rhosa version 0.3.0 Index]