MCB111: Mathematics in Biology (Fall 2020)
week 00:
Sampling from a probability distribution
Preliminars
Present all your reasoning, derivations, plots and code as part of the homework. Imagine that you are writing a short paper for anyone to be able to understand. A jupyter notebook if you are working in Python is not required, but highly recommended.
Q1
This is mostly a computational question, you get familiar with some coding, and also on how to sample from any probability distribution.

a Take a sample (ie a collection of points according to a distribution) from each of the following distributions: uniform, Gaussian and binomial. Draw a plot for each sample/distribution. Repeat for at least two different values of the parameters of the distributions.

b Take several samples of different different sizes, and make visual observations as to how well your sample resembles the actual distribution as a function of the number of point in the samples.
Q2
Bacteria often form aggregates of cells. Aggregates seem to have more antibiotic tolerance than not aggregated bacterial cells. It is important to study conditions that could deplete aggregation as a potential tool to fight bacterial infections.
For a collection of bacterial cell (P. arruginosa to be more specific) aggregation is a stochastic process that happens with probability . Someone in your lab has measured under one set of default host condition. The data of those measurements are here: data_default.
You come new to the lab, and your job is to test a different set of conditions. These experiments are involved. Each time, you need to set a large number of colonies, wait 1 day, and determine the fraction of those that has aggregated. Then, you need to repeat the experiment.

Build the histogram for the data_default.

You are impatient, and after rounds, you are curious as to how well the bacteria aggregate under your conditions. Here is your data1.
You want to compare your data to the distribution under the default conditions, but in order to have a fair comparison you want to compare to a sample of from the default distribution.
Can you draw any conclusions by comparing your experimentally determined sample of and the sample of the same size from the default distribution?

After your result, you decide to go on with the experiment, and you continue to . Here is the data2. What can you tell now if you compare to a sample of the same size from the default distribution?
Q3 (extra credit)
Use rejection sampling instead of the inverse method to approach Q2.
In rejection sampling, the rejecting distribution is arbitrary. Here, since the random variable is a probability , which ranges between it makes sense to use the Uniform distribution as .
To apply rejection sampling, then you only need to setup the constant such that for all , .
Note that inn this case takes sometimes values larger than 1.
Note
Bacterial cells do aggregate and form colonies with complicated spatial organization. The possible effect of bacterial aggregation on antibiotic resistance is an active subject of research. See an example here. The data in this homework is completely made up.