def _chao1_var_bias_corrected(s, d):
    """Calculates chao1 variance, bias-corrected.

    `s` is the number of singletons and `d` is the number of doubletons.

    From EstimateS manual, equation 6.

    """
    return s * (s - 1) / (2 * (d + 1)) + s * (2 * s - 1) ** 2 / (4 * (d + 1
        ) ** 2) + s ** 2 * d * (s - 1) ** 2 / (4 * (d + 1) ** 4)
