Estimate cross-bispectrum from three real-valued time series data.

cross_bispectrum(
  x,
  y,
  z = y,
  dft_given = FALSE,
  mc = FALSE,
  mc_cores = getOption("mc.cores", 2L)
)

Arguments

x

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

y

Given 2nd time series, with the same dimension as x.

z

Optional 3rd time series, with the same dimension as x (and thus as y). If omitted, y is used instead.

dft_given

If TRUE, suppose that DFTs are given instead of time series data and skip the fast fourier transform. Default: FALSE.

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::mclapply() 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 cross-bispectrum at each frequency pair.

References

K. S. Lii and K. N. Helland. 1981. Cross-Bispectrum Computation and Variance Estimation. ACM Trans. Math. Softw. 7, 3 (September 1981), 284–294. DOI:https://doi.org/10.1145/355958.355961

Examples

x <- seq_len(1280)
v1 <- sapply(x, function(x) {sin(2 * x)}) + rnorm(1280)
v2 <- sapply(x, function(x) {sin(3 * x + 1)}) + rnorm(1280)
v3 <- sapply(x, function(x) {cos(2 * x) * cos(3 * x + 1)}) + rnorm(1280)
m1 <- matrix(v1, nrow = 128)
m2 <- matrix(v2, nrow = 128)
m3 <- matrix(v3, nrow = 128)
xbs1 <- cross_bispectrum(m1, m2, m3)

d1 <- stats::mvfft(m1)
d2 <- stats::mvfft(m2)
d3 <- stats::mvfft(m3)
xbs2 <- cross_bispectrum(d1, d2, d3, dft_given = TRUE)

xbs3 <- cross_bispectrum(d1, d2, d3, dft_given = TRUE, mc = TRUE, mc_cores = 1L)