Skip to content

Commit

Permalink
Readme fix: Attempt #1
Browse files Browse the repository at this point in the history
  • Loading branch information
MorganAskins committed Jan 6, 2020
1 parent 1f145d5 commit d0f4215
Show file tree
Hide file tree
Showing 3 changed files with 207 additions and 42 deletions.
145 changes: 124 additions & 21 deletions NewProtofish.ipynb

Large diffs are not rendered by default.

41 changes: 20 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@
[![Build Status](https://travis-ci.com/MorganAskins/watchfish.svg?branch=master)](https://travis-ci.com/MorganAskins/watchfish)
[![Docs](https://img.shields.io/badge/docs-stable-blue.svg)](https://morganaskins.github.io/watchfish)

Given $M$ components, each with an estimated rate $\vec{\beta}$ determined by a
normal distribution with uncertainty $\vec{\sigma}$, calculate the confidence
itervals and perform a hypothesis tests for each parameter $b$.
Given <img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/fb97d38bcc19230b0acd442e17db879c.svg?invert_in_darkmode" align=middle width=17.73973739999999pt height=22.465723500000017pt/> components, each with an estimated rate <img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/c90119f20c10a72dd5dccbfc89cd0785.svg?invert_in_darkmode" align=middle width=11.826559799999991pt height=32.16441360000002pt/> determined by a
normal distribution with uncertainty <img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/3f9f71491501df368c7b0ef70db38d54.svg?invert_in_darkmode" align=middle width=10.747741949999991pt height=23.488575000000026pt/>, calculate the confidence
itervals and perform a hypothesis tests for each parameter <img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/4bdc8d9bcfb35e1c9bfb51fc69687dfc.svg?invert_in_darkmode" align=middle width=7.054796099999991pt height=22.831056599999986pt/>.

Nominally each event corresponds to a set of observables $\vec{x}$ of $N$
Nominally each event corresponds to a set of observables <img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/19e3f7018228f8a8c6559d0ea5500aa2.svg?invert_in_darkmode" align=middle width=10.747741949999991pt height=23.488575000000026pt/> of <img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/f9c4988898e7f532b9f826a75014ed3c.svg?invert_in_darkmode" align=middle width=14.99998994999999pt height=22.465723500000017pt/>
measurements, for any given measurement, the probability for that particular
measurement to come from a particular components is given by

$$ P_i(\vec{x}) $$
<p align="center"><img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/21122488bdced611e7ed8bffcd42b543.svg?invert_in_darkmode" align=middle width=38.20684395pt height=16.438356pt/></p>

The prior probability is then formed through a combination of these components
such that the total probability is

$$ \mathbf{P} = \sum_i^M P_i(\vec{x}) $$
<p align="center"><img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/33f2760534db4fe806e49280c548fc68.svg?invert_in_darkmode" align=middle width=99.53078024999999pt height=47.806078649999996pt/></p>

The likelihood for a full data set of $N$ measurements is the product of each
The likelihood for a full data set of <img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/f9c4988898e7f532b9f826a75014ed3c.svg?invert_in_darkmode" align=middle width=14.99998994999999pt height=22.465723500000017pt/> measurements is the product of each
event total probability

$$\mathcal{L}(\vec{x}) = \prod_j^N \left( \sum_i^M b_iP_i(\vec{x}) \right) / \sum_i^Mb_i $$
<p align="center"><img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/a364c165d0dd83eefa02e86048508140.svg?invert_in_darkmode" align=middle width=234.3143352pt height=50.399845649999996pt/></p>

We can extend the likelihood by proclaiming that each components as well as the
sum of components are simply a stochastic process, produces the extended
likelihood:

$$\mathcal{L}(\vec{x}) = \frac{\text{e}^{-\sum_i^Mb_i}}{N!} \prod_j^N \left( \sum_i^M b_iP_i(\vec{x}) \right) $$
<p align="center"><img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/1624ea1a01ed7e584701d845dd89b4d7.svg?invert_in_darkmode" align=middle width=249.07579454999998pt height=50.399845649999996pt/></p>

Finally, we can claim that we have _a priori_ knowledge of the parameters,
whether it be through side-band analysis or external constraints, by including
Expand All @@ -37,27 +37,26 @@ the shape of that prior, we will consider the information we receive on the
variables to be normally distributed and multiply the likelihood by those
constraints

$$\mathcal{L}(\vec{x}) = \frac{\text{e}^{-\sum_i^Mb_i}}{N!} \prod_j^N \left( \sum_i^M b_iP_i(\vec{x}) \right) \frac{1}{\sqrt{2\pi \sigma_j^2}}\text{exp}\left({\frac{-(\beta_i-b_i)^2}{2\sigma_i^2}}\right)$$
<p align="center"><img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/3a59d3e79684a56191cc0718fda97fe6.svg?invert_in_darkmode" align=middle width=444.07050929999997pt height=57.205834949999996pt/></p>

A few definitions to simplify things:
$$ \lambda := \sum_i^Mb_i $$
<p align="center"><img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/5dbbdf06403eb766a9eaf09d34a85148.svg?invert_in_darkmode" align=middle width=74.26263239999999pt height=47.806078649999996pt/></p>

Then then our objective function $\mathcal{O} = -\text{Ln}\mathcal{L}$
Then then our objective function <img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/cffa95e5b84679edc10428c782fe8e2f.svg?invert_in_darkmode" align=middle width=78.99089384999999pt height=22.465723500000017pt/>

$$\mathcal{O} = \lambda + \text{Ln}N! -\sum_j^N\text{Ln}\left( \sum_i^M b_iP_i(\vec{x}) \right) + \sum_i^M \left( \frac{(\beta_i-b_i)^2}{2\sigma_i^2} + \text{Ln}\sqrt{2\pi \sigma_i} \right)$$
<p align="center"><img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/4d56d8302518412d75f39e43357f5a75.svg?invert_in_darkmode" align=middle width=504.59342834999995pt height=50.399845649999996pt/></p>

Finally, for a counting analysis we assume that an optimal set of cuts has been
applied which optimizes the sensitivity to a particular parameter, which
simplifies the likelihood such that
$$ P_i(\vec{x}) := 1 $$
<p align="center"><img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/a2654de0d1534690d918217913385c8e.svg?invert_in_darkmode" align=middle width=72.90990795pt height=16.438356pt/></p>
Also, because the shape of the likelihood space is independent of constant
parameters, we can drop the $\text{Ln}\sqrt{2\pi \sigma_i}$ terms. We could
also remove the $\text{Ln}N!$ term as well, but for numerical stability we will
keep it around, but use Sterling's approximation: $\text{Ln}N! \approx
N\text{Ln}N - N$. The remaining objective function we will thus use is:
parameters, we can drop the <img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/96a94d4478eee20a423dcae01dfa99ba.svg?invert_in_darkmode" align=middle width=66.15028695pt height=26.045612999999992pt/> terms. We could
also remove the <img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/be53185ed16aa9438e74a8f287753791.svg?invert_in_darkmode" align=middle width=38.97263864999999pt height=22.831056599999986pt/> term as well, but for numerical stability we will
keep it around, but use Sterling's approximation: <img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/83b15a890ca32ebd305a780c615eec74.svg?invert_in_darkmode" align=middle width=145.38783435pt height=22.831056599999986pt/>. The remaining objective function we will thus use is:

$$\mathcal{O} = \lambda - N\text{Ln}\lambda + N\text{Ln}N - N + \sum_i^M \left( \frac{(\beta_i-b_i)^2}{2\sigma_i^2} \right)$$
<p align="center"><img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/fadac3b98225fbb22296866ea07908f8.svg?invert_in_darkmode" align=middle width=355.9963737pt height=47.806078649999996pt/></p>

_Note: If the different values of $\beta$ differ by orders of magnitude, it
_Note: If the different values of <img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/8217ed3c32a785f0b5aad4055f432ad8.svg?invert_in_darkmode" align=middle width=10.16555099999999pt height=22.831056599999986pt/> differ by orders of magnitude, it
might be worth forming an affine invariant form of the likelihood, otherwise
the $\text{Ln}\sqrt{2\pi \sigma_i}$ term should not matter_
the <img src="https://rawgit.com/in [email protected]:MorganAskins/watchfish/master/svgs/96a94d4478eee20a423dcae01dfa99ba.svg?invert_in_darkmode" align=middle width=66.15028695pt height=26.045612999999992pt/> term should not matter_
63 changes: 63 additions & 0 deletions readme_markdown.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Watchfish

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/morganaskins/watchfish/master)
[![Build Status](https://travis-ci.com/MorganAskins/watchfish.svg?branch=master)](https://travis-ci.com/MorganAskins/watchfish)
[![Docs](https://img.shields.io/badge/docs-stable-blue.svg)](https://morganaskins.github.io/watchfish)

Given $M$ components, each with an estimated rate $\vec{\beta}$ determined by a
normal distribution with uncertainty $\vec{\sigma}$, calculate the confidence
itervals and perform a hypothesis tests for each parameter $b$.

Nominally each event corresponds to a set of observables $\vec{x}$ of $N$
measurements, for any given measurement, the probability for that particular
measurement to come from a particular components is given by

$$ P_i(\vec{x}) $$

The prior probability is then formed through a combination of these components
such that the total probability is

$$ \mathbf{P} = \sum_i^M P_i(\vec{x}) $$

The likelihood for a full data set of $N$ measurements is the product of each
event total probability

$$\mathcal{L}(\vec{x}) = \prod_j^N \left( \sum_i^M b_iP_i(\vec{x}) \right) / \sum_i^Mb_i $$

We can extend the likelihood by proclaiming that each components as well as the
sum of components are simply a stochastic process, produces the extended
likelihood:

$$\mathcal{L}(\vec{x}) = \frac{\text{e}^{-\sum_i^Mb_i}}{N!} \prod_j^N \left( \sum_i^M b_iP_i(\vec{x}) \right) $$

Finally, we can claim that we have _a priori_ knowledge of the parameters,
whether it be through side-band analysis or external constraints, by including
those constraints via some prior probability. Given no specific knowledge of
the shape of that prior, we will consider the information we receive on the
variables to be normally distributed and multiply the likelihood by those
constraints

$$\mathcal{L}(\vec{x}) = \frac{\text{e}^{-\sum_i^Mb_i}}{N!} \prod_j^N \left( \sum_i^M b_iP_i(\vec{x}) \right) \frac{1}{\sqrt{2\pi \sigma_j^2}}\text{exp}\left({\frac{-(\beta_i-b_i)^2}{2\sigma_i^2}}\right)$$

A few definitions to simplify things:
$$ \lambda := \sum_i^Mb_i $$

Then then our objective function $\mathcal{O} = -\text{Ln}\mathcal{L}$

$$\mathcal{O} = \lambda + \text{Ln}N! -\sum_j^N\text{Ln}\left( \sum_i^M b_iP_i(\vec{x}) \right) + \sum_i^M \left( \frac{(\beta_i-b_i)^2}{2\sigma_i^2} + \text{Ln}\sqrt{2\pi \sigma_i} \right)$$

Finally, for a counting analysis we assume that an optimal set of cuts has been
applied which optimizes the sensitivity to a particular parameter, which
simplifies the likelihood such that
$$ P_i(\vec{x}) := 1 $$
Also, because the shape of the likelihood space is independent of constant
parameters, we can drop the $\text{Ln}\sqrt{2\pi \sigma_i}$ terms. We could
also remove the $\text{Ln}N!$ term as well, but for numerical stability we will
keep it around, but use Sterling's approximation: $\text{Ln}N! \approx
N\text{Ln}N - N$. The remaining objective function we will thus use is:

$$\mathcal{O} = \lambda - N\text{Ln}\lambda + N\text{Ln}N - N + \sum_i^M \left( \frac{(\beta_i-b_i)^2}{2\sigma_i^2} \right)$$

_Note: If the different values of $\beta$ differ by orders of magnitude, it
might be worth forming an affine invariant form of the likelihood, otherwise
the $\text{Ln}\sqrt{2\pi \sigma_i}$ term should not matter_

0 comments on commit d0f4215

Please sign in to comment.