code to calculate pairwise haplotype statistic