Suppose our initial window is of size 500. Label the SNPs s_1, s_2, ..., s_{500}; --indep-pairwise performs the following operations on them:
removed_indices = {};
for (snp_index_1 := 1; snp_index_1 <= 499; snp_index_1 += 1) {
if (snp_index_1 in removed_indices) {
continue;
}
for (snp_index_2 := snp_index_1 + 1; snp_index_2 <= 500; snp_index_2 += 1) {
r2 = compute_correlation(s_{snp_index_1}, s_{snp_index_2});
if (r2 > max_allowed_r2) {
if (MAF(s_{snp_index_1}) < MAF(s_{snp_index_2})) { // prune the SNP with lower minor allele frequency
removed_indices.add(snp_index_1);
break;
} else {
removed_indices.add(snp_index_2);
}
}
}
}
Suppose every even-numbered SNP remains after this loop completes, and the window step size is 50. Then we advance the end of the window from s_{500} to s_{550}. s_1, s_3, ..., s_{499} are definitely out. s_2, s_4, ..., s_{50} are definitely still in. But s_{52} will still be checked against s_{501} to s_{550}. And then s_{54} will still be checked against the subset of s_{501}..s_{550} that doesn't get knocked out by s_{52}. Etcetera.