Skip to main content
. 2019 Jan 15;8:e41690. doi: 10.7554/eLife.41690
Pseudocode C6 Power computation of Mgc against a given distribution. By repeatedly sampling from the joint distribution FXY, sample data of size n under the null and the alternative are generated for r Monte-Carlo replicates. The power of Mgc follows by computing the test statistic under the null and the alternative using Algorithm C2. In the simulations we use r=10,000 MC replicates. Note that power computation for other benchmarks follows from the same algorithm by plugging in the respective test statistic.
Input: A joint distribution FXY, the sample size n, the number of MC replicates r, and the type 1 error level a.
Output: The power ß of Mgc.
1: function MGCPower(FXY, n, r, a)
2:  for t:=1,,r do
3: for i:=[n] do
4: xi0iidFX,yi0iidFY sample from null
5: (xi1,yi1)iidFXY, sample from alternative
6: end for
7: for i,j:=1,,n do
8: aij0=δx(xi0,xj0), bij0=δy(yi0,yj0) pairwise distances under the null
9: aij1=δx(xi1,xj1), bij1=δy(yi1,yj1) pairwise distances under the alternative
10: end for
11: c0[t]=MGCSAMPLESTAT(A0,B0) Mgc statistic under the null
12: c1[t]=MGCSAMPLESTAT(A1,B1) Mgc statistic under the alternative
13: end for
14: ωαCDF1α(c0[t],t[r]) the critical value of Mgc under the null
15: βt=1r(c1[t]>ωα)/r compute power by the alternative distribution
16: end function