I would like to know how to calculate the Pearson correlation coefficient for two complex time series.
Or there is something else?
import numpy as np
R = lambda x,y: ((x-x.mean())*(y-y.mean())).sum()/(np.sqrt(((x-x.mean())**2).sum())*np.sqrt(((y-y.mean())**2).sum()))
x,y = np.loadtxt("data.txt",dtype=np.complex128).T
ri = R(x,y)
ri = (ri*ri.conj()).real
print(ri)
File in https://file.io/KzwvQFx8XsXQ

numpy.linalg.norm3 times here.R = lambda x,y: np.linalg.norm((x-x.mean())*(y-y.mean())) / (np.linalg.norm(x-x.mean())*np.linalg.norm(y-y.mean()))