Pseudocode C2 Mgc test statistic. This algorithm computes all local correlations, take the smoothed maximum, and reports the 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 . |
Input: A pair of distance matrices . |
Output: The Mgc statistic , all local statistics , and the corresponding local scale . |
1: |
function MGCSampleStat
|
|
2: |
|
All local correlations |
3: |
|
find a threshold to determine large local correlations |
4: |
for
do
end for
|
identify all scales with large correlation |
5: |
|
binary map encoding scales with large correlation |
6: |
|
largest connected component of the binary matrix |
7: |
|
use the global correlation by default |
8: |
|
|
9: |
if
Β then
|
proceed when the significant region is sufficiently large |
10: |
|
find the smoothed maximum and the respective scale |
11: |
end if
|
|
12: |
end Function |
|
Input:
. |
Output: A threshold to identify large correlations. |
13: |
function ThresholdingΒ
|
|
14: |
|
variance of all negative local generalized correlations |
15: |
|
threshold based on negative correlations |
16: |
|
|
17: |
end Function |
|