From 6dda5f9c004ba6085a8b68d691ae380f95c3cf23 Mon Sep 17 00:00:00 2001 From: aaron Date: Thu, 25 Nov 2021 15:40:37 +0100 Subject: [PATCH] update numbers and pipfile --- Pipfile | 12 ++++++++++++ covidrisk.py | 15 ++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 Pipfile diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..51f608c --- /dev/null +++ b/Pipfile @@ -0,0 +1,12 @@ +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi" + +[packages] +matplotlib = "*" + +[dev-packages] + +[requires] +python_version = "3.9" diff --git a/covidrisk.py b/covidrisk.py index d9e8390..3076c32 100644 --- a/covidrisk.py +++ b/covidrisk.py @@ -16,10 +16,10 @@ def p_meet_positive_bayes(groupsize:int): ''' Bayesian approach ''' - n_positive_tests = 1073.754 # number of positive tests in the last 14 days - n_tests = 6316.2 # total number of tests in the last 14 days - n_population = 100000 # sample size -> per 100k for switzerland - p_test_positive = 0.2 # probability of a positive person getting tested (0.5 is optimistic...) + n_positive_tests = 824.11 # number of positive tests in the last 14 days per 100k + n_tests = 6514.83 # number of tests in the last 14 days per 100k + n_population = 100000 # sample size (per 100k) + p_test_positive = 0.5 # probability of a positive person getting tested (0.5 is optimistic...) p_positive_test = n_positive_tests / n_tests p_test = n_tests / n_population @@ -29,13 +29,14 @@ def p_meet_positive_bayes(groupsize:int): def plot_data(data): plt.plot(data) - plt.title("probability of meeting a covid positive in groupsize of n") + plt.title("probability of having a covid positive in groupsize of n") plt.xlabel("group size / n") - plt.ylabel("probability") + plt.ylabel("probability / %") + plt.grid(visible=True) plt.show() data = [] -for i in range(1, 300): +for i in range(1, 325): data.append(p_meet_positive_bayes(i)) print(f'The chance of meeting a positive in a group of {i} is: {p_meet_positive_bayes(i)}%')