Probability Distributions and their Stories
Given any module that deals with statistics, one basic skill you must have is to be able to program and create plots of probability distributions typically encountered in the field of data science. This tutorial should remind you of various distributions introduced in this section, but now they are phrased using the scipy.stats module.
Discrete distributions
Binomial distribution
- Story. We perform Bernoulli trials, each with probability of success. The number of successes, , is Binomially distributed.
- Example. Distribution of plasmids between daughter cells in cell division. Each of the plasmids as a chance of being in daughter cell 1 ("success"). The number of plasmids, , in daughter cell 1 is binomially distributed.
- Parameters. There are two parameters: the probability of success for each Bernoulli trial, and the number of trials, .
- Support. The Binomial distribution is supported on the set of nonnegative integers.
- Probability mass function.
- Usage
Package Syntax NumPy np.random.binomial(N, theta)
SciPy scipy.stats.binom(N, theta)
Stan binomial(N, theta)
- Related distributions.
- In the limit of and such that the quantity is fixed, the Binomial distribution becomes a Poisson distribution with parameter .
- The Binomial distribution is a limit of the Hypergeometric distribution. Considering the Hypergeometric distribution and taking the limit of such that is fixed, we get a Binomial distribution with parameters and .
params = [dict(name='N', start=1, end=20, value=5, step=1),
dict(name='θ', start=0, end=1, value=0.5, step=0.01)]
app = distribution_plot_app(x_min=0,
x_max=20,
scipy_dist=st.binom,
params=params,
x_axis_label='n',
title='Binomial')
bokeh.io.show(app, notebook_url=notebook_url)