Question: Need help with these Python/Numpy/Pandas problems please!! import numpy as np import pandas as pd np.random.seed (0) flips np.random.choice (['H', 'T'l, 100, p=[0.7, 0.3]) print('100
import numpy as np import pandas as pd np.random.seed (0) flips np.random.choice (['H', 'T'l, 100, p=[0.7, 0.3]) print('100 flips: ', flips) p_measles = 0.05 - Marginal probability of measles p_pos_if_measles = 0.90 - Probability of a positive test given measles p_pos_if_okay = 0.05 - Probability of a negative test given no measles n - 10000 - Total number of people in simulation We will create two boolean Numpy arrays, each containing n boolean values. has_measles[i] is True if the ith person has measles tests_positive[i] is True if the ith person tests positive for measles 1. Using the has_measles and tests_positive arrays, compute the probability that a person has measles given positive test results. 2. Using the has_measles and tests_positive arrays, compute the probability that a person does not have measles given negative test results. 3. Using the has measles and tests_positive arrays, compute the probability that a person has measles given negative test results. 4. Using the has_measles and tests_positive arrays, create a data frame with two columns: 'measles', which will contain the values in the has_measles array 'tests_positive', which will contain the values in the tests_positive array pd.crosstab (df [ 'measles', df ['tests_positive']).plot.bar() 5. Take your answers above and create a function that will perform the simulation and return the estimated probability that a person has measles given positive test results
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
