bispectrum {rhosa}R Documentation

Estimate bispectrum from time series data.

Description

Estimate bispectrum from real- or complex-valued time series data.

Usage

bispectrum(
  data,
  window_function = NULL,
  mc = FALSE,
  mc_cores = getOption("mc.cores", 2L)
)

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.

Value

A data frame including the following columns:

f1:

The first elements of frequency pairs.

f2:

The second elements of frequency pairs.

value:

The estimated bispectrum at each frequency pair.

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)
bs1 <- bispectrum(m)
bs2 <- bispectrum(m, "hamming")
bs3 <- bispectrum(m, "blackman", mc = TRUE, mc_cores = 1L)


[Package rhosa version 0.3.0 Index]