def calculate_auc_covar(auc_structure1, auc_structure2):
    """
    determine AUC covariance due to actives (covar_a) and decoys (covar_d)
    :param auc_structure1: list [(id, best_score, best_query, status, fpf, tpf), ...,]
    :param auc_structure2: list [(id, best_score, best_query, status, fpf, tpf), ...,]
    :return (covar_a, covar_d): tuple
    """

    # split data by activity class
    actives1, decoys1 = splitter(auc_structure1)
    actives2, decoys2 = splitter(auc_structure2)

    # covariance due to actives = E[{fpf2 - E(fpf2)a} * {fpf1 - E(fpf1)a}]a
    fpf1 = [x[4] for x in actives1]
    fpf2 = [x[4] for x in actives2]
    covara = np.cov(fpf1,fpf2)[0][1]

    # covariance due to decoys = E[{tpf2 - E(tpf2)d} * {tpf1 - E(tpf1)d}]
    tpf1 = [x[5] for x in decoys1]
    tpf2 = [x[5] for x in decoys2]
    covard = np.cov(tpf1,tpf2)[0][1]    # this is only compatible with versions >= 1.5

    return covara, covard