In [ ]:
%matplotlib inline
import numpy as np
from matplotlib import pyplot as plt
np.random.seednp.random.choice,np.random.shufflenp.random.normal,np.random.binomial,np.random.uniform,np.random.poissonplt.hist
In [ ]:
x = np.arange(-10,10,0.2)
y = np.cos(x)
noisy_y = y + np.random.normal(0,0.3,len(y))
plt.plot(x,y)
plt.plot(x,noisy_y)
You are measuring the length of microtubule bundles in S. pombe yeast.
Assuming your expectation is right, will you be able to tell that the mutant had any effect?
In [ ]:
In [ ]:
import scipy.stats
Figure out how to use scipy.stats.ttest_ind.
In [ ]:
In [ ]:
In [ ]:
d = scipy.stats.norm()
x = np.arange(-5,5,0.01)
prob_density = d.pdf(x)
cum_density = d.cdf(x)
In [ ]:
def plot_distrib(d,x,name):
"""
Function that plots the probability density and cumulative density
functions of a distribution over the range defined in x.
"""
fig, ax = plt.subplots(1,2,figsize=(12,5))
ax[0].plot(x,d.pdf(x),"k-")
ax[0].set_title("Probability Density Function ({})".format(name))
ax[0].set_xlabel("x")
ax[0].set_ylabel("P(X == x)")
ax[1].plot(x,d.cdf(x),"k-")
ax[1].set_title("Cumulative Density Function ({})".format(name))
ax[1].set_xlabel("x")
ax[1].set_ylabel("P(X $\geq$ x)")
bottom = np.arange(np.min(x),d.interval(0.95)[0],0.01)
top = np.arange(d.interval(0.95)[1],np.max(x),0.01)
ax[0].fill_between(bottom,d.pdf(bottom),color="gray")
ax[0].fill_between(top,d.pdf(top),color="gray")
In [ ]:
plot_distrib(d,x,"Normal $\mu = 0$, $\sigma = 1$")
In [ ]:
pareto = scipy.stats.pareto(1)
x = range(1,50)
plot_distrib(pareto,x,"Pareto c = 1")