<jupyter_start><jupyter_text>Homework (12 pts) - Probability Distributions of Random Variables 1. (3 pts) Assume that the rate of deleterious mutations on average is 1.2 per diploid genome. However, due to certain environmental factors, the mutation rate in a particular city is doubled. Plot the probabilities of having zero up to 10 mutations. If having eight or more mutations has a 50% chance of being lethal, how many deaths are expected out of 1000 residents of this city?<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%config InlineBackend.figure_format = 'retina'
import scipy as sp
import scipy.stats as st

rate = 1.2 * 2
dist = st.poisson(rate)
numMutations = np.arange(11)

plt.bar(numMutations, dist.pmf(numMutations))
plt.xlabel('# Mutations', fontsize = 18)
plt.ylabel('Probability', fontsize = 18);

print(f"Probability of less than 8 mutations = {dist.cdf(7)}")
print(f"Probability of 8 or more mutations = {dist.sf(7)}")
print(f"Expected deaths out of 1000 residents of this city = {dist.sf(7) * 1000 / 2}")<jupyter_output>Probability of less than 8 mutations = 0.9966613830507716
Probability of 8 or more mutations = 0.003338616949228422
Expected deaths out of 1000 residents of this city = 1.669308474614211<jupyter_text>2. (3 pts) You are recording action potentials from a single neuron, and observe a spike on average once every 0.5 seconds. Plot the expected distribution of interspike intervals from zero up to the time for which 95% of all intervals are accounted for. If this neuron needs to fire two consecutive spikes within 0.1 seconds in order for a downstream neuron to spike, what is the average spike rate of the downstream neuron?<jupyter_code>rate = 1/0.5
dist = st.expon(loc = 0, scale = 1/rate)
intervalsSec = np.linspace(0, dist.ppf(0.95), 501)
pdf = dist.pdf(intervalsSec)

plt.plot(intervalsSec, pdf)
plt.xlabel('Interspike Interval (Sec)', fontsize = 18)
plt.ylabel('pdf', fontsize = 18);

print(f"Average spike rate of the downstream neuron = {dist.cdf(0.1)/0.1} seconds")<jupyter_output>Average spike rate of the downstream neuron = 1.8126924692201813 seconds<jupyter_text>3. (3 pts) A tetrameric protein composed of four identical subunits can bind an activating ligand, one ligand per subunit. At a given ligand concentration there is 30% chance that a binding site will be occupied by ligand. Plot the probability that 0, 1, 2, 3, or 4 ligands are bound.<jupyter_code>n = 4
p = 0.3
dist = st.binom(n, p)
numBound = np.arange(n+1)
pmf = dist.pmf(numBound)

plt.bar(numBound, pmf)
plt.xlabel('# Ligands Bound', fontsize=18)
plt.ylabel('Probability', fontsize=18);<jupyter_output><empty_output><jupyter_text>4. (3 pts) Mice are evaluated for depression following an experimental procedure using a set of tests that are summarized by a single score that is presumed to be correlated with their degree of depression. Scores for a group of mice had a mean value of 64 with a standard deviation of 12. Plot the distribution of scores. If a score above 80 is considered as being depressed, what is the probability that a mouse will be depressed following this experimental procedure?<jupyter_code>mu = 64
sd = 12
dist = st.norm(mu, sd)
dep = np.linspace(30, 98, 301)
pdf = dist.pdf(dep)

plt.plot(dep, pdf)
plt.xlabel('Degree of Depression', fontsize = 18)
plt.ylabel('pdf', fontsize = 18);
print(f"The probability that a mouse will be depressed with a score of 80 or higher is = {dist.sf(80)}")<jupyter_output>The probability that a mouse will be depressed with a score of 80 or higher is = 0.09121121972586788
{'fraction_non_alphanumeric': 0.08328690807799442, 'fraction_numerical': 0.05682451253481894, 'mean_word_length': 5.065878378378378, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '662271', 'license': 'Unlicense', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1084, 'n_words': 478, 'path': 'homework/homework-probability_distributions.ipynb', 'repo_name': 'sathwikiyer/NEU-365P-385L-Spring-2021', 'size': '3590'}