[R] calculating correlation of a Supply/Demand measure and price change (in high frequency time series data)
ligges at statistik.uni-dortmund.de
Sun Oct 28 16:14:33 CET 2007
Kenneth Spriggs wrote:
> Regarding "financial" data: I have a high frequency (1 minute)
I never understand people from economics, that 1 minute *high* frequency
sampling is roughly 2500000 times less frequent than things I am
> measure of
> supply/demand and I'd like to know if it has any influence on short term
> price changes (also 1 minute).
> Question: How do I calculate the correlation between this supply/demand
> measure and price changes (correctly)?
> Some facts about that data:
> The price changes and supply/demand measure are non-normal. An assumption of
> stationarity in either measure is certainly questionable. There is
> non-homogeneity in variance in both measures.
> In R there are 3 methods used with the cor() function, "pearson", "kendall",
> "spearman". Can any of these be used without a gross violation of the
If you need a "robust" version of a corelation measure, choose Kendall
or Spearman, otherwise going with Pearson should be fine in most cases.
Anyway, I'd propose to look at ?acf. You certainly expect some delay
between your measures, hence you want to look at autocorrelations at
different time lags.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help