In [ ]:
In [5]:
pa = 0.001
pbga = 0.95
pac = 1-pa
pbgac = 0.05
print "Total probability of P(B) is " + \
str(0.001*0.95 + 0.05* 0.999)
你被檢出,但妳趁的事
In [2]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import mpld3
mpld3.enable_notebook()
In [3]:
fig, ax = plt.subplots(subplot_kw=dict(axisbg='#EEEEEE'))
ax.grid(color='white', linestyle='solid')
N = 50
scatter = ax.scatter(np.random.normal(size=N),
np.random.normal(size=N),
c=np.random.random(size=N),
s = 1000 * np.random.random(size=N),
alpha=0.3,
cmap=plt.cm.jet)
ax.set_title("D3 Scatter Plot", size=18);
A test for a certain rare disease is assumed to be correct 95% of the time: if a person has the disease, the test result is positive with probability 0.95, and if the person does not have the disease, the test result is negative with probability 0.95. A person drawn at random from a certain population has probability 0.001 of having the disease. Find the probability that a random person tests positive. Given that the person just tested positive, what is the probability he actually has the disease?