Open kahaaga opened 9 months ago
What is the covariance/correlation matrix in this context?
What is the covariance/correlation matrix in this context?
It would be covariance/correlation between the different columns of the dataset. If D = StateSpaceSet(rand(10000, 5))
and corrs = fastcor(D)
, then corrs[2, 5]
is the correlation between the second and fifth column of D
.
In practice, the correlation matrix is used for computing partial correlations, which is for example a pretty standard use case for the PC
graph inference algorithm.
Hm, I guess we have standardize
in this package as a statistical operation, so this functionality could be added here as well, provided that it does not introduce additional dependencies! In the docs we could have a "Basic statistics" subsection.
@MMAtrix
is for example an additional dependency that we do not need (we only depend on StaticArraysCore)
Hm, I guess we have standardize in this package as a statistical operation, so this functionality could be added here as well, provided that it does not introduce additional dependencies! In the docs we could have a "Basic statistics" subsection.
A section with basic statistics sounds good. I'm sure there will be other statistics that we'd want to optimise for StateSpaceSet
s later too.
@MMAtrix is for example an additional dependency that we do not need (we only depend on StaticArraysCore)
The macro isn't really necessary here. StaticArraysCore.jl exports MMatrix
, so we can just use that.
For the name, fastcov
/fastcor
names should be just cov
/cor
, right? We just extend the Statistics methods.
correct
I'm cleaning up stuff in CausalityTools, and came across some code I wrote for estimating the covariance/correlation matrix of a
StateSpaceSet
used for the parametric Gaussian MI/CMI estimators. The code here is significantly faster than converting to aMatrix
and then callingStatistics.cov
/Statistics.cor
.Would this be something that belongs here?
The source code is relatively simple.
Verifying that the implementations are actually correct:
Timing