I'm trying to make a function to calculate Bayesian probabilities in python without using scipy, and while I can get the function to print a single result, I'm having trouble getting it to iterate multiple times, using the previous result in the next calculation.
Here's what I have so far:
def prob_given_positive (prior, false_positive_rate, true_positive_rate):
pdgp = (true_positive_rate * prior) / (false_positive_rate)
for i in range(10):
probability = (true_positive_rate * pdgp) / (false_positive_rate)
print (probability)
prob_given_positive(.001,.08,1)
This is the print out I get
0.15625
0.15625
0.15625
0.15625
0.15625
0.15625
0.15625
0.15625
0.15625
0.15625
What I'd like instead is 10 different probabilities, where the 'prior' is replaced each time by the previous calculation's 'probability' or 'pdgp' ...
Guidance on what I'm missing?