I want to learn how to properly or robustly test the correlation between two variables and pitfalls to avoid.
For example let's say I have a time-series data A for let's say coffee prices, and another time-series B, the number of cups of coffee ordered , and I'll assume there are both in the same frequency, and as far as I know B is not imputed directly from A.
I want to find if B (or some function of B like change in B) is correlated (and thus related?) to A (or some change in A).
Normally I'd do a scatter plot, a calculate the correlation coefficient (pearson) and fit with a linear model. If the data is noisy I might try to minimize outliers and run a more robust regression (Huber? ) and once again compare .
I know that correlations are usually dynamic so sometimes I looking at rolling correlations for different time-periods to get an idea of ranges.
My question –is there a better way (in your experience) to do this, or another method/metric I should look at instead? In addition let's say there is a lagging impact of B on A, how could I properly test that?
Submitted October 12, 2020 at 07:09PM by chainwaxOPOTD