There are predicting coronavirus data Bayes and Joint Probability Distributions.
we have 300,000 people in the population, to scale down the numbers from the millions for convenience.
These 1,500 have CORONAVIRUS(covs). So let’s create the population and then sample
> people = seq ( 1,300000 )
> people_covs = sample ( people,1500 )
> people_nocovs = setdiff(people, people_covs)
#how we also used the setdiff function to get the complement
set of the people who do not have coronavirus(covs). Now, of the people who have
coronavirus, we know that 99% of them test positive so let’s subset that list,
and also take its complement. These are joint events, and their numbers
proscribe the joint distribution.
> people_covs_pos =sample(people_covs, 1500*0.99 )
> people_covs_neg = setdiff(people_covs,people_covs_pos)
#We can also subset the group that does not have CORONAVIRUS(covs), as we know that
the test is negative for them 95% of the time.
> people_nocovs_neg = sample(people_nocovs ,298500*0.95)
> people_nocovs_pos =setdiff(people_nocovs,people_nocovs_neg)
> length (people_nocovs_neg)
#We can now compute the probability that someone actually has coronavirus(covs)
when the test comes out positive.
> pr_covs_given_pos = (length(people_covs_pos))/(length(people_covs_pos)+length( people_nocovs_pos))
#we had examined earlier, what’s the chance
that you have coronavirus(covs)when the test is negative, i.e., a false negative?
> pr_covs_given_neg = (length(people_covs_neg))/(length(people_covs_neg)+length(people_nocovs_neg))