Motivation

Sometimes the matrix (samples) to be correlated is too large, then you need to compute the correlation when the data is pouring in, i.e. online computing correlation.

Method

Correlation between 2 random variables or vectors X,Y are defined as ρ=(XˉX)(YˉY)(XˉX)(XˉX)(YˉY)(YˉY)=E(XˉX)(YˉY)σXσY This formula is not suited for online calculation of correlation. Using the component representation ρ=1niXiYiˉXˉY1nX2iˉX21nY2iˉY2 Note in this formula, the samples or trials are independent to each other, and update could be efficient. The stats we want to maintain through out this is

  • iXiYi
  • iXi,iYi
  • iX2i,iY2i
  • Sample number n

Then we can use this to compute correlation real time.

Potential usage includes using it real time to update correlation coefficients among channels or brain areas or between brain and in silico networks through out experiments.