DynamicsAndNeuralSystems / pyspi

Comparative analysis of pairwise interactions in multivariate time series.
https://time-series-features.gitbook.io/pyspi/
GNU General Public License v3.0
202 stars 26 forks source link

Diagonal elements of covariance estimators are 'nan' #71

Open htapia opened 4 months ago

htapia commented 4 months ago

Just found that on the latest version pyspi==1.1.0 (google colab) and a previous version pyspi==1.0.3 (ubuntu)

1) diagonal entries of calculated covariance matrices like that returned by cov_EmpiricalCovariance, are not 1, which should be due to the fact that data is normalized by default (thus covariance matrices are equal to correlation matrices) in fact they all have 'nan' on the main diagonal.

2) precision matrix estimators like prec_EmpiricalCovariance also return 'nan' on the main diagonal thus the resulting matrix is not the inverse of the matrix returned by cov_EmpiricalCovariance

Am I doing something wrong? Is this an issue? Thanks

jmoo2880 commented 4 months ago

Hi @htapia, Pyspi is specifically designed to compute statistics of pairwise interactions between different processes, rather than self-interactions. Given this focus on pairwise interactions, the diagonal entries of the matrices for each pairwise statistic are intentionally set to be NaNs.

htapia commented 4 months ago

Hi Thanks for the clarification but that doesn't account for the precision matrix (inverse of covariance) having nan's on the diagonal. Or I am missing something else? Cheers, Horacio


From: Joshua Moore @.> Sent: Tuesday, June 4, 2024 6:54 PM To: DynamicsAndNeuralSystems/pyspi @.> Cc: Tapia McClung Horacio @.>; Mention @.> Subject: Re: [DynamicsAndNeuralSystems/pyspi] Diagonal elements of covariance estimators are 'nan' (Issue #71)

You don't often get email from @.*** Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification

Hi @htapiahttps://github.com/htapia, Pyspi is specifically designed to compute statistics of pairwise interactions between different processes, rather than self-interactions. Given this focus on pairwise interactions, the diagonal entries of the matrices for each pairwise statistic, which would represent the interaction of each time series with itself, are intentionally set to NaN.

— Reply to this email directly, view it on GitHubhttps://github.com/DynamicsAndNeuralSystems/pyspi/issues/71#issuecomment-2148644069, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABRZPLOXGEQ6MALJU36556LZFZOS5AVCNFSM6AAAAABIXWG2IKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBYGY2DIMBWHE. You are receiving this because you were mentioned.Message ID: @.***>