def multilocus_G_double_prime_st_est(Ht_est, Hs_est, n):
    """Averages across loci before calculating G''st."""
    n = float(n)
    Ht_est = sum(Ht_est) / float(len(Ht_est))
    Hs_est = sum(Hs_est) / float(len(Hs_est))
    if (n * Ht_est - Hs_est) * (1.0 - Hs_est) == 0:
        return 0.0
    else:
        G_double_prime_st_est = n * (Ht_est - Hs_est) / ((n * Ht_est -
            Hs_est) * (1.0 - Hs_est))
        return G_double_prime_st_est
