Department of Physics and Astronomy

The Forbes Group

Beyond Normal Distributions

$\newcommand{\vect}[1]{\mathbf{#1}} \newcommand{\uvect}[1]{\hat{#1}} \newcommand{\abs}[1]{\lvert#1\rvert} \newcommand{\norm}[1]{\lVert#1\rVert} \newcommand{\I}{\mathrm{i}} \newcommand{\ket}[1]{\left|#1\right\rangle} \newcommand{\bra}[1]{\left\langle#1\right|} \newcommand{\braket}[1]{\langle#1\rangle} \newcommand{\op}[1]{\mathbf{#1}} \newcommand{\mat}[1]{\mathbf{#1}} \newcommand{\d}{\mathrm{d}} \newcommand{\pdiff}[3][]{\frac{\partial^{#1} #2}{\partial {#3}^{#1}}} \newcommand{\diff}[3][]{\frac{\d^{#1} #2}{\d {#3}^{#1}}} \newcommand{\ddiff}[3][]{\frac{\delta^{#1} #2}{\delta {#3}^{#1}}} \DeclareMathOperator{\erf}{erf} \DeclareMathOperator{\Tr}{Tr} \DeclareMathOperator{\order}{O} \DeclareMathOperator{\diag}{diag} \DeclareMathOperator{\sgn}{sgn} \DeclareMathOperator{\sech}{sech} $

In this post we discuss modeling covariances beyond the Gaussian approximation.

In [9]:
import mmf_setup;mmf_setup.nbinit(hgroot=False)

This cell contains some definitions for equations and some CSS for styling the notebook. If things look a bit strange, please try the following:

  • Choose "Trust Notebook" from the "File" menu.
  • Re-execute this cell.
  • Reload the notebook.
In [2]:
%pylab inline --no-import-all
from scipy import stats

x = np.linspace
f = stats.lognorm.pdf()
Populating the interactive namespace from numpy and matplotlib
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-3b06b66c0832> in <module>
      2 from scipy import stats
      3 
----> 4 f = stats.lognorm()

/data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages/scipy/stats/_distn_infrastructure.py in __call__(self, *args, **kwds)
    770 
    771     def __call__(self, *args, **kwds):
--> 772         return self.freeze(*args, **kwds)
    773     __call__.__doc__ = freeze.__doc__
    774 

/data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages/scipy/stats/_distn_infrastructure.py in freeze(self, *args, **kwds)
    767 
    768         """
--> 769         return rv_frozen(self, *args, **kwds)
    770 
    771     def __call__(self, *args, **kwds):

/data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages/scipy/stats/_distn_infrastructure.py in __init__(self, dist, *args, **kwds)
    435 
    436         # a, b may be set in _argcheck, depending on *args, **kwds. Ouch.
--> 437         shapes, _, _ = self.dist._parse_args(*args, **kwds)
    438         self.dist._argcheck(*shapes)
    439         self.a, self.b = self.dist.a, self.dist.b

TypeError: _parse_args() missing 1 required positional argument: 's'

Characterization

Consider a random variable $X$ with probability distribution $f(x)$.

Addition of Stochastic Variables

Let $X_n$ be $N$ independent stochastic variables with joint probability density $P_X(x_1, x_2, \dots, x_N) = P(\vect{x})$. Then, the probability distribution for the sum $Y = \sum_n X_n$ is:

$$ P_Y(y) = \idotsint \delta\Bigl(\sum_{n}x_n - y\Bigr)P_X(\vect{x})\prod_{n=1}^{N}\d{x_n} $$

If the variables $X_n$ are independent, then $P_X(\vect{x}) = \prod_{n}P_{X_n}(x_n)$, and this simplifies:

$$ P_Y(y) = \idotsint \delta\left(\sum_{n}x_n - y\right)\prod_{n=1}^{N}P_{X_n}(x_n)\d{x_n}. $$

Environment

Execute the following two cells to define a conda environment for running this notebook.

In [7]:
%%file environment.soerp.yml
name: blog.soerp
channels:
  - defaults
  - conda-forge
dependencies:
  - ipykernel
  - notebook
  - uncertainties
  - scipy
  - matplotlib
  - pip:
    - soerp
    - mmf_setup
Overwriting environment.soerp.yml
In [8]:
!conda env update -f environment.soerp.yml
Solving environment: done
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Looking in links: https://bitbucket.org/mforbes/mypi/
Requirement already satisfied: soerp in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from -r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 1)) (0.9.6)
Requirement already satisfied: mmf_setup in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from -r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 2)) (0.1.11)
Requirement already satisfied: matplotlib in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from soerp->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 1)) (3.0.0)
Requirement already satisfied: numpy in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from soerp->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 1)) (1.15.2)
Requirement already satisfied: ad in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from soerp->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 1)) (1.3.2)
Requirement already satisfied: scipy in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from soerp->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 1)) (1.1.0)
Requirement already satisfied: python-hglib in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from mmf_setup->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 2)) (2.6.1)
Requirement already satisfied: nbstripout>=0.2.0 in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from mmf_setup->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 2)) (0.3.3)
Requirement already satisfied: cycler>=0.10 in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from matplotlib->soerp->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 1)) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from matplotlib->soerp->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 1)) (1.0.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from matplotlib->soerp->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 1)) (2.2.2)
Requirement already satisfied: python-dateutil>=2.1 in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from matplotlib->soerp->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 1)) (2.7.3)
Requirement already satisfied: nbformat in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from nbstripout>=0.2.0->mmf_setup->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 2)) (4.4.0)
Requirement already satisfied: six in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from cycler>=0.10->matplotlib->soerp->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 1)) (1.11.0)
Requirement already satisfied: setuptools in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from kiwisolver>=1.0.1->matplotlib->soerp->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 1)) (40.4.3)
Requirement already satisfied: ipython-genutils in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from nbformat->nbstripout>=0.2.0->mmf_setup->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 2)) (0.2.0)
Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from nbformat->nbstripout>=0.2.0->mmf_setup->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 2)) (2.6.0)
Requirement already satisfied: traitlets>=4.1 in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from nbformat->nbstripout>=0.2.0->mmf_setup->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 2)) (4.3.2)
Requirement already satisfied: jupyter-core in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from nbformat->nbstripout>=0.2.0->mmf_setup->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 2)) (4.4.0)
Requirement already satisfied: decorator in /data/apps/conda/envs/blog.soerp/lib/python3.7/site-packages (from traitlets>=4.1->nbformat->nbstripout>=0.2.0->mmf_setup->-r /Users/mforbes/work/mmfbb/forbes_group_website/posts/draft/blog/condaenv.79jey1_z.requirements.txt (line 2)) (4.3.0)
mkl-random 1.0.1 requires cython, which is not installed.
#
# To activate this environment, use
#
#     $ conda activate blog.soerp
#
# To deactivate an active environment, use
#
#     $ conda deactivate

In [ ]: