def estimate_bias_randomized_response_bool(prior, p):
    """estimates the bias of randomized response 
    when the probability of returning the true answer is `p`,
    and the likelihood that each answer is given is held in `priors`.

    For example, say you have a prior that your survey question will be answered "yes" 90% of the time.
    You run randomized response with p = 0.5.
    Then on average, the randomized responses will exhibit a bias of -0.2.
    As in, randomized responses will be False 2% more often than in the real data.
    
    :returns the bias of the randomized response"""
    assert 0 <= prior <= 1
    assert 0 <= p <= 1

    expectation = p * prior + (1 - p) / 2
    return expectation - prior