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)
)
Given 1st time series, as a data frame or matrix with which columns correspond to sampled stretches.
Given 2nd time series, with the same dimension as x.
Optional 3rd time series, with the same dimension as x (and thus as y).
If omitted, y
is used instead.
If TRUE, suppose that DFTs are given instead of time series
data and skip the fast fourier transform. Default: FALSE
.
If TRUE
, calculation is done in parallel computation.
Defaults to FALSE
.
The number of cores in use for parallel computation, passed
parallel::mclapply()
etc. as mc.cores
.
A data frame including the following columns:
The first elements of frequency pairs.
The second elements of frequency pairs.
The estimated cross-bispectrum at each frequency pair.
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
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)