<jupyter_start><jupyter_text>Homework (12 pts) - Probability Distributions of Random Variables<jupyter_code>import numpy as np
import scipy.stats as st
import matplotlib.pyplot as plt
%config InlineBackend.figure_format = 'retina'
plt.rcParams['axes.labelsize'] = 18<jupyter_output><empty_output><jupyter_text>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>mutationRate = 1.2 * 2
numMutationsDist = st.poisson(mutationRate)

numMutations = np.arange(11)

plt.bar(numMutations, numMutationsDist.pmf(numMutations))
plt.xlabel('# Mutations')
plt.ylabel('pmf');
prob8orMore = numMutationsDist.sf(7)

numIndividualsWith8orMore = 1000 * prob8orMore

numExpectedDeaths = numIndividualsWith8orMore * 0.50

print(f"{numExpectedDeaths :.2f} deaths are expected per 1000 individuals.")<jupyter_output>1.67 deaths are expected per 1000 individuals.<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>spikeRate_Hz = 2  # per second
intervalsDist = st.expon(loc=0, scale=1/spikeRate_Hz)

intervals_sec = np.linspace(0, intervalsDist.ppf(0.95), 100)

plt.plot(intervals_sec, intervalsDist.pdf(intervals_sec))
plt.xlabel('Interspike Interval (s)')
plt.ylabel('pdf');
# downstream rate = upstream rate * probability that upstream spike interval is less than 0.1 seconds
probIntervalLessThan100ms = intervalsDist.cdf(0.1)
downstreamSpikeRate_Hz = spikeRate_Hz * probIntervalLessThan100ms
print(f"Average spike rate of downstream neuron is {downstreamSpikeRate_Hz :.2f} per second.")<jupyter_output>Average spike rate of downstream neuron is 0.36 per second.<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>numSites = 4
probBoundAtEachSite = 0.3

boundDist = st.binom(numSites, probBoundAtEachSite)

numBound = np.arange(5)

plt.bar(numBound, boundDist.pmf(numBound))
plt.xlabel('# Bound Subunits')
plt.ylabel('pmf');<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>scoreDist = st.norm(64, 12)

scores = np.linspace(0, 120, 121)

plt.plot(scores, scoreDist.pdf(scores))
plt.xlabel('Score')
plt.ylabel('pdf');
probDepressed = scoreDist.sf(80)

print(f"{probDepressed * 100: .1f}% of mice will be depressed following the experimental protocol.")<jupyter_output>9.1% of mice will be depressed following the experimental protocol.
{'fraction_non_alphanumeric': 0.07731819410651528, 'fraction_numerical': 0.031630170316301706, 'mean_word_length': 5.801470588235294, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '318473', 'license': 'Unlicense', 'n_tokens_mistral': 1241, 'n_tokens_neox': 1086, 'n_words': 429, 'path': 'homework/key-probability_distributions.ipynb', 'repo_name': 'nishadalal120/NEU-365P-385L-Spring-2021', 'size': '3699'}