require(stats)
require(psd)
n <- 1000
ramp <- seq_len(n)
parab <- ramp^2
set.seed(1255)
X <- ts(rnorm(n) + ramp/2)
Y <- ts(rnorm(n) + ramp/10 + parab/100)
# Calculate the multitaper cross spectrum
csd <- cross_spectrum(X, Y, k=20)
Run the code above in your browser using DataLab