StatBiomed / SpatialDM

Spatial direct messaging detected by bivariate Moran
https://spatialdm.readthedocs.io
Apache License 2.0
24 stars 5 forks source link

positive mask commented out + other questions #4

Closed dbdimitrov closed 1 year ago

dbdimitrov commented 1 year ago

Hi,

Congrats for the well-timed and efficient tool!

I wanted to ask in a previous version you had a positive local mask implemented, which is now commented out: https://github.com/StatBiomed/SpatialDM/blob/20d28c28103b95aefe3b6469ef5e4ee735f7d1e0/spatialdm/utils.py#L191

What is the reasoning for this?

Also, were the correlations between analytical and permutation-based local p-values calculated before or after applying the mask?

Thanks in advance for your response!

Daniel

dbdimitrov commented 1 year ago

Last point, you introduce local bivariate Moran's I which is really cool, yet I noticed that you are missing m_squared in your formula https://en.wikipedia.org/wiki/Moran%27s_I and instead you scale as in global morans I, any reason for that?

Do we interpret the local moran's I in a way similar to z-scores, given that it does not seem to be bound betwen -1 and +1.

Finally, you suggest using raw data for local_r scores, but z-score type normalization with raw counts would be very susceptible to outliers, what would be the reasoning behind using raw?

Please do not hesitate to correct me if I'm misunderstanding.

Daniel

leeyoyohku commented 1 year ago

@dbdimitrov Hi Daniel. Thanks for your interest in SpatialDM. Positive masks are common practice in Moran statistics, for which the reason is to avoid negatively-correlated hits. For the purpose of SpatialDM, we'd better implement the positive mask. We may have accidentally uploaded the commented version which we used to test correlations internally. The high local stat correlation in our manuscript is the result of positive mask implementation. I checked our internal test results of correlation. Without the positive mask, it seems there will be a lot of false positive hits under permutation mode, leading to lower correlations with the analytical approach. We have fixed this in version 0.0.5, in which everything is wrapped up into one anndata object. Should be easier for you to explore:)

dbdimitrov commented 1 year ago

Thanks for the answer