Skip to main content
. 2019 Jan 15;8:e41690. doi: 10.7554/eLife.41690
Pseudocode C2 Mgc test statistic. This algorithm computes all local correlations, take the smoothed maximum, and reports the (k,l) pair that achieves it. For the smoothing step, it: (i) finds the largest connected region in the correlation map, such that each correlation is significant, that isΒ larger than a certain threshold to avoid correlation inflation by sample noise, (ii) take the largest correlation in the region, (iii) if the region area is too small, or the smoothed maximum is no larger than the global correlation, the global correlation is used instead. The running time is π’ͺ(n2).
Input: A pair of distance matrices (A,B)∈RnΓ—nΓ—RnΓ—n.
Output: The Mgc statistic cβˆ—βˆˆR, all local statistics π’žβˆˆRnΓ—n, and the corresponding local scale (k,l)∈NΓ—N.
1: function MGCSampleStat(A,B)
2: π’ž=MGCALLLOCAL(A,B) All local correlations
3: Ο„=THRESHOLDING(π’ž) find a threshold to determine large local correlations
4: for i,j:=1,…,ndo rij←I(cij>Ο„)end for identify all scales with large correlation
5: ℛ←{rij:i,j=1,…,n} binary map encoding scales with large correlation
6: β„›=CONNECTED(β„›) largest connected component of the binary matrix
7: cβˆ—β†π’ž(n,n) use the global correlation by default
8: k←n,l←n
9: if (βˆ‘i,jrij)β‰₯2nΒ then proceed when the significant region is sufficiently large
10: [cβˆ—,k,l]←max(π’žβˆ˜β„›) find the smoothed maximum and the respective scale
11: end if
12: end Function
Input: π’žβˆˆRnΓ—n.
Output: A threshold t to identify large correlations.
13: function ThresholdingΒ π’ž
14: Ο„β†βˆ‘cij<0(cij)2/βˆ‘cij<01 variance of all negative local generalized correlations
15: τ←max{0.01,Ο„}Γ—3.5 threshold based on negative correlations
16: τ←max{Ο„,2/n,cnn}
17: end Function