You will write three functions: one for the law of total probability, one for Bayes' theorem and one for the chance of being ill after a positive test. The checker uses the three machines of the lessons and a screening test.
The idea. For a partition with priors and likelihoods , the total probability of is . The posterior of case is divided by that total. For a test, the two cases are ill and healthy.
Your tasks.
total_probability(priors, likelihoods). Add the product of each prior and its likelihood.posterior(priors, likelihoods, k). Return the posterior of case number k, counting from .predictive_value(prevalence, sensitivity, specificity). Return the chance of being ill after a positive test.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…