In class-examples, February 17, 2020

In [1]:
def joint_probability_of_independent_events(list_of_events):
    prob = 1
    for x in list_of_events:
        prob = prob * x
    return prob 
In [2]:
def flip_conditional_probabilities(base_rate, accuracy_rate):
    numerator = (accuracy_rate * base_rate)
    denominator = numerator + ((1-base_rate)*(1-accuracy_rate))
    print(numerator)
    print(denominator)
    return(numerator/denominator)

flip_conditional_probabilities(.1, .95)
0.095
0.14000000000000004
Out[2]:
0.6785714285714284
In [3]:
def prob_drunk_given_pos(base_rate, probab_pos_drunk, prob_pos_sober):
    numerator = (probab_pos_drunk * base_rate)
    denominator = numerator + ((1-base_rate)*(prob_pos_sober))
    print(numerator)
    print(denominator)
    return(numerator/denominator)
    
In [5]:
prob_drunk_given_pos(.1, .95, .05)
0.095
0.14
Out[5]:
0.6785714285714285
In [ ]:
 

links