If two sequences have different periods, such as one being weekly and the other daily, how should I calculate the correlation coefficient between them?
data1:
w= weekBegin(2022.01.01 + (1..50)*7)
price1 = rand(20,50)10
data2:
d=2024.01.01 + 0..250
price2 = rand(20,250)10
How to compare the correlation between price1 and price2?
By using the universal interval
function, you can implement frequency conversion (from high frequency to low frequency) or interpolation (from low frequency to high frequency) to either increase or decrease the frequency.
w= weekBegin(2022.01.01 + (1..50)*7)
price1 = rand(20,50)10
t=table(w, price1)
select first(price1) from t group by interval(w,"1d", 'prev')