<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.iac.isu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Stocjas2</id>
	<title>New IAC Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.iac.isu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Stocjas2"/>
	<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=Special:Contributions/Stocjas2"/>
	<updated>2026-05-09T15:22:43Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.2</generator>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91710</id>
		<title>TF ErrorAna StatInference</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91710"/>
		<updated>2014-03-21T19:19:00Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* The Method of Determinants */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Statistical Inference&lt;br /&gt;
=Frequentist -vs- Bayesian Inference=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When it comes to testing a hypothesis, there are  two dominant philosophies known as a Frequentist or a Bayesian perspective.&lt;br /&gt;
&lt;br /&gt;
The dominant discussion for this class will be from the Frequentist perspective.&lt;br /&gt;
&lt;br /&gt;
== frequentist statistical inference==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made using a null-hypothesis test; that is, one that answers the question, Assuming that the null hypothesis is true, what is the probability of observing a value for the test statistic that is at least as extreme as the value that was actually observed?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The relative frequency of occurrence of an event, in a number of repetitions of the experiment, is a measure of the probability of that event.&lt;br /&gt;
Thus, if &amp;lt;math&amp;gt;n_t&amp;lt;/math&amp;gt; is the total number of trials and &amp;lt;math&amp;gt;n_x&amp;lt;/math&amp;gt; is the number of trials where the event x occurred, the probability P(x) of the event occurring will be approximated by the relative frequency as follows:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) \approx \frac{n_x}{n_t}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Bayesian inference.==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made by using evidence or observations  to update or to newly infer the probability that a hypothesis may be true. The name &amp;quot;Bayesian&amp;quot; comes from the frequent use of Bayes' theorem in the inference process.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem relates the conditional probability, conditional and marginal probability, marginal probabilities of events ''A'' and ''B'', where ''B'' has a non-vanishing probability:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}\,\! &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Each term in Bayes' theorem has a conventional name:&lt;br /&gt;
* P(''A'') is the prior probability or marginal probability of ''A''. It is &amp;quot;prior&amp;quot; in the sense that it does not take into account any information about ''B''.&lt;br /&gt;
* P(''B'') is the prior or marginal probability of ''B'', and acts as a normalizing constant. &lt;br /&gt;
* P(''A''|''B'') is the conditional probability of ''A'', given ''B''. It is also called the posterior probability because it is derived from or depends upon the specified value of ''B''.&lt;br /&gt;
* P(''B''|''A'') is the conditional probability of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem in this form gives a mathematical representation of how the conditional probabability of event ''A'' given ''B'' is related to the converse conditional probabablity of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
Suppose there is a school having 60% boys and 40% girls as students. &lt;br /&gt;
&lt;br /&gt;
The female students wear trousers or skirts in equal numbers; the boys all wear trousers. &lt;br /&gt;
&lt;br /&gt;
An observer sees a (random) student from a distance; all the observer can see is that this student is wearing trousers. &lt;br /&gt;
&lt;br /&gt;
What is the probability this student is a girl? &lt;br /&gt;
&lt;br /&gt;
The correct answer can be computed using Bayes' theorem.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P(A) \equiv&amp;lt;/math&amp;gt; probability that  the student observed is a girl = 0.4&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B) \equiv&amp;lt;/math&amp;gt; probability  that the student observed is wearing trousers = 60+20/100 = 0.8&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B|A) \equiv&amp;lt;/math&amp;gt; probability the student is wearing trousers given that the student is a girl&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A|B) \equiv&amp;lt;/math&amp;gt; probability the student is a girl given that the student is wearing trousers&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(B|A) =0.5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B|A) P(A)}{P(B)} = \frac{0.5 \times 0.4}{0.8} = 0.25.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Method of Maximum Likelihood=&lt;br /&gt;
&lt;br /&gt;
;The principle of maximum likelihood is the cornerstone of Frequentist based hypothesis testing and may be written as&lt;br /&gt;
:The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observation is a maximum.&lt;br /&gt;
&lt;br /&gt;
= Least Squares Fit to a Line=&lt;br /&gt;
&lt;br /&gt;
== Applying the Method of Maximum Likelihood==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our object is to find the best straight line fit for an expected linear relationship between dependent variate &amp;lt;math&amp;gt;(y)&amp;lt;/math&amp;gt;  and independent variate &amp;lt;math&amp;gt;(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we let &amp;lt;math&amp;gt;y_0(x)&amp;lt;/math&amp;gt; represent the &amp;quot;true&amp;quot; linear relationship between independent variate &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and dependent variate &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_o(x) = A + B x&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i = \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A,B) = \Pi \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \left ( \frac{1}{\sigma \sqrt{2 \pi}}\right )^N e^{- \frac{1}{2} \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt; = Max&lt;br /&gt;
 &lt;br /&gt;
The maximum probability will result in the best values for &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\chi^2 = \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2 = \sum \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2&amp;lt;/math&amp;gt; = Min&lt;br /&gt;
&lt;br /&gt;
The min for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; occurs when the function is a minimum for both parameters A &amp;amp; B : ie&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \sum \frac{ \partial}{\partial A} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \sum \frac{ \partial}{\partial B} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;If &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt; : All variances are the same  (weighted fits don't make this assumption)&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial A} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial B} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum x_i \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum  x_i \left( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above equations represent a set of simultaneous of 2 equations and 2 unknowns which can be solved.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum y_i = \sum A + B \sum x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum x_i y_i = A \sum x_i + B \sum x_i^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} \sum y_i \\ \sum x_i y_i \end{array} \right) = \left( \begin{array}{cc} N &amp;amp; \sum x_i\\&lt;br /&gt;
\sum x_i &amp;amp; \sum x_i^2 \end{array} \right)\left( \begin{array}{c} A \\ B \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The Method of Determinants ===&lt;br /&gt;
for the matrix problem:&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} y_1 \\ y_2 \end{array} \right) = \left( \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right)\left( \begin{array}{c} x_1 \\ x_2 \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the above can be written as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_1 = a_{11} x_1 + a_{12} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;y_2 = a_{21} x_1 + a_{22} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
solving for &amp;lt;math&amp;gt;x_1&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;y_1&amp;lt;/math&amp;gt; is known&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;a_{22} (y_1 = a_{11} x_1 + a_{12} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-a_{12} (y_2 = a_{21} x_1 + a_{22} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow a_{22} y_1 - a_{12} y_2 = (a_{11}a_{22} - a_{12}a_{21}) x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| = \left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
: &amp;lt;math&amp;gt;x_1 = \frac{\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt; similarly &amp;lt;math&amp;gt;x_2 = \frac{\left| \begin{array}{cc}  a_{11} &amp;amp; y_1 \\  a_{21} &amp;amp; y_2  \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Solutions exist as long as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apply the method of determinant for the maximum likelihood problem above&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the uncertainty in all the measurements is not the same then we need to insert &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; back into the system of equations.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Uncertainty in the Linear Fit parameters==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
By definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}&amp;lt;/math&amp;gt;  : there are 2 parameters and N data points which translate to (N-2) degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
The least square fit ( assuming equal &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;) has the following solution for the parameters A &amp;amp; B as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\sum y_i \sum x_i^2 - \sum x_i \sum x_i y_i  }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \frac{(1) \sum x_i^2 - x_j\sum x_i   }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt; only the &amp;lt;math&amp;gt;y_j&amp;lt;/math&amp;gt; term survives &lt;br /&gt;
:&amp;lt;math&amp;gt; = D \left ( \sum x_i^2 - x_j\sum x_i \right)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D \equiv \frac{1}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}=\frac{1}{N\sum x_i^2 - \sum x_i \sum x_i }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_{j=1}^N \sigma_j^2 \left ( D \left ( \sum x_i^2 - x_j\sum x_i \right) \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2 - x_j\sum x_i \right )^2&amp;lt;/math&amp;gt; : Assume &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2\right )^2  + \left (x_j\sum x_i \right )^2 - 2 \left ( \sum x_i^2 x_j \sum x_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  \sum_{j=1}^N  \left ( \sum x_i^2\right ) +  \sum_{j=1}^N x_j^2  -  2 \sum x_i \sum_{j=1}^N x_j  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum x_i \sum_{j=1}^N x_j  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sum x_i \sum_{j=1}^N x_j \approx \sum_{j=1}^N x_j^2&amp;lt;/math&amp;gt; Both sums are over the number of observations &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum_{j=1}^N x_j^2  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2 \frac{1}{D}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \sigma^2  \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we redefine our origin in the linear plot so the line is centered a x=0 then &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum{x_i} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2} = \frac{\sum x_i^2 }{N\sum x_i^2 } = \frac{1}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{1}{N} = \frac{\sigma^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: The parameter A is the y-intercept so it makes some intuitive sense that the error in the Y -intercept would be dominated by the statistical error in Y&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in B===&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}= \frac{\partial}{\partial y_j} D \left ( N\sum x_i y_i -\sum x_i \sum y_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;=  D \left ( N x_j - \sum x_i \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 D^2 \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;\sigma_j = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N^2 x_j^2 - 2N x_j \sum x_i + \sum x_i^2\right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum_{j=1}^Nx_j^2 - 2N \sum x_i \sum_{j=1}^N x_j  + \sum x_i^2 \sum_{j=1}^N  \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum x_i^2 - 2N \sum x_i \sum_{j=1}^N x_j  + N \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - 2 \sum x_i \sum_{j=1}^N x_j  +  \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = N D^2 \sigma^2 \frac{1}{D} = ND \sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_B^2= \frac{N \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}} {N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Linear Fit with error==&lt;br /&gt;
&lt;br /&gt;
From above we know that if each independent measurement has a different error &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; then the fit parameters are given by &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D = \frac{1}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right| }= &lt;br /&gt;
\frac{1}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [ \sum\frac{ y_i}{\sigma_i^2} \sum\frac{ x_i^2}{\sigma_i^2}- \sum\frac{ x_i}{\sigma_i^2}  \sum\frac{ x_i y_i}{\sigma_i^2}  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ] =  \sum_{j=1}^N \left [ \sigma_j^2  D^2 \left ( \frac{ 1}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \sigma_j^2  \left [  \frac{ 1}{\sigma_j^4} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \frac{ x_j}{\sigma_j^4} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \frac{ x_j^2}{\sigma_j^4} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2   \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ 1}{\sigma_i^2} \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 -  \left( \sum \frac{ x_j}{\sigma_j^2} \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= D    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)  = \frac{ \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) }{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Compare with the unweighted error&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in B ===&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [\sum \frac{1}{\sigma_i^2}\sum \frac{x_i y_i}{\sigma_i^2}  - \sum \frac{ y_i}{\sigma_i^2}\sum \frac{x_i}{\sigma_i^2}   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_{j=1}^N \left [ \sigma_j^2 \left (  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \left [  \frac{ 1}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} + \left (\frac{1}{\sigma_j}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} + \left (\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 1 \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D \sum_{j=1}^N \frac{ 1}{\sigma_j^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_B^2 = \frac{  \sum\frac{ 1}{\sigma_i^2}}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Correlation Probability==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the Linear Fit has been performed, the next step will be to determine a probability that the Fit is actually describing the data.&lt;br /&gt;
&lt;br /&gt;
The Correlation Probability (R) is one method used to try and determine this probability.&lt;br /&gt;
&lt;br /&gt;
This method evaluates the &amp;quot;slope&amp;quot; parameter to determine if there is a correlation between the dependent and independent variables , x and y.&lt;br /&gt;
&lt;br /&gt;
The liner fit above was done to minimize \chi^2 for the following model&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y = A + Bx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What if we turn this  equation around such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = A^{\prime} + B^{\prime}y&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;B^{\prime} =0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is complete correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  &lt;br /&gt;
:&amp;lt;math&amp;gt;A = -\frac{A^{\prime}}{B^{\prime}}&amp;lt;/math&amp;gt;        and     &amp;lt;math&amp;gt;B = \frac{1}{B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: and &amp;lt;math&amp;gt;BB^{\prime} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So one can define a metric BB^{\prime} which has the natural range between 0 and 1 such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;R \equiv \sqrt{B B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
since&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and one can show that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B^{\prime} = \frac{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum y_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum y_i  &amp;amp; \sum y_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;R = \sqrt{ \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  } \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=   \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{\sqrt{\left( N\sum x_i^2 - \sum x_i \sum x_i  \right ) \left (N\sum y_i^2 - \sum y_i \sum y_i\right)  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:The correlation coefficient (R) CAN'T be used to indicate the degree of correlation.  The probability distribution &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; can be derived from a 2-D gaussian but knowledge of the correlation coefficient of the parent population &amp;lt;math&amp;gt;(\rho)&amp;lt;/math&amp;gt; is required to evaluate R of the sample distribution.&lt;br /&gt;
&lt;br /&gt;
Instead one assumes a correlation of &amp;lt;math&amp;gt;\rho=0&amp;lt;/math&amp;gt; in the parent distribution and then compares the sample value of &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; with what you would get if there were no correlation.&lt;br /&gt;
&lt;br /&gt;
The smaller &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; is the more likely that the data are correlated and that the linear fit is correct.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_R(R,\nu) = \frac{1}{\sqrt{\pi}} \frac{\Gamma\left ( \frac{\nu+1}{2}\right )}{\Gamma \left ( \frac{\nu}{2}\right)} \left( 1-R^2\right)^{\left( \frac{\nu-2}{2}\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
= Probability that any random sample of UNCORRELATED data would yield the correlation coefficient &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\Gamma(x) = \int_0^{\infty} t^{x-1}e^{-t} dt&amp;lt;/math&amp;gt;&lt;br /&gt;
 (ROOT::Math::tgamma(double x) )&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu=N-2&amp;lt;/math&amp;gt; = number of degrees of freedom = Number of data points - Number of parameters in fit function&lt;br /&gt;
&lt;br /&gt;
Derived in &amp;quot;Pugh and Winslow, The Analysis of Physical Measurement, Addison-Wesley Publishing, 1966.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Least Squares fit to a Polynomial=&lt;br /&gt;
&lt;br /&gt;
Let's assume we wish to now fit a polynomial instead of a straight line to the data.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) = \sum_{j=0}^{n} a_j x^{n}=\sum_{j=0}^{n} a_j f_j(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f_j(x) =&amp;lt;/math&amp;gt; a function which does not depend on &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i(a_0,a_1, \cdots ,a_n) = \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;a_n&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once again the probability is maximized when the numerator of the exponential is a minimum&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
The minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \frac{\partial \left( - \sum_{j=0}^{n} a_j f_j(x_i) \right)}{\partial a_k}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2 \sum_i^N  \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2\sum_i^N  \frac{1}{\sigma_i^2} \left (  -  f_k(x_i) \right) \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) =0&amp;lt;/math&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
: &amp;lt;math&amp;gt;\Rightarrow \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =  \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}  \sum_{j=0}^{n} a_j f_j(x_i)=  \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You now have a system of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; coupled equations for the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; with each equation summing over the &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; measurements.&lt;br /&gt;
&lt;br /&gt;
The first equation &amp;lt;math&amp;gt;(f_1)&amp;lt;/math&amp;gt; looks like this&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_i^N f_1(x_i) \frac{y_i}{\sigma_i^2} = \sum_i^N \frac{f_1(x_i)}{\sigma_i^2} \left ( a_1 f_1(x_i) + a_2 f_2(x_i) + \cdots a_n f_n(x_i)\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could use the method of determinants as we did to find the parameters &amp;lt;math&amp;gt;(a_n)&amp;lt;/math&amp;gt; for a linear fit but it is more convenient to use matrices in a technique referred to as regression analysis&lt;br /&gt;
&lt;br /&gt;
==Regression Analysis==&lt;br /&gt;
&lt;br /&gt;
The parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; in the previous section are linear parameters to a general function which may be a polynomial.&lt;br /&gt;
&lt;br /&gt;
The system of equations is composed of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations where the &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation is given as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
may be represented in matrix form as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\beta_k= \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{kj} = \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or in matrix form&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha} = \left ( \begin{matrix} \alpha_{11}  &amp;amp; \alpha_{12} &amp;amp; \cdots &amp;amp; \alpha_{1j} \\ \alpha_{21}  &amp;amp; \alpha_{22}&amp;amp;\cdots&amp;amp;\alpha_{2j} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1} &amp;amp;\alpha_{k2} &amp;amp;\cdots &amp;amp;\alpha_{kj}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
; the objective is to find the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
: To find &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; just invert the matrix&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \tilde{\beta} = \tilde{a} \tilde{\alpha} \right) \tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{\alpha}\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \Rightarrow  \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Thus if you invert the matrix &amp;lt;math&amp;gt;\tilde{\alpha}&amp;lt;/math&amp;gt; you find &amp;lt;math&amp;gt;\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt; and as a result the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Matrix inversion==&lt;br /&gt;
&lt;br /&gt;
The first thing to note is that for the inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A})&amp;lt;/math&amp;gt; to exist its determinant can not be zero&lt;br /&gt;
: &amp;lt;math&amp;gt;\left |\tilde{A} \right | \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A}^{-1})&amp;lt;/math&amp;gt; is defined such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{A}^{-1} = \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we divide both sides by the matrix &amp;lt;math&amp;gt;\tilde {A}&amp;lt;/math&amp;gt; then we have&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A}^{-1} = \frac{\tilde{1}}{\tilde{A} }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above ratio of the unity matrix to matrix &amp;lt;math&amp;gt;\tilde{A}&amp;lt;/math&amp;gt; is always equal to &amp;lt;math&amp;gt;\tilde{A}^{-1}&amp;lt;/math&amp;gt; as long as both the numerator and denominator are multiplied by the same constant factor.&lt;br /&gt;
&lt;br /&gt;
If we do such operations we can transform the ratio such that the denominator has the unity matrix and then the numerator will have the inverse matrix.  &lt;br /&gt;
&lt;br /&gt;
This is the principle of Gauss-Jordan Elimination.&lt;br /&gt;
&lt;br /&gt;
===Gauss-Jordan Elimination===&lt;br /&gt;
If Gauss–Jordan elimination is applied on a square matrix, it can be used to calculate the inverse matrix. This can be done by augmenting the square matrix with the identity matrix of the same dimensions, and through the following matrix operations:&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{1} \Rightarrow&lt;br /&gt;
 \tilde{1} \tilde{A}^{-1} .&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the original square matrix, &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;, is given by the following expression:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 \\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 \\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, after augmenting by the identity, the following is obtained:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A}\tilde{1} = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By performing elementary row operations on the &amp;lt;math&amp;gt;\tilde{A}\tilde{1}&amp;lt;/math&amp;gt; matrix until it reaches reduced row echelon form, the following is the final result:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1}\tilde{A}^{-1}  = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 &amp;amp; \frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1 &amp;amp; \frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix augmentation can now be undone, which gives the following:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}\qquad&lt;br /&gt;
 \tilde{A}^{-1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
\frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
\frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
\frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
:&amp;lt;math&amp;gt; &lt;br /&gt;
 \tilde{A}^{-1} =\frac{1}{4}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}=\frac{1}{det(A)}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
A matrix is non-singular (meaning that it has an inverse matrix) if and only if the identity matrix can be obtained using only elementary row operations.&lt;br /&gt;
&lt;br /&gt;
== Error Matrix==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
Where the definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - \sum_{j=0}^{n} a_j f_j(x_i) \right)^2}{N -n}&amp;lt;/math&amp;gt;  : there are &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; parameters and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; data points which translate to &amp;lt;math&amp;gt;(N-n)&amp;lt;/math&amp;gt; degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
Applying this for the parameter &amp;lt;math&amp;gt;a_k&amp;lt;/math&amp;gt; indicates that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k}^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial a_k}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;But what if there are covariances?&lt;br /&gt;
In that case the following general expression applies&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = &amp;lt;/math&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha}^{-1} = \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n) = ( \beta_1, \beta_2, \cdots , \beta_n) \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow  a_k = \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = \frac{\partial }{\partial y_i} \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\partial }{\partial y_i} \sum_j^n \left( \sum_i^N f_j(x_i) \frac{y_i}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt; :only one &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; in the sum over &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; survives the derivative&lt;br /&gt;
&lt;br /&gt;
similarly&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_l}{\partial y_i} = \sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
substituting&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^N \left [ \sigma_i^2  \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}\sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right)\alpha_{pl}^{-1} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;math&amp;gt; \sigma_i^2&amp;lt;/math&amp;gt; term appears on the  top and bottom.&lt;br /&gt;
;Move the outer most sum to the inside&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 =  \sum_j^n \left(   \alpha_{jk}^{-1}\sum_p^n \sum_i^N  \frac{f_j(x_i)  f_p(x_i)}{\sigma_i^2} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n  \alpha_{jk}^{-1}\sum_p^n \left(  \alpha_{jp} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n \alpha_{jk}^{-1}\tilde{1}_{jl}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{1}_{jl}&amp;lt;/math&amp;gt;  = the &amp;lt;math&amp;gt;j,l&amp;lt;/math&amp;gt; element of the unity matrix = 1&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{jk} = \alpha_{kj} &amp;lt;/math&amp;gt; : the matrix is symmetric.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sigma_{a_k,a_l}^2 =  \sum_j^n \alpha_{kj}^{-1}\tilde{1}_{jl}= \alpha_{kl}^{-1}&amp;lt;/math&amp;gt; = Covariance/Error matrix element&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse matrix &amp;lt;math&amp;gt;\alpha_{kl}^{-1}&amp;lt;/math&amp;gt; tells you the variance and covariance for the calculation of the total error.&lt;br /&gt;
&lt;br /&gt;
;Remember&lt;br /&gt;
:&amp;lt;math&amp;gt;Y = \sum_i^n a_i f_i(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_i}^2 = \alpha_{ii}^{-1}&amp;lt;/math&amp;gt;= error in the parameters&lt;br /&gt;
: &amp;lt;math&amp;gt;s^2 = \sum_i^n \sum_j^n \left ( \frac{\partial Y}{\partial a_i}\frac{\partial Y}{\partial a_j}\right) \sigma_{ij}=\sum_i^n \sum_j^n \left ( f_i(x)f_j(x)\right) \sigma_{ij} &amp;lt;/math&amp;gt; = error in the model's prediction&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^n \sum_j^n  x^{j+i} \sigma_{ij}&amp;lt;/math&amp;gt; If Y is a power series in x &amp;lt;math&amp;gt;(f_i(x) = x^i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Chi-Square Distribution=&lt;br /&gt;
&lt;br /&gt;
The above tools allow you to perform a least squares fit to data using high order polynomials.&lt;br /&gt;
&lt;br /&gt;
; The question though is how high in order should you go?  (ie; when should you stop adding parameters to the fit?)&lt;br /&gt;
&lt;br /&gt;
One argument is that you should stop increasing the number of parameters if they don't change much.  The parameters, using the above techniques, are correlated such that when you add another order to the fit all the parameters have the potential to change in value.  If their change is miniscule then you can ague that adding higher orders to the fit does not change the fit.  There are techniu&lt;br /&gt;
&lt;br /&gt;
A quantitative way to express the above uses the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value of the fit.  The above technique seeks to minimize &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  So if you add higher orders and more parameters but the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value does not change appreciably, you could argue that the fit is a good as you can make it with the given function.&lt;br /&gt;
&lt;br /&gt;
==Derivation==&lt;br /&gt;
&lt;br /&gt;
If you assume a series of measurements have a Gaussian parent distribution&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) = \frac{1}{\sqrt{2 \pi} \sigma} e^{-\frac{1}{2} \left ( \frac{x - \bar{x}}{\sigma}\right)^2}&amp;lt;/math&amp;gt; = probability of measuring the value &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; from a Gaussian distribution with s sample mean&amp;lt;math&amp;gt; \bar{x}&amp;lt;/math&amp;gt; from a parent distribution of with &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you break the above probability up into intervals of &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt; then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) d\bar{x}&amp;lt;/math&amp;gt; = probability that &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; lies within the interval &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you make N measurements of two variates (x_i and y_i) which may be correlated using a function with n parameters.&lt;br /&gt;
&lt;br /&gt;
== Chi-Square Cumulative Distribution==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution function is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\nu) = \frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; y(x_i)&amp;lt;/math&amp;gt; = the assumed functional dependence of the data on &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; =  N - n -1 = degrees of freedom&lt;br /&gt;
:&amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points&lt;br /&gt;
:&amp;lt;math&amp;gt;n + 1&amp;lt;/math&amp;gt; = number of parameters used in the fit (n coefficients + 1 constant term)&lt;br /&gt;
:&amp;lt;math&amp;gt; \Gamma(z) = \int_0^\infty  t^{z-1} e^{-t}\,dt\;&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above tells you the probability of getting the value of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; given the number of degrees of freedom &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; in your fit.&lt;br /&gt;
&lt;br /&gt;
While it is useful to know what the probability is of getting a value of &amp;lt;math&amp;gt;\chi^2 = x&amp;lt;/math&amp;gt; it is more useful to use the cumulative distribution function.&lt;br /&gt;
&lt;br /&gt;
The probability that the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; you received from your fit is as larger or larger than what you would get from a function described by the parent distribution is given &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty} P(x,\nu) dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A graph of &amp;lt;math&amp;gt;P(x,\nu)&amp;lt;/math&amp;gt; shows that the mean value of this function is &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow P(\chi^2 = \nu ,\nu)=\int_{\chi^2=\nu}^{\infty} P(x,\nu) dx = 0.5&amp;lt;/math&amp;gt; = probability of getting the average value for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; or larger is 0.5.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Reduced Chi-square==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced Chi-square &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2_{\nu} = \frac{\chi^2}{\nu}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the mean of &amp;lt;math&amp;gt;P(x,\nu) = \nu&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
then the mean of &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(\frac{x}{\nu},\nu) = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A reduced chi-squared distribution &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; has a mean value of 1.&lt;br /&gt;
&lt;br /&gt;
==p-Value==&lt;br /&gt;
&lt;br /&gt;
For the above fits,&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The p-value is defined as the cumulative &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution&lt;br /&gt;
&lt;br /&gt;
: p-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The p-value is the probability, under the assumption of a hypothesis H , of obtaining data at least as incompatible with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  small p-values are good.&lt;br /&gt;
&lt;br /&gt;
;The p-value is NOT&lt;br /&gt;
&lt;br /&gt;
# the probability that the null hypothesis is true. (This false conclusion is used to justify the &amp;quot;rule&amp;quot; of considering a result to be significant if its p-value is very small (near zero).) &amp;lt;br /&amp;gt; In fact, frequentist statistics does not, and cannot, attach probabilities to hypotheses. &lt;br /&gt;
# the probability that a finding is &amp;quot;merely a fluke.&amp;quot; (Again, this conclusion arises from the &amp;quot;rule&amp;quot; that small p-values indicate significant differences.) &amp;lt;br /&amp;gt; As the calculation of a p-value is based on the ''assumption'' that a finding is the product of chance alone, it patently cannot also be used to gauge the probability of that assumption being true. This is subtly different from the real meaning which is that the p-value is the chance that null hypothesis explains the result: the result might not be &amp;quot;merely a fluke,&amp;quot; ''and'' be explicable by the null hypothesis with confidence equal to the p-value.&lt;br /&gt;
#the probability of falsely rejecting the null hypothesis. &lt;br /&gt;
#the probability that a replicating experiment would not yield the same conclusion.&lt;br /&gt;
#1&amp;amp;nbsp;−&amp;amp;nbsp;(p-value) is ''not'' the probability of the alternative hypothesis being true.&lt;br /&gt;
#A determination of the significance level of the test. &amp;lt;br /&amp;gt; The significance level of a test is a value that should be decided upon by the agent interpreting the data before the data are viewed, and is compared against the p-value or any other statistic calculated after the test has been performed.&lt;br /&gt;
#an indication of  the size or importance of the observed effect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In ROOT&lt;br /&gt;
&lt;br /&gt;
 double ROOT::Math::chisquared_cdf_c (double &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;, double &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;, double x0 = 0 )		&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;=\int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
  TMath::Prob(&amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
You can turn things around the other way by defining P-value to be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: P-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\infty}^{\chi^2}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx = 1-(p-value)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here P-value would be the probability, under the assumption of a hypothesis H , of obtaining data at least as '''compatible''' with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
The P-value is the probability of observing a sample statistic as extreme as the test statistic.&lt;br /&gt;
&lt;br /&gt;
http://stattrek.com/chi-square-test/goodness-of-fit.aspx&lt;br /&gt;
&lt;br /&gt;
=F-test=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt; \chi^2&amp;lt;/math&amp;gt; test in the previous section measures both the difference between the data and the fit function as well as the difference between the fit function and the &amp;quot;parent&amp;quot; function.  The &amp;quot;parent&amp;quot; function is the true functional dependence of the data.&lt;br /&gt;
&lt;br /&gt;
The F-test can be used to determine the difference between the fit function and the parent function, to more directly test if you have come up with the correct fit function.&lt;br /&gt;
&lt;br /&gt;
== F-distribution==&lt;br /&gt;
&lt;br /&gt;
If, for example, you are comparing the Ratio of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; values from 2 different fits to the data then the function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then since &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 \equiv \sum_i^N \frac{\left (y_i-y(x_i)\right)^2}{\sigma_i^2}= \frac{s^2}{\sigma^2}&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; = constant&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and assuming &amp;lt;math&amp;gt;\sigma_1 = \sigma_2&amp;lt;/math&amp;gt; (same data set)&lt;br /&gt;
&lt;br /&gt;
one can argue that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_1}{\nu_1}} = \frac{s_1^2}{\sigma_1^2}\frac{\sigma_2^2}{s_2^2} \frac{\nu_2}{\nu_1} = \frac{\nu_2}{\nu_1} \frac{s_1^2}{s_2^2}&amp;lt;/math&amp;gt; = function that is independent of the error &amp;lt;math&amp;gt; \sigma&amp;lt;/math&amp;gt; intrinsic to the data thus the function is only comparing the fit residuals&amp;lt;math&amp;gt; (s^2)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The Function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
can be shown to follow the following probability distribution.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1, \nu_2) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
which is available in ROOT as&lt;br /&gt;
&lt;br /&gt;
 ROOT::Math::fdistribution_pdf(double x, double n, double m, double x0 = 0 )&lt;br /&gt;
&lt;br /&gt;
== The chi^2 difference test==&lt;br /&gt;
&lt;br /&gt;
In a similar fashion as above, one can define another ratio which is based on the difference between the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value using 2 different .&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} = \frac{\frac{\chi^2_1 - \chi^2_2}{\nu_1-\nu_2}}{\frac{\chi^2_1}{\nu_1}} =  \frac{\frac{\chi^2(m) - \chi^2(n)}{n-m}}{\frac{\chi^2(m)}{(N-m-1)}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under the null hypothesis that model 2 does not provide a significantly better fit than model 1, F will have an F distribution, with &amp;lt;math&amp;gt;(\nu_2 − \nu_1, \nu_1)&amp;lt;/math&amp;gt; degrees of freedom. The null hypothesis is rejected if the F calculated from the data is greater than the critical value of the F  distribution for some desired false-rejection probability (e.g. 0.05).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to determine if you need to continue adding parameters to the fit then you can consider an F-test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_1}{N-m-1}} = \frac{\Delta \chi^2}{\chi^2_{\nu}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above statistic will again follow the F-distribution &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1=1, \nu_2=N-m-1) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note: Some will define the fraction with respect to the next order fit&lt;br /&gt;
::&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_2}{N-m}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The multiple correlation coefficient test==&lt;br /&gt;
&lt;br /&gt;
While the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference F-test above is useful to evaluate the impact of adding another fit parameter, you will also want to evaluate the &amp;quot;goodness&amp;quot; of the entire fit in a manner which can be related to a correlation coefficient R (in this case it is a multiple-correlation coefficient because the fit can go beyond linear).&lt;br /&gt;
&lt;br /&gt;
I usually suggest that you do this after the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference test unless you have a theoretical model which constrains the number of fit parameters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Least Squares fit to an Arbitrary Function=&lt;br /&gt;
&lt;br /&gt;
The above Least Squares fit methods work well if your fit function has a linear dependence on the fit parameters.&lt;br /&gt;
&lt;br /&gt;
:ie; &amp;lt;math&amp;gt;y(x) =\sum_i^n a_i x^i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
such fit functions give you a set of  &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations that are linear in the parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; when you are minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  The &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation of this set of n equations is shown below.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your fit equation looks like&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) =a_1 e^{\frac{1}{2} \left (\frac{x-a_2}{a_3}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
now your set of equations minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; are non-linear with respect to the parameters.  You can't take separate the &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; term from the &amp;lt;math&amp;gt;f_k(x_i)&amp;lt;/math&amp;gt; function and thereby solve the system by inverting your matrix&lt;br /&gt;
:&amp;lt;math&amp;gt; \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
Because of this, a direct analytical solution is difficult (you need to find roots of coupled non-linear equations) and one resorts to approximation methods for the solution.&lt;br /&gt;
== Grid search==&lt;br /&gt;
&lt;br /&gt;
The fundamentals of the grid search is to basically change all parameters over some natural range to generate a hypersurface in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; and look for the smallest value of of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; that appears on the hypersurface.&lt;br /&gt;
&lt;br /&gt;
In Lab 15 you will generate this hypersurface for the simple least squares linear fit tot he Temp -vs- Voltage data in lab 14.  Your surface might look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:TF_ErrAna_Lab15.png | 200 px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As shown above, I have plotted the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; as a function of  the y-Intercept &amp;lt;math&amp;gt;(a_1)&amp;lt;/math&amp;gt; and the slope &amp;lt;math&amp;gt;(a_2)&amp;lt;/math&amp;gt;.  The minimum in this hypersurface should coincide with the values of Y-intercept=&amp;lt;math&amp;gt;a_1=-1.01&amp;lt;/math&amp;gt; and Slope=&amp;lt;math&amp;gt;a_2=0.0431&amp;lt;/math&amp;gt; from the linear regression solution.&lt;br /&gt;
&lt;br /&gt;
If we return to the beginning, the original problem is to use the max-likelihood principle on the probability function for finding the correct fit using the data. &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i -y(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
To maximize the probability of finding the best fit we need to find by minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right ) \frac{\partial \left( - y(x_i) \right)}{\partial a_k} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively you could also express \chi^2 in terms of the probability distributions as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n)  \propto e^{- \frac{1}{2}\chi^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Grid search method==&lt;br /&gt;
&lt;br /&gt;
The grid search method relies on the independence of the fit parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt;.    The search starts by selecting initial values for all parameters and then searching for a &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; minimum for one of the fit parameters.  You then set the parameter to the determined value and repeat the procedure on the next parameter.  You keep repeating until a stable value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found.&lt;br /&gt;
&lt;br /&gt;
Obviously, this method strongly depends on the initial values selected for the parameters.&lt;br /&gt;
&lt;br /&gt;
==Parameter Errors==&lt;br /&gt;
&lt;br /&gt;
Returning back to the equation&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
it may be observed that &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; represents the error in the parameter &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; and that the error alters &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once a minimum is found, the parabolic nature of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;  dependence on a single parameter is such that an increase in 1 standard deviation in the parameter results in an increase in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can turn this to determine the error in the fit parameter by determining how much the parameter must increase (or decrease) in order to increase &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Gradient Search Method==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Gradient search method improves on the Grid search method by attempting to search in a direction towards the minima as determined by simultaneous changes in all parameters.  The change in each parameter may differ in magnitude and is adjustable for each parameter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference  Go Back] [[Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91709</id>
		<title>TF ErrorAna StatInference</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91709"/>
		<updated>2014-03-21T19:18:47Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* The Method of Determinants */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Statistical Inference&lt;br /&gt;
=Frequentist -vs- Bayesian Inference=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When it comes to testing a hypothesis, there are  two dominant philosophies known as a Frequentist or a Bayesian perspective.&lt;br /&gt;
&lt;br /&gt;
The dominant discussion for this class will be from the Frequentist perspective.&lt;br /&gt;
&lt;br /&gt;
== frequentist statistical inference==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made using a null-hypothesis test; that is, one that answers the question, Assuming that the null hypothesis is true, what is the probability of observing a value for the test statistic that is at least as extreme as the value that was actually observed?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The relative frequency of occurrence of an event, in a number of repetitions of the experiment, is a measure of the probability of that event.&lt;br /&gt;
Thus, if &amp;lt;math&amp;gt;n_t&amp;lt;/math&amp;gt; is the total number of trials and &amp;lt;math&amp;gt;n_x&amp;lt;/math&amp;gt; is the number of trials where the event x occurred, the probability P(x) of the event occurring will be approximated by the relative frequency as follows:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) \approx \frac{n_x}{n_t}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Bayesian inference.==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made by using evidence or observations  to update or to newly infer the probability that a hypothesis may be true. The name &amp;quot;Bayesian&amp;quot; comes from the frequent use of Bayes' theorem in the inference process.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem relates the conditional probability, conditional and marginal probability, marginal probabilities of events ''A'' and ''B'', where ''B'' has a non-vanishing probability:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}\,\! &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Each term in Bayes' theorem has a conventional name:&lt;br /&gt;
* P(''A'') is the prior probability or marginal probability of ''A''. It is &amp;quot;prior&amp;quot; in the sense that it does not take into account any information about ''B''.&lt;br /&gt;
* P(''B'') is the prior or marginal probability of ''B'', and acts as a normalizing constant. &lt;br /&gt;
* P(''A''|''B'') is the conditional probability of ''A'', given ''B''. It is also called the posterior probability because it is derived from or depends upon the specified value of ''B''.&lt;br /&gt;
* P(''B''|''A'') is the conditional probability of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem in this form gives a mathematical representation of how the conditional probabability of event ''A'' given ''B'' is related to the converse conditional probabablity of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
Suppose there is a school having 60% boys and 40% girls as students. &lt;br /&gt;
&lt;br /&gt;
The female students wear trousers or skirts in equal numbers; the boys all wear trousers. &lt;br /&gt;
&lt;br /&gt;
An observer sees a (random) student from a distance; all the observer can see is that this student is wearing trousers. &lt;br /&gt;
&lt;br /&gt;
What is the probability this student is a girl? &lt;br /&gt;
&lt;br /&gt;
The correct answer can be computed using Bayes' theorem.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P(A) \equiv&amp;lt;/math&amp;gt; probability that  the student observed is a girl = 0.4&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B) \equiv&amp;lt;/math&amp;gt; probability  that the student observed is wearing trousers = 60+20/100 = 0.8&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B|A) \equiv&amp;lt;/math&amp;gt; probability the student is wearing trousers given that the student is a girl&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A|B) \equiv&amp;lt;/math&amp;gt; probability the student is a girl given that the student is wearing trousers&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(B|A) =0.5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B|A) P(A)}{P(B)} = \frac{0.5 \times 0.4}{0.8} = 0.25.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Method of Maximum Likelihood=&lt;br /&gt;
&lt;br /&gt;
;The principle of maximum likelihood is the cornerstone of Frequentist based hypothesis testing and may be written as&lt;br /&gt;
:The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observation is a maximum.&lt;br /&gt;
&lt;br /&gt;
= Least Squares Fit to a Line=&lt;br /&gt;
&lt;br /&gt;
== Applying the Method of Maximum Likelihood==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our object is to find the best straight line fit for an expected linear relationship between dependent variate &amp;lt;math&amp;gt;(y)&amp;lt;/math&amp;gt;  and independent variate &amp;lt;math&amp;gt;(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we let &amp;lt;math&amp;gt;y_0(x)&amp;lt;/math&amp;gt; represent the &amp;quot;true&amp;quot; linear relationship between independent variate &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and dependent variate &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_o(x) = A + B x&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i = \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A,B) = \Pi \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \left ( \frac{1}{\sigma \sqrt{2 \pi}}\right )^N e^{- \frac{1}{2} \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt; = Max&lt;br /&gt;
 &lt;br /&gt;
The maximum probability will result in the best values for &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\chi^2 = \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2 = \sum \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2&amp;lt;/math&amp;gt; = Min&lt;br /&gt;
&lt;br /&gt;
The min for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; occurs when the function is a minimum for both parameters A &amp;amp; B : ie&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \sum \frac{ \partial}{\partial A} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \sum \frac{ \partial}{\partial B} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;If &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt; : All variances are the same  (weighted fits don't make this assumption)&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial A} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial B} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum x_i \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum  x_i \left( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above equations represent a set of simultaneous of 2 equations and 2 unknowns which can be solved.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum y_i = \sum A + B \sum x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum x_i y_i = A \sum x_i + B \sum x_i^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} \sum y_i \\ \sum x_i y_i \end{array} \right) = \left( \begin{array}{cc} N &amp;amp; \sum x_i\\&lt;br /&gt;
\sum x_i &amp;amp; \sum x_i^2 \end{array} \right)\left( \begin{array}{c} A \\ B \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The Method of Determinants ===&lt;br /&gt;
for the matrix problem:&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} y_1 \\ y_2 \end{array} \right) = \left( \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right)\left( \begin{array}{c} x_1 \\ x_2 \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the above can be written as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_1 = a_{11} x_1 + a_{12} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;y_2 = a_{21} x_1 + a_{22} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
solving for &amp;lt;math&amp;gt;x_1&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;y_1&amp;lt;/math&amp;gt; is known&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;a_{22} (y_1 = a_{11} x_1 + a_{12} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-a_{12} (y_2 = a_{21} x_1 + a_{22} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow a_{22} y_1 - a_{12} y_2 = (a_{11}a_{22} - a_{12}a_{21}) x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| = \left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
: &amp;lt;math&amp;gt;x_1 = \frac{\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt; similarly &amp;lt;math&amp;gt;x_2 = \frac{\left| \begin{array}{cc}  a_{11} &amp;amp; y_1 \\  a_{21} &amp;amp; y_2  \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Solutions exist as long as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apply the method of determinant for the maximum likelihood problem above&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the uncertainty in all the measurements is not the same then we need to insert &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; back into the system of equations.&lt;br /&gt;
&lt;br /&gt;
//%This section may have an error. Matrix elements of be in position 22 should be \sigma^2??&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Uncertainty in the Linear Fit parameters==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
By definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}&amp;lt;/math&amp;gt;  : there are 2 parameters and N data points which translate to (N-2) degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
The least square fit ( assuming equal &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;) has the following solution for the parameters A &amp;amp; B as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\sum y_i \sum x_i^2 - \sum x_i \sum x_i y_i  }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \frac{(1) \sum x_i^2 - x_j\sum x_i   }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt; only the &amp;lt;math&amp;gt;y_j&amp;lt;/math&amp;gt; term survives &lt;br /&gt;
:&amp;lt;math&amp;gt; = D \left ( \sum x_i^2 - x_j\sum x_i \right)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D \equiv \frac{1}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}=\frac{1}{N\sum x_i^2 - \sum x_i \sum x_i }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_{j=1}^N \sigma_j^2 \left ( D \left ( \sum x_i^2 - x_j\sum x_i \right) \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2 - x_j\sum x_i \right )^2&amp;lt;/math&amp;gt; : Assume &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2\right )^2  + \left (x_j\sum x_i \right )^2 - 2 \left ( \sum x_i^2 x_j \sum x_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  \sum_{j=1}^N  \left ( \sum x_i^2\right ) +  \sum_{j=1}^N x_j^2  -  2 \sum x_i \sum_{j=1}^N x_j  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum x_i \sum_{j=1}^N x_j  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sum x_i \sum_{j=1}^N x_j \approx \sum_{j=1}^N x_j^2&amp;lt;/math&amp;gt; Both sums are over the number of observations &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum_{j=1}^N x_j^2  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2 \frac{1}{D}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \sigma^2  \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we redefine our origin in the linear plot so the line is centered a x=0 then &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum{x_i} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2} = \frac{\sum x_i^2 }{N\sum x_i^2 } = \frac{1}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{1}{N} = \frac{\sigma^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: The parameter A is the y-intercept so it makes some intuitive sense that the error in the Y -intercept would be dominated by the statistical error in Y&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in B===&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}= \frac{\partial}{\partial y_j} D \left ( N\sum x_i y_i -\sum x_i \sum y_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;=  D \left ( N x_j - \sum x_i \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 D^2 \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;\sigma_j = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N^2 x_j^2 - 2N x_j \sum x_i + \sum x_i^2\right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum_{j=1}^Nx_j^2 - 2N \sum x_i \sum_{j=1}^N x_j  + \sum x_i^2 \sum_{j=1}^N  \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum x_i^2 - 2N \sum x_i \sum_{j=1}^N x_j  + N \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - 2 \sum x_i \sum_{j=1}^N x_j  +  \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = N D^2 \sigma^2 \frac{1}{D} = ND \sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_B^2= \frac{N \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}} {N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Linear Fit with error==&lt;br /&gt;
&lt;br /&gt;
From above we know that if each independent measurement has a different error &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; then the fit parameters are given by &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D = \frac{1}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right| }= &lt;br /&gt;
\frac{1}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [ \sum\frac{ y_i}{\sigma_i^2} \sum\frac{ x_i^2}{\sigma_i^2}- \sum\frac{ x_i}{\sigma_i^2}  \sum\frac{ x_i y_i}{\sigma_i^2}  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ] =  \sum_{j=1}^N \left [ \sigma_j^2  D^2 \left ( \frac{ 1}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \sigma_j^2  \left [  \frac{ 1}{\sigma_j^4} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \frac{ x_j}{\sigma_j^4} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \frac{ x_j^2}{\sigma_j^4} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2   \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ 1}{\sigma_i^2} \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 -  \left( \sum \frac{ x_j}{\sigma_j^2} \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= D    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)  = \frac{ \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) }{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Compare with the unweighted error&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in B ===&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [\sum \frac{1}{\sigma_i^2}\sum \frac{x_i y_i}{\sigma_i^2}  - \sum \frac{ y_i}{\sigma_i^2}\sum \frac{x_i}{\sigma_i^2}   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_{j=1}^N \left [ \sigma_j^2 \left (  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \left [  \frac{ 1}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} + \left (\frac{1}{\sigma_j}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} + \left (\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 1 \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D \sum_{j=1}^N \frac{ 1}{\sigma_j^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_B^2 = \frac{  \sum\frac{ 1}{\sigma_i^2}}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Correlation Probability==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the Linear Fit has been performed, the next step will be to determine a probability that the Fit is actually describing the data.&lt;br /&gt;
&lt;br /&gt;
The Correlation Probability (R) is one method used to try and determine this probability.&lt;br /&gt;
&lt;br /&gt;
This method evaluates the &amp;quot;slope&amp;quot; parameter to determine if there is a correlation between the dependent and independent variables , x and y.&lt;br /&gt;
&lt;br /&gt;
The liner fit above was done to minimize \chi^2 for the following model&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y = A + Bx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What if we turn this  equation around such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = A^{\prime} + B^{\prime}y&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;B^{\prime} =0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is complete correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  &lt;br /&gt;
:&amp;lt;math&amp;gt;A = -\frac{A^{\prime}}{B^{\prime}}&amp;lt;/math&amp;gt;        and     &amp;lt;math&amp;gt;B = \frac{1}{B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: and &amp;lt;math&amp;gt;BB^{\prime} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So one can define a metric BB^{\prime} which has the natural range between 0 and 1 such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;R \equiv \sqrt{B B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
since&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and one can show that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B^{\prime} = \frac{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum y_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum y_i  &amp;amp; \sum y_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;R = \sqrt{ \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  } \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=   \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{\sqrt{\left( N\sum x_i^2 - \sum x_i \sum x_i  \right ) \left (N\sum y_i^2 - \sum y_i \sum y_i\right)  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:The correlation coefficient (R) CAN'T be used to indicate the degree of correlation.  The probability distribution &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; can be derived from a 2-D gaussian but knowledge of the correlation coefficient of the parent population &amp;lt;math&amp;gt;(\rho)&amp;lt;/math&amp;gt; is required to evaluate R of the sample distribution.&lt;br /&gt;
&lt;br /&gt;
Instead one assumes a correlation of &amp;lt;math&amp;gt;\rho=0&amp;lt;/math&amp;gt; in the parent distribution and then compares the sample value of &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; with what you would get if there were no correlation.&lt;br /&gt;
&lt;br /&gt;
The smaller &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; is the more likely that the data are correlated and that the linear fit is correct.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_R(R,\nu) = \frac{1}{\sqrt{\pi}} \frac{\Gamma\left ( \frac{\nu+1}{2}\right )}{\Gamma \left ( \frac{\nu}{2}\right)} \left( 1-R^2\right)^{\left( \frac{\nu-2}{2}\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
= Probability that any random sample of UNCORRELATED data would yield the correlation coefficient &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\Gamma(x) = \int_0^{\infty} t^{x-1}e^{-t} dt&amp;lt;/math&amp;gt;&lt;br /&gt;
 (ROOT::Math::tgamma(double x) )&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu=N-2&amp;lt;/math&amp;gt; = number of degrees of freedom = Number of data points - Number of parameters in fit function&lt;br /&gt;
&lt;br /&gt;
Derived in &amp;quot;Pugh and Winslow, The Analysis of Physical Measurement, Addison-Wesley Publishing, 1966.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Least Squares fit to a Polynomial=&lt;br /&gt;
&lt;br /&gt;
Let's assume we wish to now fit a polynomial instead of a straight line to the data.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) = \sum_{j=0}^{n} a_j x^{n}=\sum_{j=0}^{n} a_j f_j(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f_j(x) =&amp;lt;/math&amp;gt; a function which does not depend on &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i(a_0,a_1, \cdots ,a_n) = \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;a_n&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once again the probability is maximized when the numerator of the exponential is a minimum&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
The minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \frac{\partial \left( - \sum_{j=0}^{n} a_j f_j(x_i) \right)}{\partial a_k}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2 \sum_i^N  \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2\sum_i^N  \frac{1}{\sigma_i^2} \left (  -  f_k(x_i) \right) \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) =0&amp;lt;/math&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
: &amp;lt;math&amp;gt;\Rightarrow \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =  \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}  \sum_{j=0}^{n} a_j f_j(x_i)=  \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You now have a system of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; coupled equations for the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; with each equation summing over the &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; measurements.&lt;br /&gt;
&lt;br /&gt;
The first equation &amp;lt;math&amp;gt;(f_1)&amp;lt;/math&amp;gt; looks like this&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_i^N f_1(x_i) \frac{y_i}{\sigma_i^2} = \sum_i^N \frac{f_1(x_i)}{\sigma_i^2} \left ( a_1 f_1(x_i) + a_2 f_2(x_i) + \cdots a_n f_n(x_i)\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could use the method of determinants as we did to find the parameters &amp;lt;math&amp;gt;(a_n)&amp;lt;/math&amp;gt; for a linear fit but it is more convenient to use matrices in a technique referred to as regression analysis&lt;br /&gt;
&lt;br /&gt;
==Regression Analysis==&lt;br /&gt;
&lt;br /&gt;
The parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; in the previous section are linear parameters to a general function which may be a polynomial.&lt;br /&gt;
&lt;br /&gt;
The system of equations is composed of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations where the &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation is given as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
may be represented in matrix form as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\beta_k= \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{kj} = \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or in matrix form&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha} = \left ( \begin{matrix} \alpha_{11}  &amp;amp; \alpha_{12} &amp;amp; \cdots &amp;amp; \alpha_{1j} \\ \alpha_{21}  &amp;amp; \alpha_{22}&amp;amp;\cdots&amp;amp;\alpha_{2j} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1} &amp;amp;\alpha_{k2} &amp;amp;\cdots &amp;amp;\alpha_{kj}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
; the objective is to find the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
: To find &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; just invert the matrix&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \tilde{\beta} = \tilde{a} \tilde{\alpha} \right) \tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{\alpha}\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \Rightarrow  \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Thus if you invert the matrix &amp;lt;math&amp;gt;\tilde{\alpha}&amp;lt;/math&amp;gt; you find &amp;lt;math&amp;gt;\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt; and as a result the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Matrix inversion==&lt;br /&gt;
&lt;br /&gt;
The first thing to note is that for the inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A})&amp;lt;/math&amp;gt; to exist its determinant can not be zero&lt;br /&gt;
: &amp;lt;math&amp;gt;\left |\tilde{A} \right | \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A}^{-1})&amp;lt;/math&amp;gt; is defined such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{A}^{-1} = \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we divide both sides by the matrix &amp;lt;math&amp;gt;\tilde {A}&amp;lt;/math&amp;gt; then we have&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A}^{-1} = \frac{\tilde{1}}{\tilde{A} }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above ratio of the unity matrix to matrix &amp;lt;math&amp;gt;\tilde{A}&amp;lt;/math&amp;gt; is always equal to &amp;lt;math&amp;gt;\tilde{A}^{-1}&amp;lt;/math&amp;gt; as long as both the numerator and denominator are multiplied by the same constant factor.&lt;br /&gt;
&lt;br /&gt;
If we do such operations we can transform the ratio such that the denominator has the unity matrix and then the numerator will have the inverse matrix.  &lt;br /&gt;
&lt;br /&gt;
This is the principle of Gauss-Jordan Elimination.&lt;br /&gt;
&lt;br /&gt;
===Gauss-Jordan Elimination===&lt;br /&gt;
If Gauss–Jordan elimination is applied on a square matrix, it can be used to calculate the inverse matrix. This can be done by augmenting the square matrix with the identity matrix of the same dimensions, and through the following matrix operations:&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{1} \Rightarrow&lt;br /&gt;
 \tilde{1} \tilde{A}^{-1} .&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the original square matrix, &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;, is given by the following expression:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 \\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 \\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, after augmenting by the identity, the following is obtained:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A}\tilde{1} = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By performing elementary row operations on the &amp;lt;math&amp;gt;\tilde{A}\tilde{1}&amp;lt;/math&amp;gt; matrix until it reaches reduced row echelon form, the following is the final result:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1}\tilde{A}^{-1}  = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 &amp;amp; \frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1 &amp;amp; \frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix augmentation can now be undone, which gives the following:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}\qquad&lt;br /&gt;
 \tilde{A}^{-1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
\frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
\frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
\frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
:&amp;lt;math&amp;gt; &lt;br /&gt;
 \tilde{A}^{-1} =\frac{1}{4}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}=\frac{1}{det(A)}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
A matrix is non-singular (meaning that it has an inverse matrix) if and only if the identity matrix can be obtained using only elementary row operations.&lt;br /&gt;
&lt;br /&gt;
== Error Matrix==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
Where the definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - \sum_{j=0}^{n} a_j f_j(x_i) \right)^2}{N -n}&amp;lt;/math&amp;gt;  : there are &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; parameters and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; data points which translate to &amp;lt;math&amp;gt;(N-n)&amp;lt;/math&amp;gt; degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
Applying this for the parameter &amp;lt;math&amp;gt;a_k&amp;lt;/math&amp;gt; indicates that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k}^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial a_k}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;But what if there are covariances?&lt;br /&gt;
In that case the following general expression applies&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = &amp;lt;/math&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha}^{-1} = \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n) = ( \beta_1, \beta_2, \cdots , \beta_n) \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow  a_k = \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = \frac{\partial }{\partial y_i} \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\partial }{\partial y_i} \sum_j^n \left( \sum_i^N f_j(x_i) \frac{y_i}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt; :only one &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; in the sum over &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; survives the derivative&lt;br /&gt;
&lt;br /&gt;
similarly&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_l}{\partial y_i} = \sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
substituting&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^N \left [ \sigma_i^2  \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}\sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right)\alpha_{pl}^{-1} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;math&amp;gt; \sigma_i^2&amp;lt;/math&amp;gt; term appears on the  top and bottom.&lt;br /&gt;
;Move the outer most sum to the inside&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 =  \sum_j^n \left(   \alpha_{jk}^{-1}\sum_p^n \sum_i^N  \frac{f_j(x_i)  f_p(x_i)}{\sigma_i^2} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n  \alpha_{jk}^{-1}\sum_p^n \left(  \alpha_{jp} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n \alpha_{jk}^{-1}\tilde{1}_{jl}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{1}_{jl}&amp;lt;/math&amp;gt;  = the &amp;lt;math&amp;gt;j,l&amp;lt;/math&amp;gt; element of the unity matrix = 1&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{jk} = \alpha_{kj} &amp;lt;/math&amp;gt; : the matrix is symmetric.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sigma_{a_k,a_l}^2 =  \sum_j^n \alpha_{kj}^{-1}\tilde{1}_{jl}= \alpha_{kl}^{-1}&amp;lt;/math&amp;gt; = Covariance/Error matrix element&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse matrix &amp;lt;math&amp;gt;\alpha_{kl}^{-1}&amp;lt;/math&amp;gt; tells you the variance and covariance for the calculation of the total error.&lt;br /&gt;
&lt;br /&gt;
;Remember&lt;br /&gt;
:&amp;lt;math&amp;gt;Y = \sum_i^n a_i f_i(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_i}^2 = \alpha_{ii}^{-1}&amp;lt;/math&amp;gt;= error in the parameters&lt;br /&gt;
: &amp;lt;math&amp;gt;s^2 = \sum_i^n \sum_j^n \left ( \frac{\partial Y}{\partial a_i}\frac{\partial Y}{\partial a_j}\right) \sigma_{ij}=\sum_i^n \sum_j^n \left ( f_i(x)f_j(x)\right) \sigma_{ij} &amp;lt;/math&amp;gt; = error in the model's prediction&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^n \sum_j^n  x^{j+i} \sigma_{ij}&amp;lt;/math&amp;gt; If Y is a power series in x &amp;lt;math&amp;gt;(f_i(x) = x^i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Chi-Square Distribution=&lt;br /&gt;
&lt;br /&gt;
The above tools allow you to perform a least squares fit to data using high order polynomials.&lt;br /&gt;
&lt;br /&gt;
; The question though is how high in order should you go?  (ie; when should you stop adding parameters to the fit?)&lt;br /&gt;
&lt;br /&gt;
One argument is that you should stop increasing the number of parameters if they don't change much.  The parameters, using the above techniques, are correlated such that when you add another order to the fit all the parameters have the potential to change in value.  If their change is miniscule then you can ague that adding higher orders to the fit does not change the fit.  There are techniu&lt;br /&gt;
&lt;br /&gt;
A quantitative way to express the above uses the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value of the fit.  The above technique seeks to minimize &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  So if you add higher orders and more parameters but the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value does not change appreciably, you could argue that the fit is a good as you can make it with the given function.&lt;br /&gt;
&lt;br /&gt;
==Derivation==&lt;br /&gt;
&lt;br /&gt;
If you assume a series of measurements have a Gaussian parent distribution&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) = \frac{1}{\sqrt{2 \pi} \sigma} e^{-\frac{1}{2} \left ( \frac{x - \bar{x}}{\sigma}\right)^2}&amp;lt;/math&amp;gt; = probability of measuring the value &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; from a Gaussian distribution with s sample mean&amp;lt;math&amp;gt; \bar{x}&amp;lt;/math&amp;gt; from a parent distribution of with &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you break the above probability up into intervals of &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt; then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) d\bar{x}&amp;lt;/math&amp;gt; = probability that &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; lies within the interval &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you make N measurements of two variates (x_i and y_i) which may be correlated using a function with n parameters.&lt;br /&gt;
&lt;br /&gt;
== Chi-Square Cumulative Distribution==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution function is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\nu) = \frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; y(x_i)&amp;lt;/math&amp;gt; = the assumed functional dependence of the data on &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; =  N - n -1 = degrees of freedom&lt;br /&gt;
:&amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points&lt;br /&gt;
:&amp;lt;math&amp;gt;n + 1&amp;lt;/math&amp;gt; = number of parameters used in the fit (n coefficients + 1 constant term)&lt;br /&gt;
:&amp;lt;math&amp;gt; \Gamma(z) = \int_0^\infty  t^{z-1} e^{-t}\,dt\;&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above tells you the probability of getting the value of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; given the number of degrees of freedom &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; in your fit.&lt;br /&gt;
&lt;br /&gt;
While it is useful to know what the probability is of getting a value of &amp;lt;math&amp;gt;\chi^2 = x&amp;lt;/math&amp;gt; it is more useful to use the cumulative distribution function.&lt;br /&gt;
&lt;br /&gt;
The probability that the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; you received from your fit is as larger or larger than what you would get from a function described by the parent distribution is given &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty} P(x,\nu) dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A graph of &amp;lt;math&amp;gt;P(x,\nu)&amp;lt;/math&amp;gt; shows that the mean value of this function is &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow P(\chi^2 = \nu ,\nu)=\int_{\chi^2=\nu}^{\infty} P(x,\nu) dx = 0.5&amp;lt;/math&amp;gt; = probability of getting the average value for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; or larger is 0.5.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Reduced Chi-square==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced Chi-square &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2_{\nu} = \frac{\chi^2}{\nu}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the mean of &amp;lt;math&amp;gt;P(x,\nu) = \nu&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
then the mean of &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(\frac{x}{\nu},\nu) = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A reduced chi-squared distribution &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; has a mean value of 1.&lt;br /&gt;
&lt;br /&gt;
==p-Value==&lt;br /&gt;
&lt;br /&gt;
For the above fits,&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The p-value is defined as the cumulative &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution&lt;br /&gt;
&lt;br /&gt;
: p-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The p-value is the probability, under the assumption of a hypothesis H , of obtaining data at least as incompatible with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  small p-values are good.&lt;br /&gt;
&lt;br /&gt;
;The p-value is NOT&lt;br /&gt;
&lt;br /&gt;
# the probability that the null hypothesis is true. (This false conclusion is used to justify the &amp;quot;rule&amp;quot; of considering a result to be significant if its p-value is very small (near zero).) &amp;lt;br /&amp;gt; In fact, frequentist statistics does not, and cannot, attach probabilities to hypotheses. &lt;br /&gt;
# the probability that a finding is &amp;quot;merely a fluke.&amp;quot; (Again, this conclusion arises from the &amp;quot;rule&amp;quot; that small p-values indicate significant differences.) &amp;lt;br /&amp;gt; As the calculation of a p-value is based on the ''assumption'' that a finding is the product of chance alone, it patently cannot also be used to gauge the probability of that assumption being true. This is subtly different from the real meaning which is that the p-value is the chance that null hypothesis explains the result: the result might not be &amp;quot;merely a fluke,&amp;quot; ''and'' be explicable by the null hypothesis with confidence equal to the p-value.&lt;br /&gt;
#the probability of falsely rejecting the null hypothesis. &lt;br /&gt;
#the probability that a replicating experiment would not yield the same conclusion.&lt;br /&gt;
#1&amp;amp;nbsp;−&amp;amp;nbsp;(p-value) is ''not'' the probability of the alternative hypothesis being true.&lt;br /&gt;
#A determination of the significance level of the test. &amp;lt;br /&amp;gt; The significance level of a test is a value that should be decided upon by the agent interpreting the data before the data are viewed, and is compared against the p-value or any other statistic calculated after the test has been performed.&lt;br /&gt;
#an indication of  the size or importance of the observed effect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In ROOT&lt;br /&gt;
&lt;br /&gt;
 double ROOT::Math::chisquared_cdf_c (double &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;, double &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;, double x0 = 0 )		&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;=\int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
  TMath::Prob(&amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
You can turn things around the other way by defining P-value to be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: P-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\infty}^{\chi^2}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx = 1-(p-value)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here P-value would be the probability, under the assumption of a hypothesis H , of obtaining data at least as '''compatible''' with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
The P-value is the probability of observing a sample statistic as extreme as the test statistic.&lt;br /&gt;
&lt;br /&gt;
http://stattrek.com/chi-square-test/goodness-of-fit.aspx&lt;br /&gt;
&lt;br /&gt;
=F-test=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt; \chi^2&amp;lt;/math&amp;gt; test in the previous section measures both the difference between the data and the fit function as well as the difference between the fit function and the &amp;quot;parent&amp;quot; function.  The &amp;quot;parent&amp;quot; function is the true functional dependence of the data.&lt;br /&gt;
&lt;br /&gt;
The F-test can be used to determine the difference between the fit function and the parent function, to more directly test if you have come up with the correct fit function.&lt;br /&gt;
&lt;br /&gt;
== F-distribution==&lt;br /&gt;
&lt;br /&gt;
If, for example, you are comparing the Ratio of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; values from 2 different fits to the data then the function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then since &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 \equiv \sum_i^N \frac{\left (y_i-y(x_i)\right)^2}{\sigma_i^2}= \frac{s^2}{\sigma^2}&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; = constant&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and assuming &amp;lt;math&amp;gt;\sigma_1 = \sigma_2&amp;lt;/math&amp;gt; (same data set)&lt;br /&gt;
&lt;br /&gt;
one can argue that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_1}{\nu_1}} = \frac{s_1^2}{\sigma_1^2}\frac{\sigma_2^2}{s_2^2} \frac{\nu_2}{\nu_1} = \frac{\nu_2}{\nu_1} \frac{s_1^2}{s_2^2}&amp;lt;/math&amp;gt; = function that is independent of the error &amp;lt;math&amp;gt; \sigma&amp;lt;/math&amp;gt; intrinsic to the data thus the function is only comparing the fit residuals&amp;lt;math&amp;gt; (s^2)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The Function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
can be shown to follow the following probability distribution.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1, \nu_2) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
which is available in ROOT as&lt;br /&gt;
&lt;br /&gt;
 ROOT::Math::fdistribution_pdf(double x, double n, double m, double x0 = 0 )&lt;br /&gt;
&lt;br /&gt;
== The chi^2 difference test==&lt;br /&gt;
&lt;br /&gt;
In a similar fashion as above, one can define another ratio which is based on the difference between the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value using 2 different .&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} = \frac{\frac{\chi^2_1 - \chi^2_2}{\nu_1-\nu_2}}{\frac{\chi^2_1}{\nu_1}} =  \frac{\frac{\chi^2(m) - \chi^2(n)}{n-m}}{\frac{\chi^2(m)}{(N-m-1)}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under the null hypothesis that model 2 does not provide a significantly better fit than model 1, F will have an F distribution, with &amp;lt;math&amp;gt;(\nu_2 − \nu_1, \nu_1)&amp;lt;/math&amp;gt; degrees of freedom. The null hypothesis is rejected if the F calculated from the data is greater than the critical value of the F  distribution for some desired false-rejection probability (e.g. 0.05).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to determine if you need to continue adding parameters to the fit then you can consider an F-test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_1}{N-m-1}} = \frac{\Delta \chi^2}{\chi^2_{\nu}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above statistic will again follow the F-distribution &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1=1, \nu_2=N-m-1) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note: Some will define the fraction with respect to the next order fit&lt;br /&gt;
::&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_2}{N-m}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The multiple correlation coefficient test==&lt;br /&gt;
&lt;br /&gt;
While the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference F-test above is useful to evaluate the impact of adding another fit parameter, you will also want to evaluate the &amp;quot;goodness&amp;quot; of the entire fit in a manner which can be related to a correlation coefficient R (in this case it is a multiple-correlation coefficient because the fit can go beyond linear).&lt;br /&gt;
&lt;br /&gt;
I usually suggest that you do this after the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference test unless you have a theoretical model which constrains the number of fit parameters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Least Squares fit to an Arbitrary Function=&lt;br /&gt;
&lt;br /&gt;
The above Least Squares fit methods work well if your fit function has a linear dependence on the fit parameters.&lt;br /&gt;
&lt;br /&gt;
:ie; &amp;lt;math&amp;gt;y(x) =\sum_i^n a_i x^i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
such fit functions give you a set of  &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations that are linear in the parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; when you are minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  The &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation of this set of n equations is shown below.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your fit equation looks like&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) =a_1 e^{\frac{1}{2} \left (\frac{x-a_2}{a_3}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
now your set of equations minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; are non-linear with respect to the parameters.  You can't take separate the &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; term from the &amp;lt;math&amp;gt;f_k(x_i)&amp;lt;/math&amp;gt; function and thereby solve the system by inverting your matrix&lt;br /&gt;
:&amp;lt;math&amp;gt; \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
Because of this, a direct analytical solution is difficult (you need to find roots of coupled non-linear equations) and one resorts to approximation methods for the solution.&lt;br /&gt;
== Grid search==&lt;br /&gt;
&lt;br /&gt;
The fundamentals of the grid search is to basically change all parameters over some natural range to generate a hypersurface in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; and look for the smallest value of of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; that appears on the hypersurface.&lt;br /&gt;
&lt;br /&gt;
In Lab 15 you will generate this hypersurface for the simple least squares linear fit tot he Temp -vs- Voltage data in lab 14.  Your surface might look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:TF_ErrAna_Lab15.png | 200 px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As shown above, I have plotted the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; as a function of  the y-Intercept &amp;lt;math&amp;gt;(a_1)&amp;lt;/math&amp;gt; and the slope &amp;lt;math&amp;gt;(a_2)&amp;lt;/math&amp;gt;.  The minimum in this hypersurface should coincide with the values of Y-intercept=&amp;lt;math&amp;gt;a_1=-1.01&amp;lt;/math&amp;gt; and Slope=&amp;lt;math&amp;gt;a_2=0.0431&amp;lt;/math&amp;gt; from the linear regression solution.&lt;br /&gt;
&lt;br /&gt;
If we return to the beginning, the original problem is to use the max-likelihood principle on the probability function for finding the correct fit using the data. &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i -y(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
To maximize the probability of finding the best fit we need to find by minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right ) \frac{\partial \left( - y(x_i) \right)}{\partial a_k} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively you could also express \chi^2 in terms of the probability distributions as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n)  \propto e^{- \frac{1}{2}\chi^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Grid search method==&lt;br /&gt;
&lt;br /&gt;
The grid search method relies on the independence of the fit parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt;.    The search starts by selecting initial values for all parameters and then searching for a &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; minimum for one of the fit parameters.  You then set the parameter to the determined value and repeat the procedure on the next parameter.  You keep repeating until a stable value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found.&lt;br /&gt;
&lt;br /&gt;
Obviously, this method strongly depends on the initial values selected for the parameters.&lt;br /&gt;
&lt;br /&gt;
==Parameter Errors==&lt;br /&gt;
&lt;br /&gt;
Returning back to the equation&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
it may be observed that &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; represents the error in the parameter &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; and that the error alters &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once a minimum is found, the parabolic nature of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;  dependence on a single parameter is such that an increase in 1 standard deviation in the parameter results in an increase in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can turn this to determine the error in the fit parameter by determining how much the parameter must increase (or decrease) in order to increase &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Gradient Search Method==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Gradient search method improves on the Grid search method by attempting to search in a direction towards the minima as determined by simultaneous changes in all parameters.  The change in each parameter may differ in magnitude and is adjustable for each parameter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference  Go Back] [[Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91708</id>
		<title>TF ErrorAna StatInference</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91708"/>
		<updated>2014-03-21T19:18:31Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* The Method of Determinants */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Statistical Inference&lt;br /&gt;
=Frequentist -vs- Bayesian Inference=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When it comes to testing a hypothesis, there are  two dominant philosophies known as a Frequentist or a Bayesian perspective.&lt;br /&gt;
&lt;br /&gt;
The dominant discussion for this class will be from the Frequentist perspective.&lt;br /&gt;
&lt;br /&gt;
== frequentist statistical inference==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made using a null-hypothesis test; that is, one that answers the question, Assuming that the null hypothesis is true, what is the probability of observing a value for the test statistic that is at least as extreme as the value that was actually observed?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The relative frequency of occurrence of an event, in a number of repetitions of the experiment, is a measure of the probability of that event.&lt;br /&gt;
Thus, if &amp;lt;math&amp;gt;n_t&amp;lt;/math&amp;gt; is the total number of trials and &amp;lt;math&amp;gt;n_x&amp;lt;/math&amp;gt; is the number of trials where the event x occurred, the probability P(x) of the event occurring will be approximated by the relative frequency as follows:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) \approx \frac{n_x}{n_t}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Bayesian inference.==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made by using evidence or observations  to update or to newly infer the probability that a hypothesis may be true. The name &amp;quot;Bayesian&amp;quot; comes from the frequent use of Bayes' theorem in the inference process.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem relates the conditional probability, conditional and marginal probability, marginal probabilities of events ''A'' and ''B'', where ''B'' has a non-vanishing probability:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}\,\! &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Each term in Bayes' theorem has a conventional name:&lt;br /&gt;
* P(''A'') is the prior probability or marginal probability of ''A''. It is &amp;quot;prior&amp;quot; in the sense that it does not take into account any information about ''B''.&lt;br /&gt;
* P(''B'') is the prior or marginal probability of ''B'', and acts as a normalizing constant. &lt;br /&gt;
* P(''A''|''B'') is the conditional probability of ''A'', given ''B''. It is also called the posterior probability because it is derived from or depends upon the specified value of ''B''.&lt;br /&gt;
* P(''B''|''A'') is the conditional probability of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem in this form gives a mathematical representation of how the conditional probabability of event ''A'' given ''B'' is related to the converse conditional probabablity of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
Suppose there is a school having 60% boys and 40% girls as students. &lt;br /&gt;
&lt;br /&gt;
The female students wear trousers or skirts in equal numbers; the boys all wear trousers. &lt;br /&gt;
&lt;br /&gt;
An observer sees a (random) student from a distance; all the observer can see is that this student is wearing trousers. &lt;br /&gt;
&lt;br /&gt;
What is the probability this student is a girl? &lt;br /&gt;
&lt;br /&gt;
The correct answer can be computed using Bayes' theorem.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P(A) \equiv&amp;lt;/math&amp;gt; probability that  the student observed is a girl = 0.4&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B) \equiv&amp;lt;/math&amp;gt; probability  that the student observed is wearing trousers = 60+20/100 = 0.8&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B|A) \equiv&amp;lt;/math&amp;gt; probability the student is wearing trousers given that the student is a girl&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A|B) \equiv&amp;lt;/math&amp;gt; probability the student is a girl given that the student is wearing trousers&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(B|A) =0.5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B|A) P(A)}{P(B)} = \frac{0.5 \times 0.4}{0.8} = 0.25.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Method of Maximum Likelihood=&lt;br /&gt;
&lt;br /&gt;
;The principle of maximum likelihood is the cornerstone of Frequentist based hypothesis testing and may be written as&lt;br /&gt;
:The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observation is a maximum.&lt;br /&gt;
&lt;br /&gt;
= Least Squares Fit to a Line=&lt;br /&gt;
&lt;br /&gt;
== Applying the Method of Maximum Likelihood==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our object is to find the best straight line fit for an expected linear relationship between dependent variate &amp;lt;math&amp;gt;(y)&amp;lt;/math&amp;gt;  and independent variate &amp;lt;math&amp;gt;(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we let &amp;lt;math&amp;gt;y_0(x)&amp;lt;/math&amp;gt; represent the &amp;quot;true&amp;quot; linear relationship between independent variate &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and dependent variate &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_o(x) = A + B x&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i = \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A,B) = \Pi \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \left ( \frac{1}{\sigma \sqrt{2 \pi}}\right )^N e^{- \frac{1}{2} \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt; = Max&lt;br /&gt;
 &lt;br /&gt;
The maximum probability will result in the best values for &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\chi^2 = \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2 = \sum \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2&amp;lt;/math&amp;gt; = Min&lt;br /&gt;
&lt;br /&gt;
The min for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; occurs when the function is a minimum for both parameters A &amp;amp; B : ie&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \sum \frac{ \partial}{\partial A} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \sum \frac{ \partial}{\partial B} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;If &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt; : All variances are the same  (weighted fits don't make this assumption)&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial A} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial B} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum x_i \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum  x_i \left( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above equations represent a set of simultaneous of 2 equations and 2 unknowns which can be solved.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum y_i = \sum A + B \sum x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum x_i y_i = A \sum x_i + B \sum x_i^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} \sum y_i \\ \sum x_i y_i \end{array} \right) = \left( \begin{array}{cc} N &amp;amp; \sum x_i\\&lt;br /&gt;
\sum x_i &amp;amp; \sum x_i^2 \end{array} \right)\left( \begin{array}{c} A \\ B \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The Method of Determinants ===&lt;br /&gt;
for the matrix problem:&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} y_1 \\ y_2 \end{array} \right) = \left( \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right)\left( \begin{array}{c} x_1 \\ x_2 \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the above can be written as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_1 = a_{11} x_1 + a_{12} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;y_2 = a_{21} x_1 + a_{22} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
solving for &amp;lt;math&amp;gt;x_1&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;y_1&amp;lt;/math&amp;gt; is known&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;a_{22} (y_1 = a_{11} x_1 + a_{12} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-a_{12} (y_2 = a_{21} x_1 + a_{22} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow a_{22} y_1 - a_{12} y_2 = (a_{11}a_{22} - a_{12}a_{21}) x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| = \left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
: &amp;lt;math&amp;gt;x_1 = \frac{\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt; similarly &amp;lt;math&amp;gt;x_2 = \frac{\left| \begin{array}{cc}  a_{11} &amp;amp; y_1 \\  a_{21} &amp;amp; y_2  \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Solutions exist as long as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apply the method of determinant for the maximum likelihood problem above&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the uncertainty in all the measurements is not the same then we need to insert &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; back into the system of equations.&lt;br /&gt;
&lt;br /&gt;
:%This section may have an error. Matrix elements of be in position 22 should be \sigma^2??&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Uncertainty in the Linear Fit parameters==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
By definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}&amp;lt;/math&amp;gt;  : there are 2 parameters and N data points which translate to (N-2) degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
The least square fit ( assuming equal &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;) has the following solution for the parameters A &amp;amp; B as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\sum y_i \sum x_i^2 - \sum x_i \sum x_i y_i  }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \frac{(1) \sum x_i^2 - x_j\sum x_i   }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt; only the &amp;lt;math&amp;gt;y_j&amp;lt;/math&amp;gt; term survives &lt;br /&gt;
:&amp;lt;math&amp;gt; = D \left ( \sum x_i^2 - x_j\sum x_i \right)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D \equiv \frac{1}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}=\frac{1}{N\sum x_i^2 - \sum x_i \sum x_i }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_{j=1}^N \sigma_j^2 \left ( D \left ( \sum x_i^2 - x_j\sum x_i \right) \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2 - x_j\sum x_i \right )^2&amp;lt;/math&amp;gt; : Assume &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2\right )^2  + \left (x_j\sum x_i \right )^2 - 2 \left ( \sum x_i^2 x_j \sum x_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  \sum_{j=1}^N  \left ( \sum x_i^2\right ) +  \sum_{j=1}^N x_j^2  -  2 \sum x_i \sum_{j=1}^N x_j  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum x_i \sum_{j=1}^N x_j  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sum x_i \sum_{j=1}^N x_j \approx \sum_{j=1}^N x_j^2&amp;lt;/math&amp;gt; Both sums are over the number of observations &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum_{j=1}^N x_j^2  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2 \frac{1}{D}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \sigma^2  \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we redefine our origin in the linear plot so the line is centered a x=0 then &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum{x_i} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2} = \frac{\sum x_i^2 }{N\sum x_i^2 } = \frac{1}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{1}{N} = \frac{\sigma^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: The parameter A is the y-intercept so it makes some intuitive sense that the error in the Y -intercept would be dominated by the statistical error in Y&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in B===&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}= \frac{\partial}{\partial y_j} D \left ( N\sum x_i y_i -\sum x_i \sum y_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;=  D \left ( N x_j - \sum x_i \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 D^2 \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;\sigma_j = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N^2 x_j^2 - 2N x_j \sum x_i + \sum x_i^2\right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum_{j=1}^Nx_j^2 - 2N \sum x_i \sum_{j=1}^N x_j  + \sum x_i^2 \sum_{j=1}^N  \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum x_i^2 - 2N \sum x_i \sum_{j=1}^N x_j  + N \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - 2 \sum x_i \sum_{j=1}^N x_j  +  \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = N D^2 \sigma^2 \frac{1}{D} = ND \sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_B^2= \frac{N \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}} {N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Linear Fit with error==&lt;br /&gt;
&lt;br /&gt;
From above we know that if each independent measurement has a different error &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; then the fit parameters are given by &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D = \frac{1}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right| }= &lt;br /&gt;
\frac{1}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [ \sum\frac{ y_i}{\sigma_i^2} \sum\frac{ x_i^2}{\sigma_i^2}- \sum\frac{ x_i}{\sigma_i^2}  \sum\frac{ x_i y_i}{\sigma_i^2}  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ] =  \sum_{j=1}^N \left [ \sigma_j^2  D^2 \left ( \frac{ 1}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \sigma_j^2  \left [  \frac{ 1}{\sigma_j^4} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \frac{ x_j}{\sigma_j^4} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \frac{ x_j^2}{\sigma_j^4} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2   \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ 1}{\sigma_i^2} \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 -  \left( \sum \frac{ x_j}{\sigma_j^2} \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= D    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)  = \frac{ \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) }{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Compare with the unweighted error&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in B ===&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [\sum \frac{1}{\sigma_i^2}\sum \frac{x_i y_i}{\sigma_i^2}  - \sum \frac{ y_i}{\sigma_i^2}\sum \frac{x_i}{\sigma_i^2}   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_{j=1}^N \left [ \sigma_j^2 \left (  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \left [  \frac{ 1}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} + \left (\frac{1}{\sigma_j}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} + \left (\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 1 \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D \sum_{j=1}^N \frac{ 1}{\sigma_j^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_B^2 = \frac{  \sum\frac{ 1}{\sigma_i^2}}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Correlation Probability==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the Linear Fit has been performed, the next step will be to determine a probability that the Fit is actually describing the data.&lt;br /&gt;
&lt;br /&gt;
The Correlation Probability (R) is one method used to try and determine this probability.&lt;br /&gt;
&lt;br /&gt;
This method evaluates the &amp;quot;slope&amp;quot; parameter to determine if there is a correlation between the dependent and independent variables , x and y.&lt;br /&gt;
&lt;br /&gt;
The liner fit above was done to minimize \chi^2 for the following model&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y = A + Bx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What if we turn this  equation around such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = A^{\prime} + B^{\prime}y&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;B^{\prime} =0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is complete correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  &lt;br /&gt;
:&amp;lt;math&amp;gt;A = -\frac{A^{\prime}}{B^{\prime}}&amp;lt;/math&amp;gt;        and     &amp;lt;math&amp;gt;B = \frac{1}{B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: and &amp;lt;math&amp;gt;BB^{\prime} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So one can define a metric BB^{\prime} which has the natural range between 0 and 1 such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;R \equiv \sqrt{B B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
since&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and one can show that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B^{\prime} = \frac{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum y_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum y_i  &amp;amp; \sum y_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;R = \sqrt{ \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  } \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=   \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{\sqrt{\left( N\sum x_i^2 - \sum x_i \sum x_i  \right ) \left (N\sum y_i^2 - \sum y_i \sum y_i\right)  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:The correlation coefficient (R) CAN'T be used to indicate the degree of correlation.  The probability distribution &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; can be derived from a 2-D gaussian but knowledge of the correlation coefficient of the parent population &amp;lt;math&amp;gt;(\rho)&amp;lt;/math&amp;gt; is required to evaluate R of the sample distribution.&lt;br /&gt;
&lt;br /&gt;
Instead one assumes a correlation of &amp;lt;math&amp;gt;\rho=0&amp;lt;/math&amp;gt; in the parent distribution and then compares the sample value of &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; with what you would get if there were no correlation.&lt;br /&gt;
&lt;br /&gt;
The smaller &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; is the more likely that the data are correlated and that the linear fit is correct.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_R(R,\nu) = \frac{1}{\sqrt{\pi}} \frac{\Gamma\left ( \frac{\nu+1}{2}\right )}{\Gamma \left ( \frac{\nu}{2}\right)} \left( 1-R^2\right)^{\left( \frac{\nu-2}{2}\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
= Probability that any random sample of UNCORRELATED data would yield the correlation coefficient &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\Gamma(x) = \int_0^{\infty} t^{x-1}e^{-t} dt&amp;lt;/math&amp;gt;&lt;br /&gt;
 (ROOT::Math::tgamma(double x) )&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu=N-2&amp;lt;/math&amp;gt; = number of degrees of freedom = Number of data points - Number of parameters in fit function&lt;br /&gt;
&lt;br /&gt;
Derived in &amp;quot;Pugh and Winslow, The Analysis of Physical Measurement, Addison-Wesley Publishing, 1966.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Least Squares fit to a Polynomial=&lt;br /&gt;
&lt;br /&gt;
Let's assume we wish to now fit a polynomial instead of a straight line to the data.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) = \sum_{j=0}^{n} a_j x^{n}=\sum_{j=0}^{n} a_j f_j(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f_j(x) =&amp;lt;/math&amp;gt; a function which does not depend on &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i(a_0,a_1, \cdots ,a_n) = \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;a_n&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once again the probability is maximized when the numerator of the exponential is a minimum&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
The minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \frac{\partial \left( - \sum_{j=0}^{n} a_j f_j(x_i) \right)}{\partial a_k}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2 \sum_i^N  \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2\sum_i^N  \frac{1}{\sigma_i^2} \left (  -  f_k(x_i) \right) \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) =0&amp;lt;/math&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
: &amp;lt;math&amp;gt;\Rightarrow \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =  \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}  \sum_{j=0}^{n} a_j f_j(x_i)=  \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You now have a system of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; coupled equations for the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; with each equation summing over the &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; measurements.&lt;br /&gt;
&lt;br /&gt;
The first equation &amp;lt;math&amp;gt;(f_1)&amp;lt;/math&amp;gt; looks like this&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_i^N f_1(x_i) \frac{y_i}{\sigma_i^2} = \sum_i^N \frac{f_1(x_i)}{\sigma_i^2} \left ( a_1 f_1(x_i) + a_2 f_2(x_i) + \cdots a_n f_n(x_i)\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could use the method of determinants as we did to find the parameters &amp;lt;math&amp;gt;(a_n)&amp;lt;/math&amp;gt; for a linear fit but it is more convenient to use matrices in a technique referred to as regression analysis&lt;br /&gt;
&lt;br /&gt;
==Regression Analysis==&lt;br /&gt;
&lt;br /&gt;
The parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; in the previous section are linear parameters to a general function which may be a polynomial.&lt;br /&gt;
&lt;br /&gt;
The system of equations is composed of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations where the &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation is given as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
may be represented in matrix form as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\beta_k= \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{kj} = \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or in matrix form&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha} = \left ( \begin{matrix} \alpha_{11}  &amp;amp; \alpha_{12} &amp;amp; \cdots &amp;amp; \alpha_{1j} \\ \alpha_{21}  &amp;amp; \alpha_{22}&amp;amp;\cdots&amp;amp;\alpha_{2j} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1} &amp;amp;\alpha_{k2} &amp;amp;\cdots &amp;amp;\alpha_{kj}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
; the objective is to find the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
: To find &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; just invert the matrix&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \tilde{\beta} = \tilde{a} \tilde{\alpha} \right) \tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{\alpha}\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \Rightarrow  \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Thus if you invert the matrix &amp;lt;math&amp;gt;\tilde{\alpha}&amp;lt;/math&amp;gt; you find &amp;lt;math&amp;gt;\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt; and as a result the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Matrix inversion==&lt;br /&gt;
&lt;br /&gt;
The first thing to note is that for the inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A})&amp;lt;/math&amp;gt; to exist its determinant can not be zero&lt;br /&gt;
: &amp;lt;math&amp;gt;\left |\tilde{A} \right | \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A}^{-1})&amp;lt;/math&amp;gt; is defined such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{A}^{-1} = \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we divide both sides by the matrix &amp;lt;math&amp;gt;\tilde {A}&amp;lt;/math&amp;gt; then we have&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A}^{-1} = \frac{\tilde{1}}{\tilde{A} }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above ratio of the unity matrix to matrix &amp;lt;math&amp;gt;\tilde{A}&amp;lt;/math&amp;gt; is always equal to &amp;lt;math&amp;gt;\tilde{A}^{-1}&amp;lt;/math&amp;gt; as long as both the numerator and denominator are multiplied by the same constant factor.&lt;br /&gt;
&lt;br /&gt;
If we do such operations we can transform the ratio such that the denominator has the unity matrix and then the numerator will have the inverse matrix.  &lt;br /&gt;
&lt;br /&gt;
This is the principle of Gauss-Jordan Elimination.&lt;br /&gt;
&lt;br /&gt;
===Gauss-Jordan Elimination===&lt;br /&gt;
If Gauss–Jordan elimination is applied on a square matrix, it can be used to calculate the inverse matrix. This can be done by augmenting the square matrix with the identity matrix of the same dimensions, and through the following matrix operations:&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{1} \Rightarrow&lt;br /&gt;
 \tilde{1} \tilde{A}^{-1} .&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the original square matrix, &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;, is given by the following expression:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 \\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 \\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, after augmenting by the identity, the following is obtained:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A}\tilde{1} = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By performing elementary row operations on the &amp;lt;math&amp;gt;\tilde{A}\tilde{1}&amp;lt;/math&amp;gt; matrix until it reaches reduced row echelon form, the following is the final result:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1}\tilde{A}^{-1}  = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 &amp;amp; \frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1 &amp;amp; \frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix augmentation can now be undone, which gives the following:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}\qquad&lt;br /&gt;
 \tilde{A}^{-1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
\frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
\frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
\frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
:&amp;lt;math&amp;gt; &lt;br /&gt;
 \tilde{A}^{-1} =\frac{1}{4}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}=\frac{1}{det(A)}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
A matrix is non-singular (meaning that it has an inverse matrix) if and only if the identity matrix can be obtained using only elementary row operations.&lt;br /&gt;
&lt;br /&gt;
== Error Matrix==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
Where the definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - \sum_{j=0}^{n} a_j f_j(x_i) \right)^2}{N -n}&amp;lt;/math&amp;gt;  : there are &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; parameters and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; data points which translate to &amp;lt;math&amp;gt;(N-n)&amp;lt;/math&amp;gt; degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
Applying this for the parameter &amp;lt;math&amp;gt;a_k&amp;lt;/math&amp;gt; indicates that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k}^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial a_k}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;But what if there are covariances?&lt;br /&gt;
In that case the following general expression applies&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = &amp;lt;/math&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha}^{-1} = \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n) = ( \beta_1, \beta_2, \cdots , \beta_n) \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow  a_k = \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = \frac{\partial }{\partial y_i} \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\partial }{\partial y_i} \sum_j^n \left( \sum_i^N f_j(x_i) \frac{y_i}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt; :only one &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; in the sum over &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; survives the derivative&lt;br /&gt;
&lt;br /&gt;
similarly&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_l}{\partial y_i} = \sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
substituting&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^N \left [ \sigma_i^2  \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}\sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right)\alpha_{pl}^{-1} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;math&amp;gt; \sigma_i^2&amp;lt;/math&amp;gt; term appears on the  top and bottom.&lt;br /&gt;
;Move the outer most sum to the inside&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 =  \sum_j^n \left(   \alpha_{jk}^{-1}\sum_p^n \sum_i^N  \frac{f_j(x_i)  f_p(x_i)}{\sigma_i^2} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n  \alpha_{jk}^{-1}\sum_p^n \left(  \alpha_{jp} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n \alpha_{jk}^{-1}\tilde{1}_{jl}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{1}_{jl}&amp;lt;/math&amp;gt;  = the &amp;lt;math&amp;gt;j,l&amp;lt;/math&amp;gt; element of the unity matrix = 1&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{jk} = \alpha_{kj} &amp;lt;/math&amp;gt; : the matrix is symmetric.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sigma_{a_k,a_l}^2 =  \sum_j^n \alpha_{kj}^{-1}\tilde{1}_{jl}= \alpha_{kl}^{-1}&amp;lt;/math&amp;gt; = Covariance/Error matrix element&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse matrix &amp;lt;math&amp;gt;\alpha_{kl}^{-1}&amp;lt;/math&amp;gt; tells you the variance and covariance for the calculation of the total error.&lt;br /&gt;
&lt;br /&gt;
;Remember&lt;br /&gt;
:&amp;lt;math&amp;gt;Y = \sum_i^n a_i f_i(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_i}^2 = \alpha_{ii}^{-1}&amp;lt;/math&amp;gt;= error in the parameters&lt;br /&gt;
: &amp;lt;math&amp;gt;s^2 = \sum_i^n \sum_j^n \left ( \frac{\partial Y}{\partial a_i}\frac{\partial Y}{\partial a_j}\right) \sigma_{ij}=\sum_i^n \sum_j^n \left ( f_i(x)f_j(x)\right) \sigma_{ij} &amp;lt;/math&amp;gt; = error in the model's prediction&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^n \sum_j^n  x^{j+i} \sigma_{ij}&amp;lt;/math&amp;gt; If Y is a power series in x &amp;lt;math&amp;gt;(f_i(x) = x^i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Chi-Square Distribution=&lt;br /&gt;
&lt;br /&gt;
The above tools allow you to perform a least squares fit to data using high order polynomials.&lt;br /&gt;
&lt;br /&gt;
; The question though is how high in order should you go?  (ie; when should you stop adding parameters to the fit?)&lt;br /&gt;
&lt;br /&gt;
One argument is that you should stop increasing the number of parameters if they don't change much.  The parameters, using the above techniques, are correlated such that when you add another order to the fit all the parameters have the potential to change in value.  If their change is miniscule then you can ague that adding higher orders to the fit does not change the fit.  There are techniu&lt;br /&gt;
&lt;br /&gt;
A quantitative way to express the above uses the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value of the fit.  The above technique seeks to minimize &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  So if you add higher orders and more parameters but the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value does not change appreciably, you could argue that the fit is a good as you can make it with the given function.&lt;br /&gt;
&lt;br /&gt;
==Derivation==&lt;br /&gt;
&lt;br /&gt;
If you assume a series of measurements have a Gaussian parent distribution&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) = \frac{1}{\sqrt{2 \pi} \sigma} e^{-\frac{1}{2} \left ( \frac{x - \bar{x}}{\sigma}\right)^2}&amp;lt;/math&amp;gt; = probability of measuring the value &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; from a Gaussian distribution with s sample mean&amp;lt;math&amp;gt; \bar{x}&amp;lt;/math&amp;gt; from a parent distribution of with &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you break the above probability up into intervals of &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt; then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) d\bar{x}&amp;lt;/math&amp;gt; = probability that &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; lies within the interval &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you make N measurements of two variates (x_i and y_i) which may be correlated using a function with n parameters.&lt;br /&gt;
&lt;br /&gt;
== Chi-Square Cumulative Distribution==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution function is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\nu) = \frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; y(x_i)&amp;lt;/math&amp;gt; = the assumed functional dependence of the data on &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; =  N - n -1 = degrees of freedom&lt;br /&gt;
:&amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points&lt;br /&gt;
:&amp;lt;math&amp;gt;n + 1&amp;lt;/math&amp;gt; = number of parameters used in the fit (n coefficients + 1 constant term)&lt;br /&gt;
:&amp;lt;math&amp;gt; \Gamma(z) = \int_0^\infty  t^{z-1} e^{-t}\,dt\;&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above tells you the probability of getting the value of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; given the number of degrees of freedom &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; in your fit.&lt;br /&gt;
&lt;br /&gt;
While it is useful to know what the probability is of getting a value of &amp;lt;math&amp;gt;\chi^2 = x&amp;lt;/math&amp;gt; it is more useful to use the cumulative distribution function.&lt;br /&gt;
&lt;br /&gt;
The probability that the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; you received from your fit is as larger or larger than what you would get from a function described by the parent distribution is given &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty} P(x,\nu) dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A graph of &amp;lt;math&amp;gt;P(x,\nu)&amp;lt;/math&amp;gt; shows that the mean value of this function is &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow P(\chi^2 = \nu ,\nu)=\int_{\chi^2=\nu}^{\infty} P(x,\nu) dx = 0.5&amp;lt;/math&amp;gt; = probability of getting the average value for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; or larger is 0.5.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Reduced Chi-square==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced Chi-square &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2_{\nu} = \frac{\chi^2}{\nu}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the mean of &amp;lt;math&amp;gt;P(x,\nu) = \nu&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
then the mean of &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(\frac{x}{\nu},\nu) = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A reduced chi-squared distribution &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; has a mean value of 1.&lt;br /&gt;
&lt;br /&gt;
==p-Value==&lt;br /&gt;
&lt;br /&gt;
For the above fits,&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The p-value is defined as the cumulative &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution&lt;br /&gt;
&lt;br /&gt;
: p-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The p-value is the probability, under the assumption of a hypothesis H , of obtaining data at least as incompatible with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  small p-values are good.&lt;br /&gt;
&lt;br /&gt;
;The p-value is NOT&lt;br /&gt;
&lt;br /&gt;
# the probability that the null hypothesis is true. (This false conclusion is used to justify the &amp;quot;rule&amp;quot; of considering a result to be significant if its p-value is very small (near zero).) &amp;lt;br /&amp;gt; In fact, frequentist statistics does not, and cannot, attach probabilities to hypotheses. &lt;br /&gt;
# the probability that a finding is &amp;quot;merely a fluke.&amp;quot; (Again, this conclusion arises from the &amp;quot;rule&amp;quot; that small p-values indicate significant differences.) &amp;lt;br /&amp;gt; As the calculation of a p-value is based on the ''assumption'' that a finding is the product of chance alone, it patently cannot also be used to gauge the probability of that assumption being true. This is subtly different from the real meaning which is that the p-value is the chance that null hypothesis explains the result: the result might not be &amp;quot;merely a fluke,&amp;quot; ''and'' be explicable by the null hypothesis with confidence equal to the p-value.&lt;br /&gt;
#the probability of falsely rejecting the null hypothesis. &lt;br /&gt;
#the probability that a replicating experiment would not yield the same conclusion.&lt;br /&gt;
#1&amp;amp;nbsp;−&amp;amp;nbsp;(p-value) is ''not'' the probability of the alternative hypothesis being true.&lt;br /&gt;
#A determination of the significance level of the test. &amp;lt;br /&amp;gt; The significance level of a test is a value that should be decided upon by the agent interpreting the data before the data are viewed, and is compared against the p-value or any other statistic calculated after the test has been performed.&lt;br /&gt;
#an indication of  the size or importance of the observed effect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In ROOT&lt;br /&gt;
&lt;br /&gt;
 double ROOT::Math::chisquared_cdf_c (double &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;, double &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;, double x0 = 0 )		&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;=\int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
  TMath::Prob(&amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
You can turn things around the other way by defining P-value to be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: P-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\infty}^{\chi^2}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx = 1-(p-value)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here P-value would be the probability, under the assumption of a hypothesis H , of obtaining data at least as '''compatible''' with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
The P-value is the probability of observing a sample statistic as extreme as the test statistic.&lt;br /&gt;
&lt;br /&gt;
http://stattrek.com/chi-square-test/goodness-of-fit.aspx&lt;br /&gt;
&lt;br /&gt;
=F-test=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt; \chi^2&amp;lt;/math&amp;gt; test in the previous section measures both the difference between the data and the fit function as well as the difference between the fit function and the &amp;quot;parent&amp;quot; function.  The &amp;quot;parent&amp;quot; function is the true functional dependence of the data.&lt;br /&gt;
&lt;br /&gt;
The F-test can be used to determine the difference between the fit function and the parent function, to more directly test if you have come up with the correct fit function.&lt;br /&gt;
&lt;br /&gt;
== F-distribution==&lt;br /&gt;
&lt;br /&gt;
If, for example, you are comparing the Ratio of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; values from 2 different fits to the data then the function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then since &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 \equiv \sum_i^N \frac{\left (y_i-y(x_i)\right)^2}{\sigma_i^2}= \frac{s^2}{\sigma^2}&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; = constant&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and assuming &amp;lt;math&amp;gt;\sigma_1 = \sigma_2&amp;lt;/math&amp;gt; (same data set)&lt;br /&gt;
&lt;br /&gt;
one can argue that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_1}{\nu_1}} = \frac{s_1^2}{\sigma_1^2}\frac{\sigma_2^2}{s_2^2} \frac{\nu_2}{\nu_1} = \frac{\nu_2}{\nu_1} \frac{s_1^2}{s_2^2}&amp;lt;/math&amp;gt; = function that is independent of the error &amp;lt;math&amp;gt; \sigma&amp;lt;/math&amp;gt; intrinsic to the data thus the function is only comparing the fit residuals&amp;lt;math&amp;gt; (s^2)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The Function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
can be shown to follow the following probability distribution.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1, \nu_2) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
which is available in ROOT as&lt;br /&gt;
&lt;br /&gt;
 ROOT::Math::fdistribution_pdf(double x, double n, double m, double x0 = 0 )&lt;br /&gt;
&lt;br /&gt;
== The chi^2 difference test==&lt;br /&gt;
&lt;br /&gt;
In a similar fashion as above, one can define another ratio which is based on the difference between the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value using 2 different .&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} = \frac{\frac{\chi^2_1 - \chi^2_2}{\nu_1-\nu_2}}{\frac{\chi^2_1}{\nu_1}} =  \frac{\frac{\chi^2(m) - \chi^2(n)}{n-m}}{\frac{\chi^2(m)}{(N-m-1)}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under the null hypothesis that model 2 does not provide a significantly better fit than model 1, F will have an F distribution, with &amp;lt;math&amp;gt;(\nu_2 − \nu_1, \nu_1)&amp;lt;/math&amp;gt; degrees of freedom. The null hypothesis is rejected if the F calculated from the data is greater than the critical value of the F  distribution for some desired false-rejection probability (e.g. 0.05).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to determine if you need to continue adding parameters to the fit then you can consider an F-test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_1}{N-m-1}} = \frac{\Delta \chi^2}{\chi^2_{\nu}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above statistic will again follow the F-distribution &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1=1, \nu_2=N-m-1) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note: Some will define the fraction with respect to the next order fit&lt;br /&gt;
::&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_2}{N-m}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The multiple correlation coefficient test==&lt;br /&gt;
&lt;br /&gt;
While the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference F-test above is useful to evaluate the impact of adding another fit parameter, you will also want to evaluate the &amp;quot;goodness&amp;quot; of the entire fit in a manner which can be related to a correlation coefficient R (in this case it is a multiple-correlation coefficient because the fit can go beyond linear).&lt;br /&gt;
&lt;br /&gt;
I usually suggest that you do this after the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference test unless you have a theoretical model which constrains the number of fit parameters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Least Squares fit to an Arbitrary Function=&lt;br /&gt;
&lt;br /&gt;
The above Least Squares fit methods work well if your fit function has a linear dependence on the fit parameters.&lt;br /&gt;
&lt;br /&gt;
:ie; &amp;lt;math&amp;gt;y(x) =\sum_i^n a_i x^i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
such fit functions give you a set of  &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations that are linear in the parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; when you are minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  The &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation of this set of n equations is shown below.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your fit equation looks like&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) =a_1 e^{\frac{1}{2} \left (\frac{x-a_2}{a_3}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
now your set of equations minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; are non-linear with respect to the parameters.  You can't take separate the &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; term from the &amp;lt;math&amp;gt;f_k(x_i)&amp;lt;/math&amp;gt; function and thereby solve the system by inverting your matrix&lt;br /&gt;
:&amp;lt;math&amp;gt; \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
Because of this, a direct analytical solution is difficult (you need to find roots of coupled non-linear equations) and one resorts to approximation methods for the solution.&lt;br /&gt;
== Grid search==&lt;br /&gt;
&lt;br /&gt;
The fundamentals of the grid search is to basically change all parameters over some natural range to generate a hypersurface in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; and look for the smallest value of of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; that appears on the hypersurface.&lt;br /&gt;
&lt;br /&gt;
In Lab 15 you will generate this hypersurface for the simple least squares linear fit tot he Temp -vs- Voltage data in lab 14.  Your surface might look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:TF_ErrAna_Lab15.png | 200 px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As shown above, I have plotted the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; as a function of  the y-Intercept &amp;lt;math&amp;gt;(a_1)&amp;lt;/math&amp;gt; and the slope &amp;lt;math&amp;gt;(a_2)&amp;lt;/math&amp;gt;.  The minimum in this hypersurface should coincide with the values of Y-intercept=&amp;lt;math&amp;gt;a_1=-1.01&amp;lt;/math&amp;gt; and Slope=&amp;lt;math&amp;gt;a_2=0.0431&amp;lt;/math&amp;gt; from the linear regression solution.&lt;br /&gt;
&lt;br /&gt;
If we return to the beginning, the original problem is to use the max-likelihood principle on the probability function for finding the correct fit using the data. &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i -y(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
To maximize the probability of finding the best fit we need to find by minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right ) \frac{\partial \left( - y(x_i) \right)}{\partial a_k} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively you could also express \chi^2 in terms of the probability distributions as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n)  \propto e^{- \frac{1}{2}\chi^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Grid search method==&lt;br /&gt;
&lt;br /&gt;
The grid search method relies on the independence of the fit parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt;.    The search starts by selecting initial values for all parameters and then searching for a &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; minimum for one of the fit parameters.  You then set the parameter to the determined value and repeat the procedure on the next parameter.  You keep repeating until a stable value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found.&lt;br /&gt;
&lt;br /&gt;
Obviously, this method strongly depends on the initial values selected for the parameters.&lt;br /&gt;
&lt;br /&gt;
==Parameter Errors==&lt;br /&gt;
&lt;br /&gt;
Returning back to the equation&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
it may be observed that &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; represents the error in the parameter &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; and that the error alters &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once a minimum is found, the parabolic nature of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;  dependence on a single parameter is such that an increase in 1 standard deviation in the parameter results in an increase in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can turn this to determine the error in the fit parameter by determining how much the parameter must increase (or decrease) in order to increase &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Gradient Search Method==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Gradient search method improves on the Grid search method by attempting to search in a direction towards the minima as determined by simultaneous changes in all parameters.  The change in each parameter may differ in magnitude and is adjustable for each parameter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference  Go Back] [[Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91707</id>
		<title>TF ErrorAna StatInference</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91707"/>
		<updated>2014-03-21T19:18:12Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* The Method of Determinants */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Statistical Inference&lt;br /&gt;
=Frequentist -vs- Bayesian Inference=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When it comes to testing a hypothesis, there are  two dominant philosophies known as a Frequentist or a Bayesian perspective.&lt;br /&gt;
&lt;br /&gt;
The dominant discussion for this class will be from the Frequentist perspective.&lt;br /&gt;
&lt;br /&gt;
== frequentist statistical inference==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made using a null-hypothesis test; that is, one that answers the question, Assuming that the null hypothesis is true, what is the probability of observing a value for the test statistic that is at least as extreme as the value that was actually observed?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The relative frequency of occurrence of an event, in a number of repetitions of the experiment, is a measure of the probability of that event.&lt;br /&gt;
Thus, if &amp;lt;math&amp;gt;n_t&amp;lt;/math&amp;gt; is the total number of trials and &amp;lt;math&amp;gt;n_x&amp;lt;/math&amp;gt; is the number of trials where the event x occurred, the probability P(x) of the event occurring will be approximated by the relative frequency as follows:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) \approx \frac{n_x}{n_t}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Bayesian inference.==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made by using evidence or observations  to update or to newly infer the probability that a hypothesis may be true. The name &amp;quot;Bayesian&amp;quot; comes from the frequent use of Bayes' theorem in the inference process.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem relates the conditional probability, conditional and marginal probability, marginal probabilities of events ''A'' and ''B'', where ''B'' has a non-vanishing probability:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}\,\! &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Each term in Bayes' theorem has a conventional name:&lt;br /&gt;
* P(''A'') is the prior probability or marginal probability of ''A''. It is &amp;quot;prior&amp;quot; in the sense that it does not take into account any information about ''B''.&lt;br /&gt;
* P(''B'') is the prior or marginal probability of ''B'', and acts as a normalizing constant. &lt;br /&gt;
* P(''A''|''B'') is the conditional probability of ''A'', given ''B''. It is also called the posterior probability because it is derived from or depends upon the specified value of ''B''.&lt;br /&gt;
* P(''B''|''A'') is the conditional probability of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem in this form gives a mathematical representation of how the conditional probabability of event ''A'' given ''B'' is related to the converse conditional probabablity of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
Suppose there is a school having 60% boys and 40% girls as students. &lt;br /&gt;
&lt;br /&gt;
The female students wear trousers or skirts in equal numbers; the boys all wear trousers. &lt;br /&gt;
&lt;br /&gt;
An observer sees a (random) student from a distance; all the observer can see is that this student is wearing trousers. &lt;br /&gt;
&lt;br /&gt;
What is the probability this student is a girl? &lt;br /&gt;
&lt;br /&gt;
The correct answer can be computed using Bayes' theorem.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P(A) \equiv&amp;lt;/math&amp;gt; probability that  the student observed is a girl = 0.4&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B) \equiv&amp;lt;/math&amp;gt; probability  that the student observed is wearing trousers = 60+20/100 = 0.8&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B|A) \equiv&amp;lt;/math&amp;gt; probability the student is wearing trousers given that the student is a girl&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A|B) \equiv&amp;lt;/math&amp;gt; probability the student is a girl given that the student is wearing trousers&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(B|A) =0.5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B|A) P(A)}{P(B)} = \frac{0.5 \times 0.4}{0.8} = 0.25.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Method of Maximum Likelihood=&lt;br /&gt;
&lt;br /&gt;
;The principle of maximum likelihood is the cornerstone of Frequentist based hypothesis testing and may be written as&lt;br /&gt;
:The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observation is a maximum.&lt;br /&gt;
&lt;br /&gt;
= Least Squares Fit to a Line=&lt;br /&gt;
&lt;br /&gt;
== Applying the Method of Maximum Likelihood==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our object is to find the best straight line fit for an expected linear relationship between dependent variate &amp;lt;math&amp;gt;(y)&amp;lt;/math&amp;gt;  and independent variate &amp;lt;math&amp;gt;(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we let &amp;lt;math&amp;gt;y_0(x)&amp;lt;/math&amp;gt; represent the &amp;quot;true&amp;quot; linear relationship between independent variate &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and dependent variate &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_o(x) = A + B x&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i = \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A,B) = \Pi \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \left ( \frac{1}{\sigma \sqrt{2 \pi}}\right )^N e^{- \frac{1}{2} \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt; = Max&lt;br /&gt;
 &lt;br /&gt;
The maximum probability will result in the best values for &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\chi^2 = \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2 = \sum \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2&amp;lt;/math&amp;gt; = Min&lt;br /&gt;
&lt;br /&gt;
The min for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; occurs when the function is a minimum for both parameters A &amp;amp; B : ie&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \sum \frac{ \partial}{\partial A} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \sum \frac{ \partial}{\partial B} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;If &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt; : All variances are the same  (weighted fits don't make this assumption)&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial A} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial B} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum x_i \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum  x_i \left( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above equations represent a set of simultaneous of 2 equations and 2 unknowns which can be solved.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum y_i = \sum A + B \sum x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum x_i y_i = A \sum x_i + B \sum x_i^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} \sum y_i \\ \sum x_i y_i \end{array} \right) = \left( \begin{array}{cc} N &amp;amp; \sum x_i\\&lt;br /&gt;
\sum x_i &amp;amp; \sum x_i^2 \end{array} \right)\left( \begin{array}{c} A \\ B \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The Method of Determinants ===&lt;br /&gt;
for the matrix problem:&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} y_1 \\ y_2 \end{array} \right) = \left( \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right)\left( \begin{array}{c} x_1 \\ x_2 \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the above can be written as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_1 = a_{11} x_1 + a_{12} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;y_2 = a_{21} x_1 + a_{22} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
solving for &amp;lt;math&amp;gt;x_1&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;y_1&amp;lt;/math&amp;gt; is known&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;a_{22} (y_1 = a_{11} x_1 + a_{12} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-a_{12} (y_2 = a_{21} x_1 + a_{22} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow a_{22} y_1 - a_{12} y_2 = (a_{11}a_{22} - a_{12}a_{21}) x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| = \left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
: &amp;lt;math&amp;gt;x_1 = \frac{\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt; similarly &amp;lt;math&amp;gt;x_2 = \frac{\left| \begin{array}{cc}  a_{11} &amp;amp; y_1 \\  a_{21} &amp;amp; y_2  \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Solutions exist as long as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apply the method of determinant for the maximum likelihood problem above&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the uncertainty in all the measurements is not the same then we need to insert &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; back into the system of equations.&lt;br /&gt;
&lt;br /&gt;
%This section may have an error. Matrix elements of be in position 22 should be \sigma^2??&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Uncertainty in the Linear Fit parameters==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
By definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}&amp;lt;/math&amp;gt;  : there are 2 parameters and N data points which translate to (N-2) degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
The least square fit ( assuming equal &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;) has the following solution for the parameters A &amp;amp; B as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\sum y_i \sum x_i^2 - \sum x_i \sum x_i y_i  }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \frac{(1) \sum x_i^2 - x_j\sum x_i   }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt; only the &amp;lt;math&amp;gt;y_j&amp;lt;/math&amp;gt; term survives &lt;br /&gt;
:&amp;lt;math&amp;gt; = D \left ( \sum x_i^2 - x_j\sum x_i \right)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D \equiv \frac{1}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}=\frac{1}{N\sum x_i^2 - \sum x_i \sum x_i }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_{j=1}^N \sigma_j^2 \left ( D \left ( \sum x_i^2 - x_j\sum x_i \right) \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2 - x_j\sum x_i \right )^2&amp;lt;/math&amp;gt; : Assume &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2\right )^2  + \left (x_j\sum x_i \right )^2 - 2 \left ( \sum x_i^2 x_j \sum x_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  \sum_{j=1}^N  \left ( \sum x_i^2\right ) +  \sum_{j=1}^N x_j^2  -  2 \sum x_i \sum_{j=1}^N x_j  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum x_i \sum_{j=1}^N x_j  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sum x_i \sum_{j=1}^N x_j \approx \sum_{j=1}^N x_j^2&amp;lt;/math&amp;gt; Both sums are over the number of observations &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum_{j=1}^N x_j^2  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2 \frac{1}{D}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \sigma^2  \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we redefine our origin in the linear plot so the line is centered a x=0 then &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum{x_i} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2} = \frac{\sum x_i^2 }{N\sum x_i^2 } = \frac{1}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{1}{N} = \frac{\sigma^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: The parameter A is the y-intercept so it makes some intuitive sense that the error in the Y -intercept would be dominated by the statistical error in Y&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in B===&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}= \frac{\partial}{\partial y_j} D \left ( N\sum x_i y_i -\sum x_i \sum y_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;=  D \left ( N x_j - \sum x_i \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 D^2 \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;\sigma_j = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N^2 x_j^2 - 2N x_j \sum x_i + \sum x_i^2\right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum_{j=1}^Nx_j^2 - 2N \sum x_i \sum_{j=1}^N x_j  + \sum x_i^2 \sum_{j=1}^N  \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum x_i^2 - 2N \sum x_i \sum_{j=1}^N x_j  + N \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - 2 \sum x_i \sum_{j=1}^N x_j  +  \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = N D^2 \sigma^2 \frac{1}{D} = ND \sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_B^2= \frac{N \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}} {N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Linear Fit with error==&lt;br /&gt;
&lt;br /&gt;
From above we know that if each independent measurement has a different error &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; then the fit parameters are given by &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D = \frac{1}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right| }= &lt;br /&gt;
\frac{1}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [ \sum\frac{ y_i}{\sigma_i^2} \sum\frac{ x_i^2}{\sigma_i^2}- \sum\frac{ x_i}{\sigma_i^2}  \sum\frac{ x_i y_i}{\sigma_i^2}  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ] =  \sum_{j=1}^N \left [ \sigma_j^2  D^2 \left ( \frac{ 1}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \sigma_j^2  \left [  \frac{ 1}{\sigma_j^4} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \frac{ x_j}{\sigma_j^4} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \frac{ x_j^2}{\sigma_j^4} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2   \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ 1}{\sigma_i^2} \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 -  \left( \sum \frac{ x_j}{\sigma_j^2} \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= D    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)  = \frac{ \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) }{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Compare with the unweighted error&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in B ===&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [\sum \frac{1}{\sigma_i^2}\sum \frac{x_i y_i}{\sigma_i^2}  - \sum \frac{ y_i}{\sigma_i^2}\sum \frac{x_i}{\sigma_i^2}   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_{j=1}^N \left [ \sigma_j^2 \left (  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \left [  \frac{ 1}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} + \left (\frac{1}{\sigma_j}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} + \left (\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 1 \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D \sum_{j=1}^N \frac{ 1}{\sigma_j^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_B^2 = \frac{  \sum\frac{ 1}{\sigma_i^2}}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Correlation Probability==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the Linear Fit has been performed, the next step will be to determine a probability that the Fit is actually describing the data.&lt;br /&gt;
&lt;br /&gt;
The Correlation Probability (R) is one method used to try and determine this probability.&lt;br /&gt;
&lt;br /&gt;
This method evaluates the &amp;quot;slope&amp;quot; parameter to determine if there is a correlation between the dependent and independent variables , x and y.&lt;br /&gt;
&lt;br /&gt;
The liner fit above was done to minimize \chi^2 for the following model&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y = A + Bx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What if we turn this  equation around such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = A^{\prime} + B^{\prime}y&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;B^{\prime} =0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is complete correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  &lt;br /&gt;
:&amp;lt;math&amp;gt;A = -\frac{A^{\prime}}{B^{\prime}}&amp;lt;/math&amp;gt;        and     &amp;lt;math&amp;gt;B = \frac{1}{B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: and &amp;lt;math&amp;gt;BB^{\prime} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So one can define a metric BB^{\prime} which has the natural range between 0 and 1 such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;R \equiv \sqrt{B B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
since&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and one can show that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B^{\prime} = \frac{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum y_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum y_i  &amp;amp; \sum y_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;R = \sqrt{ \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  } \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=   \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{\sqrt{\left( N\sum x_i^2 - \sum x_i \sum x_i  \right ) \left (N\sum y_i^2 - \sum y_i \sum y_i\right)  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:The correlation coefficient (R) CAN'T be used to indicate the degree of correlation.  The probability distribution &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; can be derived from a 2-D gaussian but knowledge of the correlation coefficient of the parent population &amp;lt;math&amp;gt;(\rho)&amp;lt;/math&amp;gt; is required to evaluate R of the sample distribution.&lt;br /&gt;
&lt;br /&gt;
Instead one assumes a correlation of &amp;lt;math&amp;gt;\rho=0&amp;lt;/math&amp;gt; in the parent distribution and then compares the sample value of &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; with what you would get if there were no correlation.&lt;br /&gt;
&lt;br /&gt;
The smaller &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; is the more likely that the data are correlated and that the linear fit is correct.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_R(R,\nu) = \frac{1}{\sqrt{\pi}} \frac{\Gamma\left ( \frac{\nu+1}{2}\right )}{\Gamma \left ( \frac{\nu}{2}\right)} \left( 1-R^2\right)^{\left( \frac{\nu-2}{2}\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
= Probability that any random sample of UNCORRELATED data would yield the correlation coefficient &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\Gamma(x) = \int_0^{\infty} t^{x-1}e^{-t} dt&amp;lt;/math&amp;gt;&lt;br /&gt;
 (ROOT::Math::tgamma(double x) )&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu=N-2&amp;lt;/math&amp;gt; = number of degrees of freedom = Number of data points - Number of parameters in fit function&lt;br /&gt;
&lt;br /&gt;
Derived in &amp;quot;Pugh and Winslow, The Analysis of Physical Measurement, Addison-Wesley Publishing, 1966.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Least Squares fit to a Polynomial=&lt;br /&gt;
&lt;br /&gt;
Let's assume we wish to now fit a polynomial instead of a straight line to the data.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) = \sum_{j=0}^{n} a_j x^{n}=\sum_{j=0}^{n} a_j f_j(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f_j(x) =&amp;lt;/math&amp;gt; a function which does not depend on &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i(a_0,a_1, \cdots ,a_n) = \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;a_n&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once again the probability is maximized when the numerator of the exponential is a minimum&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
The minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \frac{\partial \left( - \sum_{j=0}^{n} a_j f_j(x_i) \right)}{\partial a_k}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2 \sum_i^N  \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2\sum_i^N  \frac{1}{\sigma_i^2} \left (  -  f_k(x_i) \right) \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) =0&amp;lt;/math&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
: &amp;lt;math&amp;gt;\Rightarrow \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =  \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}  \sum_{j=0}^{n} a_j f_j(x_i)=  \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You now have a system of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; coupled equations for the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; with each equation summing over the &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; measurements.&lt;br /&gt;
&lt;br /&gt;
The first equation &amp;lt;math&amp;gt;(f_1)&amp;lt;/math&amp;gt; looks like this&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_i^N f_1(x_i) \frac{y_i}{\sigma_i^2} = \sum_i^N \frac{f_1(x_i)}{\sigma_i^2} \left ( a_1 f_1(x_i) + a_2 f_2(x_i) + \cdots a_n f_n(x_i)\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could use the method of determinants as we did to find the parameters &amp;lt;math&amp;gt;(a_n)&amp;lt;/math&amp;gt; for a linear fit but it is more convenient to use matrices in a technique referred to as regression analysis&lt;br /&gt;
&lt;br /&gt;
==Regression Analysis==&lt;br /&gt;
&lt;br /&gt;
The parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; in the previous section are linear parameters to a general function which may be a polynomial.&lt;br /&gt;
&lt;br /&gt;
The system of equations is composed of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations where the &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation is given as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
may be represented in matrix form as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\beta_k= \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{kj} = \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or in matrix form&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha} = \left ( \begin{matrix} \alpha_{11}  &amp;amp; \alpha_{12} &amp;amp; \cdots &amp;amp; \alpha_{1j} \\ \alpha_{21}  &amp;amp; \alpha_{22}&amp;amp;\cdots&amp;amp;\alpha_{2j} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1} &amp;amp;\alpha_{k2} &amp;amp;\cdots &amp;amp;\alpha_{kj}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
; the objective is to find the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
: To find &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; just invert the matrix&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \tilde{\beta} = \tilde{a} \tilde{\alpha} \right) \tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{\alpha}\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \Rightarrow  \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Thus if you invert the matrix &amp;lt;math&amp;gt;\tilde{\alpha}&amp;lt;/math&amp;gt; you find &amp;lt;math&amp;gt;\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt; and as a result the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Matrix inversion==&lt;br /&gt;
&lt;br /&gt;
The first thing to note is that for the inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A})&amp;lt;/math&amp;gt; to exist its determinant can not be zero&lt;br /&gt;
: &amp;lt;math&amp;gt;\left |\tilde{A} \right | \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A}^{-1})&amp;lt;/math&amp;gt; is defined such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{A}^{-1} = \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we divide both sides by the matrix &amp;lt;math&amp;gt;\tilde {A}&amp;lt;/math&amp;gt; then we have&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A}^{-1} = \frac{\tilde{1}}{\tilde{A} }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above ratio of the unity matrix to matrix &amp;lt;math&amp;gt;\tilde{A}&amp;lt;/math&amp;gt; is always equal to &amp;lt;math&amp;gt;\tilde{A}^{-1}&amp;lt;/math&amp;gt; as long as both the numerator and denominator are multiplied by the same constant factor.&lt;br /&gt;
&lt;br /&gt;
If we do such operations we can transform the ratio such that the denominator has the unity matrix and then the numerator will have the inverse matrix.  &lt;br /&gt;
&lt;br /&gt;
This is the principle of Gauss-Jordan Elimination.&lt;br /&gt;
&lt;br /&gt;
===Gauss-Jordan Elimination===&lt;br /&gt;
If Gauss–Jordan elimination is applied on a square matrix, it can be used to calculate the inverse matrix. This can be done by augmenting the square matrix with the identity matrix of the same dimensions, and through the following matrix operations:&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{1} \Rightarrow&lt;br /&gt;
 \tilde{1} \tilde{A}^{-1} .&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the original square matrix, &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;, is given by the following expression:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 \\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 \\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, after augmenting by the identity, the following is obtained:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A}\tilde{1} = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By performing elementary row operations on the &amp;lt;math&amp;gt;\tilde{A}\tilde{1}&amp;lt;/math&amp;gt; matrix until it reaches reduced row echelon form, the following is the final result:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1}\tilde{A}^{-1}  = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 &amp;amp; \frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1 &amp;amp; \frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix augmentation can now be undone, which gives the following:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}\qquad&lt;br /&gt;
 \tilde{A}^{-1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
\frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
\frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
\frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
:&amp;lt;math&amp;gt; &lt;br /&gt;
 \tilde{A}^{-1} =\frac{1}{4}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}=\frac{1}{det(A)}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
A matrix is non-singular (meaning that it has an inverse matrix) if and only if the identity matrix can be obtained using only elementary row operations.&lt;br /&gt;
&lt;br /&gt;
== Error Matrix==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
Where the definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - \sum_{j=0}^{n} a_j f_j(x_i) \right)^2}{N -n}&amp;lt;/math&amp;gt;  : there are &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; parameters and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; data points which translate to &amp;lt;math&amp;gt;(N-n)&amp;lt;/math&amp;gt; degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
Applying this for the parameter &amp;lt;math&amp;gt;a_k&amp;lt;/math&amp;gt; indicates that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k}^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial a_k}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;But what if there are covariances?&lt;br /&gt;
In that case the following general expression applies&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = &amp;lt;/math&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha}^{-1} = \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n) = ( \beta_1, \beta_2, \cdots , \beta_n) \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow  a_k = \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = \frac{\partial }{\partial y_i} \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\partial }{\partial y_i} \sum_j^n \left( \sum_i^N f_j(x_i) \frac{y_i}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt; :only one &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; in the sum over &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; survives the derivative&lt;br /&gt;
&lt;br /&gt;
similarly&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_l}{\partial y_i} = \sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
substituting&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^N \left [ \sigma_i^2  \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}\sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right)\alpha_{pl}^{-1} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;math&amp;gt; \sigma_i^2&amp;lt;/math&amp;gt; term appears on the  top and bottom.&lt;br /&gt;
;Move the outer most sum to the inside&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 =  \sum_j^n \left(   \alpha_{jk}^{-1}\sum_p^n \sum_i^N  \frac{f_j(x_i)  f_p(x_i)}{\sigma_i^2} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n  \alpha_{jk}^{-1}\sum_p^n \left(  \alpha_{jp} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n \alpha_{jk}^{-1}\tilde{1}_{jl}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{1}_{jl}&amp;lt;/math&amp;gt;  = the &amp;lt;math&amp;gt;j,l&amp;lt;/math&amp;gt; element of the unity matrix = 1&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{jk} = \alpha_{kj} &amp;lt;/math&amp;gt; : the matrix is symmetric.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sigma_{a_k,a_l}^2 =  \sum_j^n \alpha_{kj}^{-1}\tilde{1}_{jl}= \alpha_{kl}^{-1}&amp;lt;/math&amp;gt; = Covariance/Error matrix element&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse matrix &amp;lt;math&amp;gt;\alpha_{kl}^{-1}&amp;lt;/math&amp;gt; tells you the variance and covariance for the calculation of the total error.&lt;br /&gt;
&lt;br /&gt;
;Remember&lt;br /&gt;
:&amp;lt;math&amp;gt;Y = \sum_i^n a_i f_i(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_i}^2 = \alpha_{ii}^{-1}&amp;lt;/math&amp;gt;= error in the parameters&lt;br /&gt;
: &amp;lt;math&amp;gt;s^2 = \sum_i^n \sum_j^n \left ( \frac{\partial Y}{\partial a_i}\frac{\partial Y}{\partial a_j}\right) \sigma_{ij}=\sum_i^n \sum_j^n \left ( f_i(x)f_j(x)\right) \sigma_{ij} &amp;lt;/math&amp;gt; = error in the model's prediction&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^n \sum_j^n  x^{j+i} \sigma_{ij}&amp;lt;/math&amp;gt; If Y is a power series in x &amp;lt;math&amp;gt;(f_i(x) = x^i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Chi-Square Distribution=&lt;br /&gt;
&lt;br /&gt;
The above tools allow you to perform a least squares fit to data using high order polynomials.&lt;br /&gt;
&lt;br /&gt;
; The question though is how high in order should you go?  (ie; when should you stop adding parameters to the fit?)&lt;br /&gt;
&lt;br /&gt;
One argument is that you should stop increasing the number of parameters if they don't change much.  The parameters, using the above techniques, are correlated such that when you add another order to the fit all the parameters have the potential to change in value.  If their change is miniscule then you can ague that adding higher orders to the fit does not change the fit.  There are techniu&lt;br /&gt;
&lt;br /&gt;
A quantitative way to express the above uses the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value of the fit.  The above technique seeks to minimize &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  So if you add higher orders and more parameters but the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value does not change appreciably, you could argue that the fit is a good as you can make it with the given function.&lt;br /&gt;
&lt;br /&gt;
==Derivation==&lt;br /&gt;
&lt;br /&gt;
If you assume a series of measurements have a Gaussian parent distribution&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) = \frac{1}{\sqrt{2 \pi} \sigma} e^{-\frac{1}{2} \left ( \frac{x - \bar{x}}{\sigma}\right)^2}&amp;lt;/math&amp;gt; = probability of measuring the value &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; from a Gaussian distribution with s sample mean&amp;lt;math&amp;gt; \bar{x}&amp;lt;/math&amp;gt; from a parent distribution of with &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you break the above probability up into intervals of &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt; then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) d\bar{x}&amp;lt;/math&amp;gt; = probability that &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; lies within the interval &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you make N measurements of two variates (x_i and y_i) which may be correlated using a function with n parameters.&lt;br /&gt;
&lt;br /&gt;
== Chi-Square Cumulative Distribution==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution function is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\nu) = \frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; y(x_i)&amp;lt;/math&amp;gt; = the assumed functional dependence of the data on &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; =  N - n -1 = degrees of freedom&lt;br /&gt;
:&amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points&lt;br /&gt;
:&amp;lt;math&amp;gt;n + 1&amp;lt;/math&amp;gt; = number of parameters used in the fit (n coefficients + 1 constant term)&lt;br /&gt;
:&amp;lt;math&amp;gt; \Gamma(z) = \int_0^\infty  t^{z-1} e^{-t}\,dt\;&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above tells you the probability of getting the value of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; given the number of degrees of freedom &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; in your fit.&lt;br /&gt;
&lt;br /&gt;
While it is useful to know what the probability is of getting a value of &amp;lt;math&amp;gt;\chi^2 = x&amp;lt;/math&amp;gt; it is more useful to use the cumulative distribution function.&lt;br /&gt;
&lt;br /&gt;
The probability that the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; you received from your fit is as larger or larger than what you would get from a function described by the parent distribution is given &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty} P(x,\nu) dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A graph of &amp;lt;math&amp;gt;P(x,\nu)&amp;lt;/math&amp;gt; shows that the mean value of this function is &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow P(\chi^2 = \nu ,\nu)=\int_{\chi^2=\nu}^{\infty} P(x,\nu) dx = 0.5&amp;lt;/math&amp;gt; = probability of getting the average value for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; or larger is 0.5.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Reduced Chi-square==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced Chi-square &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2_{\nu} = \frac{\chi^2}{\nu}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the mean of &amp;lt;math&amp;gt;P(x,\nu) = \nu&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
then the mean of &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(\frac{x}{\nu},\nu) = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A reduced chi-squared distribution &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; has a mean value of 1.&lt;br /&gt;
&lt;br /&gt;
==p-Value==&lt;br /&gt;
&lt;br /&gt;
For the above fits,&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The p-value is defined as the cumulative &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution&lt;br /&gt;
&lt;br /&gt;
: p-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The p-value is the probability, under the assumption of a hypothesis H , of obtaining data at least as incompatible with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  small p-values are good.&lt;br /&gt;
&lt;br /&gt;
;The p-value is NOT&lt;br /&gt;
&lt;br /&gt;
# the probability that the null hypothesis is true. (This false conclusion is used to justify the &amp;quot;rule&amp;quot; of considering a result to be significant if its p-value is very small (near zero).) &amp;lt;br /&amp;gt; In fact, frequentist statistics does not, and cannot, attach probabilities to hypotheses. &lt;br /&gt;
# the probability that a finding is &amp;quot;merely a fluke.&amp;quot; (Again, this conclusion arises from the &amp;quot;rule&amp;quot; that small p-values indicate significant differences.) &amp;lt;br /&amp;gt; As the calculation of a p-value is based on the ''assumption'' that a finding is the product of chance alone, it patently cannot also be used to gauge the probability of that assumption being true. This is subtly different from the real meaning which is that the p-value is the chance that null hypothesis explains the result: the result might not be &amp;quot;merely a fluke,&amp;quot; ''and'' be explicable by the null hypothesis with confidence equal to the p-value.&lt;br /&gt;
#the probability of falsely rejecting the null hypothesis. &lt;br /&gt;
#the probability that a replicating experiment would not yield the same conclusion.&lt;br /&gt;
#1&amp;amp;nbsp;−&amp;amp;nbsp;(p-value) is ''not'' the probability of the alternative hypothesis being true.&lt;br /&gt;
#A determination of the significance level of the test. &amp;lt;br /&amp;gt; The significance level of a test is a value that should be decided upon by the agent interpreting the data before the data are viewed, and is compared against the p-value or any other statistic calculated after the test has been performed.&lt;br /&gt;
#an indication of  the size or importance of the observed effect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In ROOT&lt;br /&gt;
&lt;br /&gt;
 double ROOT::Math::chisquared_cdf_c (double &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;, double &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;, double x0 = 0 )		&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;=\int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
  TMath::Prob(&amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
You can turn things around the other way by defining P-value to be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: P-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\infty}^{\chi^2}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx = 1-(p-value)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here P-value would be the probability, under the assumption of a hypothesis H , of obtaining data at least as '''compatible''' with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
The P-value is the probability of observing a sample statistic as extreme as the test statistic.&lt;br /&gt;
&lt;br /&gt;
http://stattrek.com/chi-square-test/goodness-of-fit.aspx&lt;br /&gt;
&lt;br /&gt;
=F-test=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt; \chi^2&amp;lt;/math&amp;gt; test in the previous section measures both the difference between the data and the fit function as well as the difference between the fit function and the &amp;quot;parent&amp;quot; function.  The &amp;quot;parent&amp;quot; function is the true functional dependence of the data.&lt;br /&gt;
&lt;br /&gt;
The F-test can be used to determine the difference between the fit function and the parent function, to more directly test if you have come up with the correct fit function.&lt;br /&gt;
&lt;br /&gt;
== F-distribution==&lt;br /&gt;
&lt;br /&gt;
If, for example, you are comparing the Ratio of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; values from 2 different fits to the data then the function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then since &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 \equiv \sum_i^N \frac{\left (y_i-y(x_i)\right)^2}{\sigma_i^2}= \frac{s^2}{\sigma^2}&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; = constant&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and assuming &amp;lt;math&amp;gt;\sigma_1 = \sigma_2&amp;lt;/math&amp;gt; (same data set)&lt;br /&gt;
&lt;br /&gt;
one can argue that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_1}{\nu_1}} = \frac{s_1^2}{\sigma_1^2}\frac{\sigma_2^2}{s_2^2} \frac{\nu_2}{\nu_1} = \frac{\nu_2}{\nu_1} \frac{s_1^2}{s_2^2}&amp;lt;/math&amp;gt; = function that is independent of the error &amp;lt;math&amp;gt; \sigma&amp;lt;/math&amp;gt; intrinsic to the data thus the function is only comparing the fit residuals&amp;lt;math&amp;gt; (s^2)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The Function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
can be shown to follow the following probability distribution.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1, \nu_2) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
which is available in ROOT as&lt;br /&gt;
&lt;br /&gt;
 ROOT::Math::fdistribution_pdf(double x, double n, double m, double x0 = 0 )&lt;br /&gt;
&lt;br /&gt;
== The chi^2 difference test==&lt;br /&gt;
&lt;br /&gt;
In a similar fashion as above, one can define another ratio which is based on the difference between the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value using 2 different .&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} = \frac{\frac{\chi^2_1 - \chi^2_2}{\nu_1-\nu_2}}{\frac{\chi^2_1}{\nu_1}} =  \frac{\frac{\chi^2(m) - \chi^2(n)}{n-m}}{\frac{\chi^2(m)}{(N-m-1)}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under the null hypothesis that model 2 does not provide a significantly better fit than model 1, F will have an F distribution, with &amp;lt;math&amp;gt;(\nu_2 − \nu_1, \nu_1)&amp;lt;/math&amp;gt; degrees of freedom. The null hypothesis is rejected if the F calculated from the data is greater than the critical value of the F  distribution for some desired false-rejection probability (e.g. 0.05).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to determine if you need to continue adding parameters to the fit then you can consider an F-test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_1}{N-m-1}} = \frac{\Delta \chi^2}{\chi^2_{\nu}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above statistic will again follow the F-distribution &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1=1, \nu_2=N-m-1) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note: Some will define the fraction with respect to the next order fit&lt;br /&gt;
::&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_2}{N-m}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The multiple correlation coefficient test==&lt;br /&gt;
&lt;br /&gt;
While the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference F-test above is useful to evaluate the impact of adding another fit parameter, you will also want to evaluate the &amp;quot;goodness&amp;quot; of the entire fit in a manner which can be related to a correlation coefficient R (in this case it is a multiple-correlation coefficient because the fit can go beyond linear).&lt;br /&gt;
&lt;br /&gt;
I usually suggest that you do this after the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference test unless you have a theoretical model which constrains the number of fit parameters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Least Squares fit to an Arbitrary Function=&lt;br /&gt;
&lt;br /&gt;
The above Least Squares fit methods work well if your fit function has a linear dependence on the fit parameters.&lt;br /&gt;
&lt;br /&gt;
:ie; &amp;lt;math&amp;gt;y(x) =\sum_i^n a_i x^i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
such fit functions give you a set of  &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations that are linear in the parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; when you are minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  The &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation of this set of n equations is shown below.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your fit equation looks like&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) =a_1 e^{\frac{1}{2} \left (\frac{x-a_2}{a_3}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
now your set of equations minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; are non-linear with respect to the parameters.  You can't take separate the &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; term from the &amp;lt;math&amp;gt;f_k(x_i)&amp;lt;/math&amp;gt; function and thereby solve the system by inverting your matrix&lt;br /&gt;
:&amp;lt;math&amp;gt; \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
Because of this, a direct analytical solution is difficult (you need to find roots of coupled non-linear equations) and one resorts to approximation methods for the solution.&lt;br /&gt;
== Grid search==&lt;br /&gt;
&lt;br /&gt;
The fundamentals of the grid search is to basically change all parameters over some natural range to generate a hypersurface in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; and look for the smallest value of of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; that appears on the hypersurface.&lt;br /&gt;
&lt;br /&gt;
In Lab 15 you will generate this hypersurface for the simple least squares linear fit tot he Temp -vs- Voltage data in lab 14.  Your surface might look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:TF_ErrAna_Lab15.png | 200 px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As shown above, I have plotted the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; as a function of  the y-Intercept &amp;lt;math&amp;gt;(a_1)&amp;lt;/math&amp;gt; and the slope &amp;lt;math&amp;gt;(a_2)&amp;lt;/math&amp;gt;.  The minimum in this hypersurface should coincide with the values of Y-intercept=&amp;lt;math&amp;gt;a_1=-1.01&amp;lt;/math&amp;gt; and Slope=&amp;lt;math&amp;gt;a_2=0.0431&amp;lt;/math&amp;gt; from the linear regression solution.&lt;br /&gt;
&lt;br /&gt;
If we return to the beginning, the original problem is to use the max-likelihood principle on the probability function for finding the correct fit using the data. &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i -y(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
To maximize the probability of finding the best fit we need to find by minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right ) \frac{\partial \left( - y(x_i) \right)}{\partial a_k} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively you could also express \chi^2 in terms of the probability distributions as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n)  \propto e^{- \frac{1}{2}\chi^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Grid search method==&lt;br /&gt;
&lt;br /&gt;
The grid search method relies on the independence of the fit parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt;.    The search starts by selecting initial values for all parameters and then searching for a &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; minimum for one of the fit parameters.  You then set the parameter to the determined value and repeat the procedure on the next parameter.  You keep repeating until a stable value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found.&lt;br /&gt;
&lt;br /&gt;
Obviously, this method strongly depends on the initial values selected for the parameters.&lt;br /&gt;
&lt;br /&gt;
==Parameter Errors==&lt;br /&gt;
&lt;br /&gt;
Returning back to the equation&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
it may be observed that &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; represents the error in the parameter &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; and that the error alters &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once a minimum is found, the parabolic nature of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;  dependence on a single parameter is such that an increase in 1 standard deviation in the parameter results in an increase in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can turn this to determine the error in the fit parameter by determining how much the parameter must increase (or decrease) in order to increase &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Gradient Search Method==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Gradient search method improves on the Grid search method by attempting to search in a direction towards the minima as determined by simultaneous changes in all parameters.  The change in each parameter may differ in magnitude and is adjustable for each parameter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference  Go Back] [[Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91706</id>
		<title>TF ErrorAna StatInference</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91706"/>
		<updated>2014-03-21T19:17:16Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* The Method of Determinants */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Statistical Inference&lt;br /&gt;
=Frequentist -vs- Bayesian Inference=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When it comes to testing a hypothesis, there are  two dominant philosophies known as a Frequentist or a Bayesian perspective.&lt;br /&gt;
&lt;br /&gt;
The dominant discussion for this class will be from the Frequentist perspective.&lt;br /&gt;
&lt;br /&gt;
== frequentist statistical inference==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made using a null-hypothesis test; that is, one that answers the question, Assuming that the null hypothesis is true, what is the probability of observing a value for the test statistic that is at least as extreme as the value that was actually observed?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The relative frequency of occurrence of an event, in a number of repetitions of the experiment, is a measure of the probability of that event.&lt;br /&gt;
Thus, if &amp;lt;math&amp;gt;n_t&amp;lt;/math&amp;gt; is the total number of trials and &amp;lt;math&amp;gt;n_x&amp;lt;/math&amp;gt; is the number of trials where the event x occurred, the probability P(x) of the event occurring will be approximated by the relative frequency as follows:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) \approx \frac{n_x}{n_t}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Bayesian inference.==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made by using evidence or observations  to update or to newly infer the probability that a hypothesis may be true. The name &amp;quot;Bayesian&amp;quot; comes from the frequent use of Bayes' theorem in the inference process.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem relates the conditional probability, conditional and marginal probability, marginal probabilities of events ''A'' and ''B'', where ''B'' has a non-vanishing probability:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}\,\! &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Each term in Bayes' theorem has a conventional name:&lt;br /&gt;
* P(''A'') is the prior probability or marginal probability of ''A''. It is &amp;quot;prior&amp;quot; in the sense that it does not take into account any information about ''B''.&lt;br /&gt;
* P(''B'') is the prior or marginal probability of ''B'', and acts as a normalizing constant. &lt;br /&gt;
* P(''A''|''B'') is the conditional probability of ''A'', given ''B''. It is also called the posterior probability because it is derived from or depends upon the specified value of ''B''.&lt;br /&gt;
* P(''B''|''A'') is the conditional probability of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem in this form gives a mathematical representation of how the conditional probabability of event ''A'' given ''B'' is related to the converse conditional probabablity of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
Suppose there is a school having 60% boys and 40% girls as students. &lt;br /&gt;
&lt;br /&gt;
The female students wear trousers or skirts in equal numbers; the boys all wear trousers. &lt;br /&gt;
&lt;br /&gt;
An observer sees a (random) student from a distance; all the observer can see is that this student is wearing trousers. &lt;br /&gt;
&lt;br /&gt;
What is the probability this student is a girl? &lt;br /&gt;
&lt;br /&gt;
The correct answer can be computed using Bayes' theorem.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P(A) \equiv&amp;lt;/math&amp;gt; probability that  the student observed is a girl = 0.4&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B) \equiv&amp;lt;/math&amp;gt; probability  that the student observed is wearing trousers = 60+20/100 = 0.8&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B|A) \equiv&amp;lt;/math&amp;gt; probability the student is wearing trousers given that the student is a girl&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A|B) \equiv&amp;lt;/math&amp;gt; probability the student is a girl given that the student is wearing trousers&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(B|A) =0.5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B|A) P(A)}{P(B)} = \frac{0.5 \times 0.4}{0.8} = 0.25.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Method of Maximum Likelihood=&lt;br /&gt;
&lt;br /&gt;
;The principle of maximum likelihood is the cornerstone of Frequentist based hypothesis testing and may be written as&lt;br /&gt;
:The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observation is a maximum.&lt;br /&gt;
&lt;br /&gt;
= Least Squares Fit to a Line=&lt;br /&gt;
&lt;br /&gt;
== Applying the Method of Maximum Likelihood==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our object is to find the best straight line fit for an expected linear relationship between dependent variate &amp;lt;math&amp;gt;(y)&amp;lt;/math&amp;gt;  and independent variate &amp;lt;math&amp;gt;(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we let &amp;lt;math&amp;gt;y_0(x)&amp;lt;/math&amp;gt; represent the &amp;quot;true&amp;quot; linear relationship between independent variate &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and dependent variate &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_o(x) = A + B x&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i = \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A,B) = \Pi \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \left ( \frac{1}{\sigma \sqrt{2 \pi}}\right )^N e^{- \frac{1}{2} \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt; = Max&lt;br /&gt;
 &lt;br /&gt;
The maximum probability will result in the best values for &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\chi^2 = \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2 = \sum \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2&amp;lt;/math&amp;gt; = Min&lt;br /&gt;
&lt;br /&gt;
The min for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; occurs when the function is a minimum for both parameters A &amp;amp; B : ie&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \sum \frac{ \partial}{\partial A} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \sum \frac{ \partial}{\partial B} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;If &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt; : All variances are the same  (weighted fits don't make this assumption)&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial A} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial B} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum x_i \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum  x_i \left( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above equations represent a set of simultaneous of 2 equations and 2 unknowns which can be solved.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum y_i = \sum A + B \sum x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum x_i y_i = A \sum x_i + B \sum x_i^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} \sum y_i \\ \sum x_i y_i \end{array} \right) = \left( \begin{array}{cc} N &amp;amp; \sum x_i\\&lt;br /&gt;
\sum x_i &amp;amp; \sum x_i^2 \end{array} \right)\left( \begin{array}{c} A \\ B \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The Method of Determinants ===&lt;br /&gt;
for the matrix problem:&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} y_1 \\ y_2 \end{array} \right) = \left( \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right)\left( \begin{array}{c} x_1 \\ x_2 \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the above can be written as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_1 = a_{11} x_1 + a_{12} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;y_2 = a_{21} x_1 + a_{22} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
solving for &amp;lt;math&amp;gt;x_1&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;y_1&amp;lt;/math&amp;gt; is known&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;a_{22} (y_1 = a_{11} x_1 + a_{12} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-a_{12} (y_2 = a_{21} x_1 + a_{22} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow a_{22} y_1 - a_{12} y_2 = (a_{11}a_{22} - a_{12}a_{21}) x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| = \left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
: &amp;lt;math&amp;gt;x_1 = \frac{\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt; similarly &amp;lt;math&amp;gt;x_2 = \frac{\left| \begin{array}{cc}  a_{11} &amp;amp; y_1 \\  a_{21} &amp;amp; y_2  \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Solutions exist as long as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apply the method of determinant for the maximum likelihood problem above&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the uncertainty in all the measurements is not the same then we need to insert &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; back into the system of equations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Uncertainty in the Linear Fit parameters==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
By definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}&amp;lt;/math&amp;gt;  : there are 2 parameters and N data points which translate to (N-2) degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
The least square fit ( assuming equal &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;) has the following solution for the parameters A &amp;amp; B as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\sum y_i \sum x_i^2 - \sum x_i \sum x_i y_i  }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \frac{(1) \sum x_i^2 - x_j\sum x_i   }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt; only the &amp;lt;math&amp;gt;y_j&amp;lt;/math&amp;gt; term survives &lt;br /&gt;
:&amp;lt;math&amp;gt; = D \left ( \sum x_i^2 - x_j\sum x_i \right)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D \equiv \frac{1}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}=\frac{1}{N\sum x_i^2 - \sum x_i \sum x_i }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_{j=1}^N \sigma_j^2 \left ( D \left ( \sum x_i^2 - x_j\sum x_i \right) \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2 - x_j\sum x_i \right )^2&amp;lt;/math&amp;gt; : Assume &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2\right )^2  + \left (x_j\sum x_i \right )^2 - 2 \left ( \sum x_i^2 x_j \sum x_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  \sum_{j=1}^N  \left ( \sum x_i^2\right ) +  \sum_{j=1}^N x_j^2  -  2 \sum x_i \sum_{j=1}^N x_j  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum x_i \sum_{j=1}^N x_j  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sum x_i \sum_{j=1}^N x_j \approx \sum_{j=1}^N x_j^2&amp;lt;/math&amp;gt; Both sums are over the number of observations &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum_{j=1}^N x_j^2  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2 \frac{1}{D}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \sigma^2  \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we redefine our origin in the linear plot so the line is centered a x=0 then &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum{x_i} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2} = \frac{\sum x_i^2 }{N\sum x_i^2 } = \frac{1}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{1}{N} = \frac{\sigma^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: The parameter A is the y-intercept so it makes some intuitive sense that the error in the Y -intercept would be dominated by the statistical error in Y&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in B===&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}= \frac{\partial}{\partial y_j} D \left ( N\sum x_i y_i -\sum x_i \sum y_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;=  D \left ( N x_j - \sum x_i \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 D^2 \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;\sigma_j = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N^2 x_j^2 - 2N x_j \sum x_i + \sum x_i^2\right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum_{j=1}^Nx_j^2 - 2N \sum x_i \sum_{j=1}^N x_j  + \sum x_i^2 \sum_{j=1}^N  \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum x_i^2 - 2N \sum x_i \sum_{j=1}^N x_j  + N \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - 2 \sum x_i \sum_{j=1}^N x_j  +  \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = N D^2 \sigma^2 \frac{1}{D} = ND \sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_B^2= \frac{N \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}} {N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Linear Fit with error==&lt;br /&gt;
&lt;br /&gt;
From above we know that if each independent measurement has a different error &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; then the fit parameters are given by &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D = \frac{1}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right| }= &lt;br /&gt;
\frac{1}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [ \sum\frac{ y_i}{\sigma_i^2} \sum\frac{ x_i^2}{\sigma_i^2}- \sum\frac{ x_i}{\sigma_i^2}  \sum\frac{ x_i y_i}{\sigma_i^2}  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ] =  \sum_{j=1}^N \left [ \sigma_j^2  D^2 \left ( \frac{ 1}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \sigma_j^2  \left [  \frac{ 1}{\sigma_j^4} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \frac{ x_j}{\sigma_j^4} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \frac{ x_j^2}{\sigma_j^4} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2   \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ 1}{\sigma_i^2} \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 -  \left( \sum \frac{ x_j}{\sigma_j^2} \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= D    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)  = \frac{ \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) }{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Compare with the unweighted error&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in B ===&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [\sum \frac{1}{\sigma_i^2}\sum \frac{x_i y_i}{\sigma_i^2}  - \sum \frac{ y_i}{\sigma_i^2}\sum \frac{x_i}{\sigma_i^2}   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_{j=1}^N \left [ \sigma_j^2 \left (  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \left [  \frac{ 1}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} + \left (\frac{1}{\sigma_j}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} + \left (\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 1 \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D \sum_{j=1}^N \frac{ 1}{\sigma_j^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_B^2 = \frac{  \sum\frac{ 1}{\sigma_i^2}}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Correlation Probability==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the Linear Fit has been performed, the next step will be to determine a probability that the Fit is actually describing the data.&lt;br /&gt;
&lt;br /&gt;
The Correlation Probability (R) is one method used to try and determine this probability.&lt;br /&gt;
&lt;br /&gt;
This method evaluates the &amp;quot;slope&amp;quot; parameter to determine if there is a correlation between the dependent and independent variables , x and y.&lt;br /&gt;
&lt;br /&gt;
The liner fit above was done to minimize \chi^2 for the following model&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y = A + Bx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What if we turn this  equation around such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = A^{\prime} + B^{\prime}y&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;B^{\prime} =0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is complete correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  &lt;br /&gt;
:&amp;lt;math&amp;gt;A = -\frac{A^{\prime}}{B^{\prime}}&amp;lt;/math&amp;gt;        and     &amp;lt;math&amp;gt;B = \frac{1}{B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: and &amp;lt;math&amp;gt;BB^{\prime} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So one can define a metric BB^{\prime} which has the natural range between 0 and 1 such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;R \equiv \sqrt{B B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
since&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and one can show that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B^{\prime} = \frac{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum y_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum y_i  &amp;amp; \sum y_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;R = \sqrt{ \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  } \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=   \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{\sqrt{\left( N\sum x_i^2 - \sum x_i \sum x_i  \right ) \left (N\sum y_i^2 - \sum y_i \sum y_i\right)  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:The correlation coefficient (R) CAN'T be used to indicate the degree of correlation.  The probability distribution &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; can be derived from a 2-D gaussian but knowledge of the correlation coefficient of the parent population &amp;lt;math&amp;gt;(\rho)&amp;lt;/math&amp;gt; is required to evaluate R of the sample distribution.&lt;br /&gt;
&lt;br /&gt;
Instead one assumes a correlation of &amp;lt;math&amp;gt;\rho=0&amp;lt;/math&amp;gt; in the parent distribution and then compares the sample value of &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; with what you would get if there were no correlation.&lt;br /&gt;
&lt;br /&gt;
The smaller &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; is the more likely that the data are correlated and that the linear fit is correct.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_R(R,\nu) = \frac{1}{\sqrt{\pi}} \frac{\Gamma\left ( \frac{\nu+1}{2}\right )}{\Gamma \left ( \frac{\nu}{2}\right)} \left( 1-R^2\right)^{\left( \frac{\nu-2}{2}\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
= Probability that any random sample of UNCORRELATED data would yield the correlation coefficient &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\Gamma(x) = \int_0^{\infty} t^{x-1}e^{-t} dt&amp;lt;/math&amp;gt;&lt;br /&gt;
 (ROOT::Math::tgamma(double x) )&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu=N-2&amp;lt;/math&amp;gt; = number of degrees of freedom = Number of data points - Number of parameters in fit function&lt;br /&gt;
&lt;br /&gt;
Derived in &amp;quot;Pugh and Winslow, The Analysis of Physical Measurement, Addison-Wesley Publishing, 1966.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Least Squares fit to a Polynomial=&lt;br /&gt;
&lt;br /&gt;
Let's assume we wish to now fit a polynomial instead of a straight line to the data.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) = \sum_{j=0}^{n} a_j x^{n}=\sum_{j=0}^{n} a_j f_j(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f_j(x) =&amp;lt;/math&amp;gt; a function which does not depend on &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i(a_0,a_1, \cdots ,a_n) = \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;a_n&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once again the probability is maximized when the numerator of the exponential is a minimum&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
The minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \frac{\partial \left( - \sum_{j=0}^{n} a_j f_j(x_i) \right)}{\partial a_k}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2 \sum_i^N  \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2\sum_i^N  \frac{1}{\sigma_i^2} \left (  -  f_k(x_i) \right) \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) =0&amp;lt;/math&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
: &amp;lt;math&amp;gt;\Rightarrow \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =  \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}  \sum_{j=0}^{n} a_j f_j(x_i)=  \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You now have a system of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; coupled equations for the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; with each equation summing over the &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; measurements.&lt;br /&gt;
&lt;br /&gt;
The first equation &amp;lt;math&amp;gt;(f_1)&amp;lt;/math&amp;gt; looks like this&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_i^N f_1(x_i) \frac{y_i}{\sigma_i^2} = \sum_i^N \frac{f_1(x_i)}{\sigma_i^2} \left ( a_1 f_1(x_i) + a_2 f_2(x_i) + \cdots a_n f_n(x_i)\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could use the method of determinants as we did to find the parameters &amp;lt;math&amp;gt;(a_n)&amp;lt;/math&amp;gt; for a linear fit but it is more convenient to use matrices in a technique referred to as regression analysis&lt;br /&gt;
&lt;br /&gt;
==Regression Analysis==&lt;br /&gt;
&lt;br /&gt;
The parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; in the previous section are linear parameters to a general function which may be a polynomial.&lt;br /&gt;
&lt;br /&gt;
The system of equations is composed of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations where the &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation is given as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
may be represented in matrix form as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\beta_k= \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{kj} = \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or in matrix form&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha} = \left ( \begin{matrix} \alpha_{11}  &amp;amp; \alpha_{12} &amp;amp; \cdots &amp;amp; \alpha_{1j} \\ \alpha_{21}  &amp;amp; \alpha_{22}&amp;amp;\cdots&amp;amp;\alpha_{2j} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1} &amp;amp;\alpha_{k2} &amp;amp;\cdots &amp;amp;\alpha_{kj}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
; the objective is to find the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
: To find &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; just invert the matrix&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \tilde{\beta} = \tilde{a} \tilde{\alpha} \right) \tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{\alpha}\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \Rightarrow  \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Thus if you invert the matrix &amp;lt;math&amp;gt;\tilde{\alpha}&amp;lt;/math&amp;gt; you find &amp;lt;math&amp;gt;\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt; and as a result the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Matrix inversion==&lt;br /&gt;
&lt;br /&gt;
The first thing to note is that for the inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A})&amp;lt;/math&amp;gt; to exist its determinant can not be zero&lt;br /&gt;
: &amp;lt;math&amp;gt;\left |\tilde{A} \right | \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A}^{-1})&amp;lt;/math&amp;gt; is defined such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{A}^{-1} = \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we divide both sides by the matrix &amp;lt;math&amp;gt;\tilde {A}&amp;lt;/math&amp;gt; then we have&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A}^{-1} = \frac{\tilde{1}}{\tilde{A} }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above ratio of the unity matrix to matrix &amp;lt;math&amp;gt;\tilde{A}&amp;lt;/math&amp;gt; is always equal to &amp;lt;math&amp;gt;\tilde{A}^{-1}&amp;lt;/math&amp;gt; as long as both the numerator and denominator are multiplied by the same constant factor.&lt;br /&gt;
&lt;br /&gt;
If we do such operations we can transform the ratio such that the denominator has the unity matrix and then the numerator will have the inverse matrix.  &lt;br /&gt;
&lt;br /&gt;
This is the principle of Gauss-Jordan Elimination.&lt;br /&gt;
&lt;br /&gt;
===Gauss-Jordan Elimination===&lt;br /&gt;
If Gauss–Jordan elimination is applied on a square matrix, it can be used to calculate the inverse matrix. This can be done by augmenting the square matrix with the identity matrix of the same dimensions, and through the following matrix operations:&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{1} \Rightarrow&lt;br /&gt;
 \tilde{1} \tilde{A}^{-1} .&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the original square matrix, &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;, is given by the following expression:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 \\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 \\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, after augmenting by the identity, the following is obtained:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A}\tilde{1} = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By performing elementary row operations on the &amp;lt;math&amp;gt;\tilde{A}\tilde{1}&amp;lt;/math&amp;gt; matrix until it reaches reduced row echelon form, the following is the final result:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1}\tilde{A}^{-1}  = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 &amp;amp; \frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1 &amp;amp; \frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix augmentation can now be undone, which gives the following:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}\qquad&lt;br /&gt;
 \tilde{A}^{-1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
\frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
\frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
\frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
:&amp;lt;math&amp;gt; &lt;br /&gt;
 \tilde{A}^{-1} =\frac{1}{4}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}=\frac{1}{det(A)}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
A matrix is non-singular (meaning that it has an inverse matrix) if and only if the identity matrix can be obtained using only elementary row operations.&lt;br /&gt;
&lt;br /&gt;
== Error Matrix==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
Where the definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - \sum_{j=0}^{n} a_j f_j(x_i) \right)^2}{N -n}&amp;lt;/math&amp;gt;  : there are &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; parameters and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; data points which translate to &amp;lt;math&amp;gt;(N-n)&amp;lt;/math&amp;gt; degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
Applying this for the parameter &amp;lt;math&amp;gt;a_k&amp;lt;/math&amp;gt; indicates that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k}^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial a_k}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;But what if there are covariances?&lt;br /&gt;
In that case the following general expression applies&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = &amp;lt;/math&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha}^{-1} = \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n) = ( \beta_1, \beta_2, \cdots , \beta_n) \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow  a_k = \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = \frac{\partial }{\partial y_i} \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\partial }{\partial y_i} \sum_j^n \left( \sum_i^N f_j(x_i) \frac{y_i}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt; :only one &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; in the sum over &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; survives the derivative&lt;br /&gt;
&lt;br /&gt;
similarly&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_l}{\partial y_i} = \sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
substituting&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^N \left [ \sigma_i^2  \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}\sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right)\alpha_{pl}^{-1} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;math&amp;gt; \sigma_i^2&amp;lt;/math&amp;gt; term appears on the  top and bottom.&lt;br /&gt;
;Move the outer most sum to the inside&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 =  \sum_j^n \left(   \alpha_{jk}^{-1}\sum_p^n \sum_i^N  \frac{f_j(x_i)  f_p(x_i)}{\sigma_i^2} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n  \alpha_{jk}^{-1}\sum_p^n \left(  \alpha_{jp} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n \alpha_{jk}^{-1}\tilde{1}_{jl}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{1}_{jl}&amp;lt;/math&amp;gt;  = the &amp;lt;math&amp;gt;j,l&amp;lt;/math&amp;gt; element of the unity matrix = 1&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{jk} = \alpha_{kj} &amp;lt;/math&amp;gt; : the matrix is symmetric.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sigma_{a_k,a_l}^2 =  \sum_j^n \alpha_{kj}^{-1}\tilde{1}_{jl}= \alpha_{kl}^{-1}&amp;lt;/math&amp;gt; = Covariance/Error matrix element&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse matrix &amp;lt;math&amp;gt;\alpha_{kl}^{-1}&amp;lt;/math&amp;gt; tells you the variance and covariance for the calculation of the total error.&lt;br /&gt;
&lt;br /&gt;
;Remember&lt;br /&gt;
:&amp;lt;math&amp;gt;Y = \sum_i^n a_i f_i(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_i}^2 = \alpha_{ii}^{-1}&amp;lt;/math&amp;gt;= error in the parameters&lt;br /&gt;
: &amp;lt;math&amp;gt;s^2 = \sum_i^n \sum_j^n \left ( \frac{\partial Y}{\partial a_i}\frac{\partial Y}{\partial a_j}\right) \sigma_{ij}=\sum_i^n \sum_j^n \left ( f_i(x)f_j(x)\right) \sigma_{ij} &amp;lt;/math&amp;gt; = error in the model's prediction&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^n \sum_j^n  x^{j+i} \sigma_{ij}&amp;lt;/math&amp;gt; If Y is a power series in x &amp;lt;math&amp;gt;(f_i(x) = x^i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Chi-Square Distribution=&lt;br /&gt;
&lt;br /&gt;
The above tools allow you to perform a least squares fit to data using high order polynomials.&lt;br /&gt;
&lt;br /&gt;
; The question though is how high in order should you go?  (ie; when should you stop adding parameters to the fit?)&lt;br /&gt;
&lt;br /&gt;
One argument is that you should stop increasing the number of parameters if they don't change much.  The parameters, using the above techniques, are correlated such that when you add another order to the fit all the parameters have the potential to change in value.  If their change is miniscule then you can ague that adding higher orders to the fit does not change the fit.  There are techniu&lt;br /&gt;
&lt;br /&gt;
A quantitative way to express the above uses the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value of the fit.  The above technique seeks to minimize &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  So if you add higher orders and more parameters but the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value does not change appreciably, you could argue that the fit is a good as you can make it with the given function.&lt;br /&gt;
&lt;br /&gt;
==Derivation==&lt;br /&gt;
&lt;br /&gt;
If you assume a series of measurements have a Gaussian parent distribution&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) = \frac{1}{\sqrt{2 \pi} \sigma} e^{-\frac{1}{2} \left ( \frac{x - \bar{x}}{\sigma}\right)^2}&amp;lt;/math&amp;gt; = probability of measuring the value &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; from a Gaussian distribution with s sample mean&amp;lt;math&amp;gt; \bar{x}&amp;lt;/math&amp;gt; from a parent distribution of with &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you break the above probability up into intervals of &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt; then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) d\bar{x}&amp;lt;/math&amp;gt; = probability that &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; lies within the interval &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you make N measurements of two variates (x_i and y_i) which may be correlated using a function with n parameters.&lt;br /&gt;
&lt;br /&gt;
== Chi-Square Cumulative Distribution==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution function is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\nu) = \frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; y(x_i)&amp;lt;/math&amp;gt; = the assumed functional dependence of the data on &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; =  N - n -1 = degrees of freedom&lt;br /&gt;
:&amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points&lt;br /&gt;
:&amp;lt;math&amp;gt;n + 1&amp;lt;/math&amp;gt; = number of parameters used in the fit (n coefficients + 1 constant term)&lt;br /&gt;
:&amp;lt;math&amp;gt; \Gamma(z) = \int_0^\infty  t^{z-1} e^{-t}\,dt\;&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above tells you the probability of getting the value of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; given the number of degrees of freedom &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; in your fit.&lt;br /&gt;
&lt;br /&gt;
While it is useful to know what the probability is of getting a value of &amp;lt;math&amp;gt;\chi^2 = x&amp;lt;/math&amp;gt; it is more useful to use the cumulative distribution function.&lt;br /&gt;
&lt;br /&gt;
The probability that the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; you received from your fit is as larger or larger than what you would get from a function described by the parent distribution is given &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty} P(x,\nu) dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A graph of &amp;lt;math&amp;gt;P(x,\nu)&amp;lt;/math&amp;gt; shows that the mean value of this function is &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow P(\chi^2 = \nu ,\nu)=\int_{\chi^2=\nu}^{\infty} P(x,\nu) dx = 0.5&amp;lt;/math&amp;gt; = probability of getting the average value for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; or larger is 0.5.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Reduced Chi-square==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced Chi-square &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2_{\nu} = \frac{\chi^2}{\nu}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the mean of &amp;lt;math&amp;gt;P(x,\nu) = \nu&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
then the mean of &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(\frac{x}{\nu},\nu) = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A reduced chi-squared distribution &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; has a mean value of 1.&lt;br /&gt;
&lt;br /&gt;
==p-Value==&lt;br /&gt;
&lt;br /&gt;
For the above fits,&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The p-value is defined as the cumulative &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution&lt;br /&gt;
&lt;br /&gt;
: p-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The p-value is the probability, under the assumption of a hypothesis H , of obtaining data at least as incompatible with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  small p-values are good.&lt;br /&gt;
&lt;br /&gt;
;The p-value is NOT&lt;br /&gt;
&lt;br /&gt;
# the probability that the null hypothesis is true. (This false conclusion is used to justify the &amp;quot;rule&amp;quot; of considering a result to be significant if its p-value is very small (near zero).) &amp;lt;br /&amp;gt; In fact, frequentist statistics does not, and cannot, attach probabilities to hypotheses. &lt;br /&gt;
# the probability that a finding is &amp;quot;merely a fluke.&amp;quot; (Again, this conclusion arises from the &amp;quot;rule&amp;quot; that small p-values indicate significant differences.) &amp;lt;br /&amp;gt; As the calculation of a p-value is based on the ''assumption'' that a finding is the product of chance alone, it patently cannot also be used to gauge the probability of that assumption being true. This is subtly different from the real meaning which is that the p-value is the chance that null hypothesis explains the result: the result might not be &amp;quot;merely a fluke,&amp;quot; ''and'' be explicable by the null hypothesis with confidence equal to the p-value.&lt;br /&gt;
#the probability of falsely rejecting the null hypothesis. &lt;br /&gt;
#the probability that a replicating experiment would not yield the same conclusion.&lt;br /&gt;
#1&amp;amp;nbsp;−&amp;amp;nbsp;(p-value) is ''not'' the probability of the alternative hypothesis being true.&lt;br /&gt;
#A determination of the significance level of the test. &amp;lt;br /&amp;gt; The significance level of a test is a value that should be decided upon by the agent interpreting the data before the data are viewed, and is compared against the p-value or any other statistic calculated after the test has been performed.&lt;br /&gt;
#an indication of  the size or importance of the observed effect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In ROOT&lt;br /&gt;
&lt;br /&gt;
 double ROOT::Math::chisquared_cdf_c (double &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;, double &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;, double x0 = 0 )		&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;=\int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
  TMath::Prob(&amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
You can turn things around the other way by defining P-value to be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: P-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\infty}^{\chi^2}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx = 1-(p-value)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here P-value would be the probability, under the assumption of a hypothesis H , of obtaining data at least as '''compatible''' with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
The P-value is the probability of observing a sample statistic as extreme as the test statistic.&lt;br /&gt;
&lt;br /&gt;
http://stattrek.com/chi-square-test/goodness-of-fit.aspx&lt;br /&gt;
&lt;br /&gt;
=F-test=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt; \chi^2&amp;lt;/math&amp;gt; test in the previous section measures both the difference between the data and the fit function as well as the difference between the fit function and the &amp;quot;parent&amp;quot; function.  The &amp;quot;parent&amp;quot; function is the true functional dependence of the data.&lt;br /&gt;
&lt;br /&gt;
The F-test can be used to determine the difference between the fit function and the parent function, to more directly test if you have come up with the correct fit function.&lt;br /&gt;
&lt;br /&gt;
== F-distribution==&lt;br /&gt;
&lt;br /&gt;
If, for example, you are comparing the Ratio of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; values from 2 different fits to the data then the function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then since &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 \equiv \sum_i^N \frac{\left (y_i-y(x_i)\right)^2}{\sigma_i^2}= \frac{s^2}{\sigma^2}&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; = constant&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and assuming &amp;lt;math&amp;gt;\sigma_1 = \sigma_2&amp;lt;/math&amp;gt; (same data set)&lt;br /&gt;
&lt;br /&gt;
one can argue that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_1}{\nu_1}} = \frac{s_1^2}{\sigma_1^2}\frac{\sigma_2^2}{s_2^2} \frac{\nu_2}{\nu_1} = \frac{\nu_2}{\nu_1} \frac{s_1^2}{s_2^2}&amp;lt;/math&amp;gt; = function that is independent of the error &amp;lt;math&amp;gt; \sigma&amp;lt;/math&amp;gt; intrinsic to the data thus the function is only comparing the fit residuals&amp;lt;math&amp;gt; (s^2)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The Function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
can be shown to follow the following probability distribution.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1, \nu_2) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
which is available in ROOT as&lt;br /&gt;
&lt;br /&gt;
 ROOT::Math::fdistribution_pdf(double x, double n, double m, double x0 = 0 )&lt;br /&gt;
&lt;br /&gt;
== The chi^2 difference test==&lt;br /&gt;
&lt;br /&gt;
In a similar fashion as above, one can define another ratio which is based on the difference between the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value using 2 different .&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} = \frac{\frac{\chi^2_1 - \chi^2_2}{\nu_1-\nu_2}}{\frac{\chi^2_1}{\nu_1}} =  \frac{\frac{\chi^2(m) - \chi^2(n)}{n-m}}{\frac{\chi^2(m)}{(N-m-1)}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under the null hypothesis that model 2 does not provide a significantly better fit than model 1, F will have an F distribution, with &amp;lt;math&amp;gt;(\nu_2 − \nu_1, \nu_1)&amp;lt;/math&amp;gt; degrees of freedom. The null hypothesis is rejected if the F calculated from the data is greater than the critical value of the F  distribution for some desired false-rejection probability (e.g. 0.05).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to determine if you need to continue adding parameters to the fit then you can consider an F-test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_1}{N-m-1}} = \frac{\Delta \chi^2}{\chi^2_{\nu}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above statistic will again follow the F-distribution &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1=1, \nu_2=N-m-1) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note: Some will define the fraction with respect to the next order fit&lt;br /&gt;
::&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_2}{N-m}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The multiple correlation coefficient test==&lt;br /&gt;
&lt;br /&gt;
While the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference F-test above is useful to evaluate the impact of adding another fit parameter, you will also want to evaluate the &amp;quot;goodness&amp;quot; of the entire fit in a manner which can be related to a correlation coefficient R (in this case it is a multiple-correlation coefficient because the fit can go beyond linear).&lt;br /&gt;
&lt;br /&gt;
I usually suggest that you do this after the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference test unless you have a theoretical model which constrains the number of fit parameters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Least Squares fit to an Arbitrary Function=&lt;br /&gt;
&lt;br /&gt;
The above Least Squares fit methods work well if your fit function has a linear dependence on the fit parameters.&lt;br /&gt;
&lt;br /&gt;
:ie; &amp;lt;math&amp;gt;y(x) =\sum_i^n a_i x^i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
such fit functions give you a set of  &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations that are linear in the parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; when you are minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  The &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation of this set of n equations is shown below.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your fit equation looks like&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) =a_1 e^{\frac{1}{2} \left (\frac{x-a_2}{a_3}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
now your set of equations minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; are non-linear with respect to the parameters.  You can't take separate the &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; term from the &amp;lt;math&amp;gt;f_k(x_i)&amp;lt;/math&amp;gt; function and thereby solve the system by inverting your matrix&lt;br /&gt;
:&amp;lt;math&amp;gt; \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
Because of this, a direct analytical solution is difficult (you need to find roots of coupled non-linear equations) and one resorts to approximation methods for the solution.&lt;br /&gt;
== Grid search==&lt;br /&gt;
&lt;br /&gt;
The fundamentals of the grid search is to basically change all parameters over some natural range to generate a hypersurface in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; and look for the smallest value of of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; that appears on the hypersurface.&lt;br /&gt;
&lt;br /&gt;
In Lab 15 you will generate this hypersurface for the simple least squares linear fit tot he Temp -vs- Voltage data in lab 14.  Your surface might look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:TF_ErrAna_Lab15.png | 200 px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As shown above, I have plotted the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; as a function of  the y-Intercept &amp;lt;math&amp;gt;(a_1)&amp;lt;/math&amp;gt; and the slope &amp;lt;math&amp;gt;(a_2)&amp;lt;/math&amp;gt;.  The minimum in this hypersurface should coincide with the values of Y-intercept=&amp;lt;math&amp;gt;a_1=-1.01&amp;lt;/math&amp;gt; and Slope=&amp;lt;math&amp;gt;a_2=0.0431&amp;lt;/math&amp;gt; from the linear regression solution.&lt;br /&gt;
&lt;br /&gt;
If we return to the beginning, the original problem is to use the max-likelihood principle on the probability function for finding the correct fit using the data. &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i -y(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
To maximize the probability of finding the best fit we need to find by minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right ) \frac{\partial \left( - y(x_i) \right)}{\partial a_k} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively you could also express \chi^2 in terms of the probability distributions as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n)  \propto e^{- \frac{1}{2}\chi^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Grid search method==&lt;br /&gt;
&lt;br /&gt;
The grid search method relies on the independence of the fit parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt;.    The search starts by selecting initial values for all parameters and then searching for a &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; minimum for one of the fit parameters.  You then set the parameter to the determined value and repeat the procedure on the next parameter.  You keep repeating until a stable value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found.&lt;br /&gt;
&lt;br /&gt;
Obviously, this method strongly depends on the initial values selected for the parameters.&lt;br /&gt;
&lt;br /&gt;
==Parameter Errors==&lt;br /&gt;
&lt;br /&gt;
Returning back to the equation&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
it may be observed that &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; represents the error in the parameter &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; and that the error alters &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once a minimum is found, the parabolic nature of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;  dependence on a single parameter is such that an increase in 1 standard deviation in the parameter results in an increase in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can turn this to determine the error in the fit parameter by determining how much the parameter must increase (or decrease) in order to increase &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Gradient Search Method==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Gradient search method improves on the Grid search method by attempting to search in a direction towards the minima as determined by simultaneous changes in all parameters.  The change in each parameter may differ in magnitude and is adjustable for each parameter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference  Go Back] [[Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91705</id>
		<title>TF ErrorAna StatInference</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91705"/>
		<updated>2014-03-21T19:16:57Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* The Method of Determinants */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Statistical Inference&lt;br /&gt;
=Frequentist -vs- Bayesian Inference=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When it comes to testing a hypothesis, there are  two dominant philosophies known as a Frequentist or a Bayesian perspective.&lt;br /&gt;
&lt;br /&gt;
The dominant discussion for this class will be from the Frequentist perspective.&lt;br /&gt;
&lt;br /&gt;
== frequentist statistical inference==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made using a null-hypothesis test; that is, one that answers the question, Assuming that the null hypothesis is true, what is the probability of observing a value for the test statistic that is at least as extreme as the value that was actually observed?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The relative frequency of occurrence of an event, in a number of repetitions of the experiment, is a measure of the probability of that event.&lt;br /&gt;
Thus, if &amp;lt;math&amp;gt;n_t&amp;lt;/math&amp;gt; is the total number of trials and &amp;lt;math&amp;gt;n_x&amp;lt;/math&amp;gt; is the number of trials where the event x occurred, the probability P(x) of the event occurring will be approximated by the relative frequency as follows:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) \approx \frac{n_x}{n_t}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Bayesian inference.==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made by using evidence or observations  to update or to newly infer the probability that a hypothesis may be true. The name &amp;quot;Bayesian&amp;quot; comes from the frequent use of Bayes' theorem in the inference process.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem relates the conditional probability, conditional and marginal probability, marginal probabilities of events ''A'' and ''B'', where ''B'' has a non-vanishing probability:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}\,\! &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Each term in Bayes' theorem has a conventional name:&lt;br /&gt;
* P(''A'') is the prior probability or marginal probability of ''A''. It is &amp;quot;prior&amp;quot; in the sense that it does not take into account any information about ''B''.&lt;br /&gt;
* P(''B'') is the prior or marginal probability of ''B'', and acts as a normalizing constant. &lt;br /&gt;
* P(''A''|''B'') is the conditional probability of ''A'', given ''B''. It is also called the posterior probability because it is derived from or depends upon the specified value of ''B''.&lt;br /&gt;
* P(''B''|''A'') is the conditional probability of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem in this form gives a mathematical representation of how the conditional probabability of event ''A'' given ''B'' is related to the converse conditional probabablity of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
Suppose there is a school having 60% boys and 40% girls as students. &lt;br /&gt;
&lt;br /&gt;
The female students wear trousers or skirts in equal numbers; the boys all wear trousers. &lt;br /&gt;
&lt;br /&gt;
An observer sees a (random) student from a distance; all the observer can see is that this student is wearing trousers. &lt;br /&gt;
&lt;br /&gt;
What is the probability this student is a girl? &lt;br /&gt;
&lt;br /&gt;
The correct answer can be computed using Bayes' theorem.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P(A) \equiv&amp;lt;/math&amp;gt; probability that  the student observed is a girl = 0.4&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B) \equiv&amp;lt;/math&amp;gt; probability  that the student observed is wearing trousers = 60+20/100 = 0.8&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B|A) \equiv&amp;lt;/math&amp;gt; probability the student is wearing trousers given that the student is a girl&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A|B) \equiv&amp;lt;/math&amp;gt; probability the student is a girl given that the student is wearing trousers&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(B|A) =0.5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B|A) P(A)}{P(B)} = \frac{0.5 \times 0.4}{0.8} = 0.25.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Method of Maximum Likelihood=&lt;br /&gt;
&lt;br /&gt;
;The principle of maximum likelihood is the cornerstone of Frequentist based hypothesis testing and may be written as&lt;br /&gt;
:The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observation is a maximum.&lt;br /&gt;
&lt;br /&gt;
= Least Squares Fit to a Line=&lt;br /&gt;
&lt;br /&gt;
== Applying the Method of Maximum Likelihood==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our object is to find the best straight line fit for an expected linear relationship between dependent variate &amp;lt;math&amp;gt;(y)&amp;lt;/math&amp;gt;  and independent variate &amp;lt;math&amp;gt;(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we let &amp;lt;math&amp;gt;y_0(x)&amp;lt;/math&amp;gt; represent the &amp;quot;true&amp;quot; linear relationship between independent variate &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and dependent variate &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_o(x) = A + B x&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i = \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A,B) = \Pi \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \left ( \frac{1}{\sigma \sqrt{2 \pi}}\right )^N e^{- \frac{1}{2} \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt; = Max&lt;br /&gt;
 &lt;br /&gt;
The maximum probability will result in the best values for &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\chi^2 = \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2 = \sum \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2&amp;lt;/math&amp;gt; = Min&lt;br /&gt;
&lt;br /&gt;
The min for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; occurs when the function is a minimum for both parameters A &amp;amp; B : ie&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \sum \frac{ \partial}{\partial A} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \sum \frac{ \partial}{\partial B} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;If &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt; : All variances are the same  (weighted fits don't make this assumption)&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial A} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial B} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum x_i \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum  x_i \left( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above equations represent a set of simultaneous of 2 equations and 2 unknowns which can be solved.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum y_i = \sum A + B \sum x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum x_i y_i = A \sum x_i + B \sum x_i^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} \sum y_i \\ \sum x_i y_i \end{array} \right) = \left( \begin{array}{cc} N &amp;amp; \sum x_i\\&lt;br /&gt;
\sum x_i &amp;amp; \sum x_i^2 \end{array} \right)\left( \begin{array}{c} A \\ B \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The Method of Determinants ===&lt;br /&gt;
for the matrix problem:&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} y_1 \\ y_2 \end{array} \right) = \left( \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right)\left( \begin{array}{c} x_1 \\ x_2 \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the above can be written as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_1 = a_{11} x_1 + a_{12} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;y_2 = a_{21} x_1 + a_{22} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
solving for &amp;lt;math&amp;gt;x_1&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;y_1&amp;lt;/math&amp;gt; is known&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;a_{22} (y_1 = a_{11} x_1 + a_{12} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-a_{12} (y_2 = a_{21} x_1 + a_{22} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow a_{22} y_1 - a_{12} y_2 = (a_{11}a_{22} - a_{12}a_{21}) x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| = \left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
: &amp;lt;math&amp;gt;x_1 = \frac{\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt; similarly &amp;lt;math&amp;gt;x_2 = \frac{\left| \begin{array}{cc}  a_{11} &amp;amp; y_1 \\  a_{21} &amp;amp; y_2  \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Solutions exist as long as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{12} &amp;amp; a_{22} \end{array} \right| \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apply the method of determinant for the maximum likelihood problem above&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the uncertainty in all the measurements is not the same then we need to insert &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; back into the system of equations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Uncertainty in the Linear Fit parameters==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
By definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}&amp;lt;/math&amp;gt;  : there are 2 parameters and N data points which translate to (N-2) degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
The least square fit ( assuming equal &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;) has the following solution for the parameters A &amp;amp; B as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\sum y_i \sum x_i^2 - \sum x_i \sum x_i y_i  }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \frac{(1) \sum x_i^2 - x_j\sum x_i   }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt; only the &amp;lt;math&amp;gt;y_j&amp;lt;/math&amp;gt; term survives &lt;br /&gt;
:&amp;lt;math&amp;gt; = D \left ( \sum x_i^2 - x_j\sum x_i \right)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D \equiv \frac{1}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}=\frac{1}{N\sum x_i^2 - \sum x_i \sum x_i }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_{j=1}^N \sigma_j^2 \left ( D \left ( \sum x_i^2 - x_j\sum x_i \right) \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2 - x_j\sum x_i \right )^2&amp;lt;/math&amp;gt; : Assume &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2\right )^2  + \left (x_j\sum x_i \right )^2 - 2 \left ( \sum x_i^2 x_j \sum x_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  \sum_{j=1}^N  \left ( \sum x_i^2\right ) +  \sum_{j=1}^N x_j^2  -  2 \sum x_i \sum_{j=1}^N x_j  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum x_i \sum_{j=1}^N x_j  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sum x_i \sum_{j=1}^N x_j \approx \sum_{j=1}^N x_j^2&amp;lt;/math&amp;gt; Both sums are over the number of observations &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum_{j=1}^N x_j^2  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2 \frac{1}{D}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \sigma^2  \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we redefine our origin in the linear plot so the line is centered a x=0 then &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum{x_i} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2} = \frac{\sum x_i^2 }{N\sum x_i^2 } = \frac{1}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{1}{N} = \frac{\sigma^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: The parameter A is the y-intercept so it makes some intuitive sense that the error in the Y -intercept would be dominated by the statistical error in Y&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in B===&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}= \frac{\partial}{\partial y_j} D \left ( N\sum x_i y_i -\sum x_i \sum y_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;=  D \left ( N x_j - \sum x_i \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 D^2 \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;\sigma_j = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N^2 x_j^2 - 2N x_j \sum x_i + \sum x_i^2\right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum_{j=1}^Nx_j^2 - 2N \sum x_i \sum_{j=1}^N x_j  + \sum x_i^2 \sum_{j=1}^N  \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum x_i^2 - 2N \sum x_i \sum_{j=1}^N x_j  + N \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - 2 \sum x_i \sum_{j=1}^N x_j  +  \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = N D^2 \sigma^2 \frac{1}{D} = ND \sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_B^2= \frac{N \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}} {N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Linear Fit with error==&lt;br /&gt;
&lt;br /&gt;
From above we know that if each independent measurement has a different error &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; then the fit parameters are given by &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D = \frac{1}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right| }= &lt;br /&gt;
\frac{1}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [ \sum\frac{ y_i}{\sigma_i^2} \sum\frac{ x_i^2}{\sigma_i^2}- \sum\frac{ x_i}{\sigma_i^2}  \sum\frac{ x_i y_i}{\sigma_i^2}  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ] =  \sum_{j=1}^N \left [ \sigma_j^2  D^2 \left ( \frac{ 1}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \sigma_j^2  \left [  \frac{ 1}{\sigma_j^4} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \frac{ x_j}{\sigma_j^4} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \frac{ x_j^2}{\sigma_j^4} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2   \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ 1}{\sigma_i^2} \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 -  \left( \sum \frac{ x_j}{\sigma_j^2} \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= D    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)  = \frac{ \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) }{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Compare with the unweighted error&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in B ===&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [\sum \frac{1}{\sigma_i^2}\sum \frac{x_i y_i}{\sigma_i^2}  - \sum \frac{ y_i}{\sigma_i^2}\sum \frac{x_i}{\sigma_i^2}   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_{j=1}^N \left [ \sigma_j^2 \left (  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \left [  \frac{ 1}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} + \left (\frac{1}{\sigma_j}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} + \left (\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 1 \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D \sum_{j=1}^N \frac{ 1}{\sigma_j^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_B^2 = \frac{  \sum\frac{ 1}{\sigma_i^2}}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Correlation Probability==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the Linear Fit has been performed, the next step will be to determine a probability that the Fit is actually describing the data.&lt;br /&gt;
&lt;br /&gt;
The Correlation Probability (R) is one method used to try and determine this probability.&lt;br /&gt;
&lt;br /&gt;
This method evaluates the &amp;quot;slope&amp;quot; parameter to determine if there is a correlation between the dependent and independent variables , x and y.&lt;br /&gt;
&lt;br /&gt;
The liner fit above was done to minimize \chi^2 for the following model&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y = A + Bx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What if we turn this  equation around such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = A^{\prime} + B^{\prime}y&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;B^{\prime} =0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is complete correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  &lt;br /&gt;
:&amp;lt;math&amp;gt;A = -\frac{A^{\prime}}{B^{\prime}}&amp;lt;/math&amp;gt;        and     &amp;lt;math&amp;gt;B = \frac{1}{B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: and &amp;lt;math&amp;gt;BB^{\prime} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So one can define a metric BB^{\prime} which has the natural range between 0 and 1 such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;R \equiv \sqrt{B B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
since&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and one can show that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B^{\prime} = \frac{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum y_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum y_i  &amp;amp; \sum y_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;R = \sqrt{ \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  } \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=   \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{\sqrt{\left( N\sum x_i^2 - \sum x_i \sum x_i  \right ) \left (N\sum y_i^2 - \sum y_i \sum y_i\right)  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:The correlation coefficient (R) CAN'T be used to indicate the degree of correlation.  The probability distribution &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; can be derived from a 2-D gaussian but knowledge of the correlation coefficient of the parent population &amp;lt;math&amp;gt;(\rho)&amp;lt;/math&amp;gt; is required to evaluate R of the sample distribution.&lt;br /&gt;
&lt;br /&gt;
Instead one assumes a correlation of &amp;lt;math&amp;gt;\rho=0&amp;lt;/math&amp;gt; in the parent distribution and then compares the sample value of &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; with what you would get if there were no correlation.&lt;br /&gt;
&lt;br /&gt;
The smaller &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; is the more likely that the data are correlated and that the linear fit is correct.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_R(R,\nu) = \frac{1}{\sqrt{\pi}} \frac{\Gamma\left ( \frac{\nu+1}{2}\right )}{\Gamma \left ( \frac{\nu}{2}\right)} \left( 1-R^2\right)^{\left( \frac{\nu-2}{2}\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
= Probability that any random sample of UNCORRELATED data would yield the correlation coefficient &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\Gamma(x) = \int_0^{\infty} t^{x-1}e^{-t} dt&amp;lt;/math&amp;gt;&lt;br /&gt;
 (ROOT::Math::tgamma(double x) )&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu=N-2&amp;lt;/math&amp;gt; = number of degrees of freedom = Number of data points - Number of parameters in fit function&lt;br /&gt;
&lt;br /&gt;
Derived in &amp;quot;Pugh and Winslow, The Analysis of Physical Measurement, Addison-Wesley Publishing, 1966.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Least Squares fit to a Polynomial=&lt;br /&gt;
&lt;br /&gt;
Let's assume we wish to now fit a polynomial instead of a straight line to the data.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) = \sum_{j=0}^{n} a_j x^{n}=\sum_{j=0}^{n} a_j f_j(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f_j(x) =&amp;lt;/math&amp;gt; a function which does not depend on &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i(a_0,a_1, \cdots ,a_n) = \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;a_n&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once again the probability is maximized when the numerator of the exponential is a minimum&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
The minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \frac{\partial \left( - \sum_{j=0}^{n} a_j f_j(x_i) \right)}{\partial a_k}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2 \sum_i^N  \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2\sum_i^N  \frac{1}{\sigma_i^2} \left (  -  f_k(x_i) \right) \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) =0&amp;lt;/math&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
: &amp;lt;math&amp;gt;\Rightarrow \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =  \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}  \sum_{j=0}^{n} a_j f_j(x_i)=  \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You now have a system of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; coupled equations for the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; with each equation summing over the &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; measurements.&lt;br /&gt;
&lt;br /&gt;
The first equation &amp;lt;math&amp;gt;(f_1)&amp;lt;/math&amp;gt; looks like this&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_i^N f_1(x_i) \frac{y_i}{\sigma_i^2} = \sum_i^N \frac{f_1(x_i)}{\sigma_i^2} \left ( a_1 f_1(x_i) + a_2 f_2(x_i) + \cdots a_n f_n(x_i)\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could use the method of determinants as we did to find the parameters &amp;lt;math&amp;gt;(a_n)&amp;lt;/math&amp;gt; for a linear fit but it is more convenient to use matrices in a technique referred to as regression analysis&lt;br /&gt;
&lt;br /&gt;
==Regression Analysis==&lt;br /&gt;
&lt;br /&gt;
The parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; in the previous section are linear parameters to a general function which may be a polynomial.&lt;br /&gt;
&lt;br /&gt;
The system of equations is composed of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations where the &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation is given as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
may be represented in matrix form as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\beta_k= \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{kj} = \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or in matrix form&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha} = \left ( \begin{matrix} \alpha_{11}  &amp;amp; \alpha_{12} &amp;amp; \cdots &amp;amp; \alpha_{1j} \\ \alpha_{21}  &amp;amp; \alpha_{22}&amp;amp;\cdots&amp;amp;\alpha_{2j} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1} &amp;amp;\alpha_{k2} &amp;amp;\cdots &amp;amp;\alpha_{kj}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
; the objective is to find the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
: To find &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; just invert the matrix&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \tilde{\beta} = \tilde{a} \tilde{\alpha} \right) \tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{\alpha}\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \Rightarrow  \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Thus if you invert the matrix &amp;lt;math&amp;gt;\tilde{\alpha}&amp;lt;/math&amp;gt; you find &amp;lt;math&amp;gt;\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt; and as a result the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Matrix inversion==&lt;br /&gt;
&lt;br /&gt;
The first thing to note is that for the inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A})&amp;lt;/math&amp;gt; to exist its determinant can not be zero&lt;br /&gt;
: &amp;lt;math&amp;gt;\left |\tilde{A} \right | \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A}^{-1})&amp;lt;/math&amp;gt; is defined such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{A}^{-1} = \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we divide both sides by the matrix &amp;lt;math&amp;gt;\tilde {A}&amp;lt;/math&amp;gt; then we have&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A}^{-1} = \frac{\tilde{1}}{\tilde{A} }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above ratio of the unity matrix to matrix &amp;lt;math&amp;gt;\tilde{A}&amp;lt;/math&amp;gt; is always equal to &amp;lt;math&amp;gt;\tilde{A}^{-1}&amp;lt;/math&amp;gt; as long as both the numerator and denominator are multiplied by the same constant factor.&lt;br /&gt;
&lt;br /&gt;
If we do such operations we can transform the ratio such that the denominator has the unity matrix and then the numerator will have the inverse matrix.  &lt;br /&gt;
&lt;br /&gt;
This is the principle of Gauss-Jordan Elimination.&lt;br /&gt;
&lt;br /&gt;
===Gauss-Jordan Elimination===&lt;br /&gt;
If Gauss–Jordan elimination is applied on a square matrix, it can be used to calculate the inverse matrix. This can be done by augmenting the square matrix with the identity matrix of the same dimensions, and through the following matrix operations:&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{1} \Rightarrow&lt;br /&gt;
 \tilde{1} \tilde{A}^{-1} .&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the original square matrix, &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;, is given by the following expression:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 \\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 \\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, after augmenting by the identity, the following is obtained:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A}\tilde{1} = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By performing elementary row operations on the &amp;lt;math&amp;gt;\tilde{A}\tilde{1}&amp;lt;/math&amp;gt; matrix until it reaches reduced row echelon form, the following is the final result:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1}\tilde{A}^{-1}  = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 &amp;amp; \frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1 &amp;amp; \frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix augmentation can now be undone, which gives the following:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}\qquad&lt;br /&gt;
 \tilde{A}^{-1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
\frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
\frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
\frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
:&amp;lt;math&amp;gt; &lt;br /&gt;
 \tilde{A}^{-1} =\frac{1}{4}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}=\frac{1}{det(A)}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
A matrix is non-singular (meaning that it has an inverse matrix) if and only if the identity matrix can be obtained using only elementary row operations.&lt;br /&gt;
&lt;br /&gt;
== Error Matrix==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
Where the definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - \sum_{j=0}^{n} a_j f_j(x_i) \right)^2}{N -n}&amp;lt;/math&amp;gt;  : there are &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; parameters and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; data points which translate to &amp;lt;math&amp;gt;(N-n)&amp;lt;/math&amp;gt; degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
Applying this for the parameter &amp;lt;math&amp;gt;a_k&amp;lt;/math&amp;gt; indicates that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k}^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial a_k}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;But what if there are covariances?&lt;br /&gt;
In that case the following general expression applies&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = &amp;lt;/math&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha}^{-1} = \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n) = ( \beta_1, \beta_2, \cdots , \beta_n) \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow  a_k = \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = \frac{\partial }{\partial y_i} \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\partial }{\partial y_i} \sum_j^n \left( \sum_i^N f_j(x_i) \frac{y_i}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt; :only one &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; in the sum over &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; survives the derivative&lt;br /&gt;
&lt;br /&gt;
similarly&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_l}{\partial y_i} = \sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
substituting&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^N \left [ \sigma_i^2  \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}\sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right)\alpha_{pl}^{-1} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;math&amp;gt; \sigma_i^2&amp;lt;/math&amp;gt; term appears on the  top and bottom.&lt;br /&gt;
;Move the outer most sum to the inside&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 =  \sum_j^n \left(   \alpha_{jk}^{-1}\sum_p^n \sum_i^N  \frac{f_j(x_i)  f_p(x_i)}{\sigma_i^2} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n  \alpha_{jk}^{-1}\sum_p^n \left(  \alpha_{jp} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n \alpha_{jk}^{-1}\tilde{1}_{jl}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{1}_{jl}&amp;lt;/math&amp;gt;  = the &amp;lt;math&amp;gt;j,l&amp;lt;/math&amp;gt; element of the unity matrix = 1&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{jk} = \alpha_{kj} &amp;lt;/math&amp;gt; : the matrix is symmetric.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sigma_{a_k,a_l}^2 =  \sum_j^n \alpha_{kj}^{-1}\tilde{1}_{jl}= \alpha_{kl}^{-1}&amp;lt;/math&amp;gt; = Covariance/Error matrix element&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse matrix &amp;lt;math&amp;gt;\alpha_{kl}^{-1}&amp;lt;/math&amp;gt; tells you the variance and covariance for the calculation of the total error.&lt;br /&gt;
&lt;br /&gt;
;Remember&lt;br /&gt;
:&amp;lt;math&amp;gt;Y = \sum_i^n a_i f_i(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_i}^2 = \alpha_{ii}^{-1}&amp;lt;/math&amp;gt;= error in the parameters&lt;br /&gt;
: &amp;lt;math&amp;gt;s^2 = \sum_i^n \sum_j^n \left ( \frac{\partial Y}{\partial a_i}\frac{\partial Y}{\partial a_j}\right) \sigma_{ij}=\sum_i^n \sum_j^n \left ( f_i(x)f_j(x)\right) \sigma_{ij} &amp;lt;/math&amp;gt; = error in the model's prediction&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^n \sum_j^n  x^{j+i} \sigma_{ij}&amp;lt;/math&amp;gt; If Y is a power series in x &amp;lt;math&amp;gt;(f_i(x) = x^i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Chi-Square Distribution=&lt;br /&gt;
&lt;br /&gt;
The above tools allow you to perform a least squares fit to data using high order polynomials.&lt;br /&gt;
&lt;br /&gt;
; The question though is how high in order should you go?  (ie; when should you stop adding parameters to the fit?)&lt;br /&gt;
&lt;br /&gt;
One argument is that you should stop increasing the number of parameters if they don't change much.  The parameters, using the above techniques, are correlated such that when you add another order to the fit all the parameters have the potential to change in value.  If their change is miniscule then you can ague that adding higher orders to the fit does not change the fit.  There are techniu&lt;br /&gt;
&lt;br /&gt;
A quantitative way to express the above uses the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value of the fit.  The above technique seeks to minimize &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  So if you add higher orders and more parameters but the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value does not change appreciably, you could argue that the fit is a good as you can make it with the given function.&lt;br /&gt;
&lt;br /&gt;
==Derivation==&lt;br /&gt;
&lt;br /&gt;
If you assume a series of measurements have a Gaussian parent distribution&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) = \frac{1}{\sqrt{2 \pi} \sigma} e^{-\frac{1}{2} \left ( \frac{x - \bar{x}}{\sigma}\right)^2}&amp;lt;/math&amp;gt; = probability of measuring the value &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; from a Gaussian distribution with s sample mean&amp;lt;math&amp;gt; \bar{x}&amp;lt;/math&amp;gt; from a parent distribution of with &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you break the above probability up into intervals of &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt; then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) d\bar{x}&amp;lt;/math&amp;gt; = probability that &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; lies within the interval &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you make N measurements of two variates (x_i and y_i) which may be correlated using a function with n parameters.&lt;br /&gt;
&lt;br /&gt;
== Chi-Square Cumulative Distribution==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution function is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\nu) = \frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; y(x_i)&amp;lt;/math&amp;gt; = the assumed functional dependence of the data on &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; =  N - n -1 = degrees of freedom&lt;br /&gt;
:&amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points&lt;br /&gt;
:&amp;lt;math&amp;gt;n + 1&amp;lt;/math&amp;gt; = number of parameters used in the fit (n coefficients + 1 constant term)&lt;br /&gt;
:&amp;lt;math&amp;gt; \Gamma(z) = \int_0^\infty  t^{z-1} e^{-t}\,dt\;&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above tells you the probability of getting the value of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; given the number of degrees of freedom &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; in your fit.&lt;br /&gt;
&lt;br /&gt;
While it is useful to know what the probability is of getting a value of &amp;lt;math&amp;gt;\chi^2 = x&amp;lt;/math&amp;gt; it is more useful to use the cumulative distribution function.&lt;br /&gt;
&lt;br /&gt;
The probability that the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; you received from your fit is as larger or larger than what you would get from a function described by the parent distribution is given &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty} P(x,\nu) dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A graph of &amp;lt;math&amp;gt;P(x,\nu)&amp;lt;/math&amp;gt; shows that the mean value of this function is &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow P(\chi^2 = \nu ,\nu)=\int_{\chi^2=\nu}^{\infty} P(x,\nu) dx = 0.5&amp;lt;/math&amp;gt; = probability of getting the average value for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; or larger is 0.5.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Reduced Chi-square==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced Chi-square &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2_{\nu} = \frac{\chi^2}{\nu}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the mean of &amp;lt;math&amp;gt;P(x,\nu) = \nu&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
then the mean of &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(\frac{x}{\nu},\nu) = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A reduced chi-squared distribution &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; has a mean value of 1.&lt;br /&gt;
&lt;br /&gt;
==p-Value==&lt;br /&gt;
&lt;br /&gt;
For the above fits,&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The p-value is defined as the cumulative &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution&lt;br /&gt;
&lt;br /&gt;
: p-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The p-value is the probability, under the assumption of a hypothesis H , of obtaining data at least as incompatible with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  small p-values are good.&lt;br /&gt;
&lt;br /&gt;
;The p-value is NOT&lt;br /&gt;
&lt;br /&gt;
# the probability that the null hypothesis is true. (This false conclusion is used to justify the &amp;quot;rule&amp;quot; of considering a result to be significant if its p-value is very small (near zero).) &amp;lt;br /&amp;gt; In fact, frequentist statistics does not, and cannot, attach probabilities to hypotheses. &lt;br /&gt;
# the probability that a finding is &amp;quot;merely a fluke.&amp;quot; (Again, this conclusion arises from the &amp;quot;rule&amp;quot; that small p-values indicate significant differences.) &amp;lt;br /&amp;gt; As the calculation of a p-value is based on the ''assumption'' that a finding is the product of chance alone, it patently cannot also be used to gauge the probability of that assumption being true. This is subtly different from the real meaning which is that the p-value is the chance that null hypothesis explains the result: the result might not be &amp;quot;merely a fluke,&amp;quot; ''and'' be explicable by the null hypothesis with confidence equal to the p-value.&lt;br /&gt;
#the probability of falsely rejecting the null hypothesis. &lt;br /&gt;
#the probability that a replicating experiment would not yield the same conclusion.&lt;br /&gt;
#1&amp;amp;nbsp;−&amp;amp;nbsp;(p-value) is ''not'' the probability of the alternative hypothesis being true.&lt;br /&gt;
#A determination of the significance level of the test. &amp;lt;br /&amp;gt; The significance level of a test is a value that should be decided upon by the agent interpreting the data before the data are viewed, and is compared against the p-value or any other statistic calculated after the test has been performed.&lt;br /&gt;
#an indication of  the size or importance of the observed effect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In ROOT&lt;br /&gt;
&lt;br /&gt;
 double ROOT::Math::chisquared_cdf_c (double &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;, double &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;, double x0 = 0 )		&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;=\int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
  TMath::Prob(&amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
You can turn things around the other way by defining P-value to be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: P-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\infty}^{\chi^2}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx = 1-(p-value)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here P-value would be the probability, under the assumption of a hypothesis H , of obtaining data at least as '''compatible''' with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
The P-value is the probability of observing a sample statistic as extreme as the test statistic.&lt;br /&gt;
&lt;br /&gt;
http://stattrek.com/chi-square-test/goodness-of-fit.aspx&lt;br /&gt;
&lt;br /&gt;
=F-test=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt; \chi^2&amp;lt;/math&amp;gt; test in the previous section measures both the difference between the data and the fit function as well as the difference between the fit function and the &amp;quot;parent&amp;quot; function.  The &amp;quot;parent&amp;quot; function is the true functional dependence of the data.&lt;br /&gt;
&lt;br /&gt;
The F-test can be used to determine the difference between the fit function and the parent function, to more directly test if you have come up with the correct fit function.&lt;br /&gt;
&lt;br /&gt;
== F-distribution==&lt;br /&gt;
&lt;br /&gt;
If, for example, you are comparing the Ratio of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; values from 2 different fits to the data then the function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then since &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 \equiv \sum_i^N \frac{\left (y_i-y(x_i)\right)^2}{\sigma_i^2}= \frac{s^2}{\sigma^2}&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; = constant&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and assuming &amp;lt;math&amp;gt;\sigma_1 = \sigma_2&amp;lt;/math&amp;gt; (same data set)&lt;br /&gt;
&lt;br /&gt;
one can argue that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_1}{\nu_1}} = \frac{s_1^2}{\sigma_1^2}\frac{\sigma_2^2}{s_2^2} \frac{\nu_2}{\nu_1} = \frac{\nu_2}{\nu_1} \frac{s_1^2}{s_2^2}&amp;lt;/math&amp;gt; = function that is independent of the error &amp;lt;math&amp;gt; \sigma&amp;lt;/math&amp;gt; intrinsic to the data thus the function is only comparing the fit residuals&amp;lt;math&amp;gt; (s^2)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The Function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
can be shown to follow the following probability distribution.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1, \nu_2) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
which is available in ROOT as&lt;br /&gt;
&lt;br /&gt;
 ROOT::Math::fdistribution_pdf(double x, double n, double m, double x0 = 0 )&lt;br /&gt;
&lt;br /&gt;
== The chi^2 difference test==&lt;br /&gt;
&lt;br /&gt;
In a similar fashion as above, one can define another ratio which is based on the difference between the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value using 2 different .&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} = \frac{\frac{\chi^2_1 - \chi^2_2}{\nu_1-\nu_2}}{\frac{\chi^2_1}{\nu_1}} =  \frac{\frac{\chi^2(m) - \chi^2(n)}{n-m}}{\frac{\chi^2(m)}{(N-m-1)}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under the null hypothesis that model 2 does not provide a significantly better fit than model 1, F will have an F distribution, with &amp;lt;math&amp;gt;(\nu_2 − \nu_1, \nu_1)&amp;lt;/math&amp;gt; degrees of freedom. The null hypothesis is rejected if the F calculated from the data is greater than the critical value of the F  distribution for some desired false-rejection probability (e.g. 0.05).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to determine if you need to continue adding parameters to the fit then you can consider an F-test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_1}{N-m-1}} = \frac{\Delta \chi^2}{\chi^2_{\nu}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above statistic will again follow the F-distribution &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1=1, \nu_2=N-m-1) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note: Some will define the fraction with respect to the next order fit&lt;br /&gt;
::&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_2}{N-m}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The multiple correlation coefficient test==&lt;br /&gt;
&lt;br /&gt;
While the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference F-test above is useful to evaluate the impact of adding another fit parameter, you will also want to evaluate the &amp;quot;goodness&amp;quot; of the entire fit in a manner which can be related to a correlation coefficient R (in this case it is a multiple-correlation coefficient because the fit can go beyond linear).&lt;br /&gt;
&lt;br /&gt;
I usually suggest that you do this after the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference test unless you have a theoretical model which constrains the number of fit parameters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Least Squares fit to an Arbitrary Function=&lt;br /&gt;
&lt;br /&gt;
The above Least Squares fit methods work well if your fit function has a linear dependence on the fit parameters.&lt;br /&gt;
&lt;br /&gt;
:ie; &amp;lt;math&amp;gt;y(x) =\sum_i^n a_i x^i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
such fit functions give you a set of  &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations that are linear in the parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; when you are minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  The &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation of this set of n equations is shown below.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your fit equation looks like&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) =a_1 e^{\frac{1}{2} \left (\frac{x-a_2}{a_3}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
now your set of equations minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; are non-linear with respect to the parameters.  You can't take separate the &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; term from the &amp;lt;math&amp;gt;f_k(x_i)&amp;lt;/math&amp;gt; function and thereby solve the system by inverting your matrix&lt;br /&gt;
:&amp;lt;math&amp;gt; \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
Because of this, a direct analytical solution is difficult (you need to find roots of coupled non-linear equations) and one resorts to approximation methods for the solution.&lt;br /&gt;
== Grid search==&lt;br /&gt;
&lt;br /&gt;
The fundamentals of the grid search is to basically change all parameters over some natural range to generate a hypersurface in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; and look for the smallest value of of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; that appears on the hypersurface.&lt;br /&gt;
&lt;br /&gt;
In Lab 15 you will generate this hypersurface for the simple least squares linear fit tot he Temp -vs- Voltage data in lab 14.  Your surface might look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:TF_ErrAna_Lab15.png | 200 px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As shown above, I have plotted the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; as a function of  the y-Intercept &amp;lt;math&amp;gt;(a_1)&amp;lt;/math&amp;gt; and the slope &amp;lt;math&amp;gt;(a_2)&amp;lt;/math&amp;gt;.  The minimum in this hypersurface should coincide with the values of Y-intercept=&amp;lt;math&amp;gt;a_1=-1.01&amp;lt;/math&amp;gt; and Slope=&amp;lt;math&amp;gt;a_2=0.0431&amp;lt;/math&amp;gt; from the linear regression solution.&lt;br /&gt;
&lt;br /&gt;
If we return to the beginning, the original problem is to use the max-likelihood principle on the probability function for finding the correct fit using the data. &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i -y(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
To maximize the probability of finding the best fit we need to find by minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right ) \frac{\partial \left( - y(x_i) \right)}{\partial a_k} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively you could also express \chi^2 in terms of the probability distributions as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n)  \propto e^{- \frac{1}{2}\chi^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Grid search method==&lt;br /&gt;
&lt;br /&gt;
The grid search method relies on the independence of the fit parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt;.    The search starts by selecting initial values for all parameters and then searching for a &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; minimum for one of the fit parameters.  You then set the parameter to the determined value and repeat the procedure on the next parameter.  You keep repeating until a stable value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found.&lt;br /&gt;
&lt;br /&gt;
Obviously, this method strongly depends on the initial values selected for the parameters.&lt;br /&gt;
&lt;br /&gt;
==Parameter Errors==&lt;br /&gt;
&lt;br /&gt;
Returning back to the equation&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
it may be observed that &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; represents the error in the parameter &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; and that the error alters &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once a minimum is found, the parabolic nature of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;  dependence on a single parameter is such that an increase in 1 standard deviation in the parameter results in an increase in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can turn this to determine the error in the fit parameter by determining how much the parameter must increase (or decrease) in order to increase &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Gradient Search Method==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Gradient search method improves on the Grid search method by attempting to search in a direction towards the minima as determined by simultaneous changes in all parameters.  The change in each parameter may differ in magnitude and is adjustable for each parameter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference  Go Back] [[Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91704</id>
		<title>TF ErrorAna StatInference</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91704"/>
		<updated>2014-03-21T19:16:22Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* The Method of Determinants */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Statistical Inference&lt;br /&gt;
=Frequentist -vs- Bayesian Inference=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When it comes to testing a hypothesis, there are  two dominant philosophies known as a Frequentist or a Bayesian perspective.&lt;br /&gt;
&lt;br /&gt;
The dominant discussion for this class will be from the Frequentist perspective.&lt;br /&gt;
&lt;br /&gt;
== frequentist statistical inference==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made using a null-hypothesis test; that is, one that answers the question, Assuming that the null hypothesis is true, what is the probability of observing a value for the test statistic that is at least as extreme as the value that was actually observed?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The relative frequency of occurrence of an event, in a number of repetitions of the experiment, is a measure of the probability of that event.&lt;br /&gt;
Thus, if &amp;lt;math&amp;gt;n_t&amp;lt;/math&amp;gt; is the total number of trials and &amp;lt;math&amp;gt;n_x&amp;lt;/math&amp;gt; is the number of trials where the event x occurred, the probability P(x) of the event occurring will be approximated by the relative frequency as follows:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) \approx \frac{n_x}{n_t}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Bayesian inference.==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made by using evidence or observations  to update or to newly infer the probability that a hypothesis may be true. The name &amp;quot;Bayesian&amp;quot; comes from the frequent use of Bayes' theorem in the inference process.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem relates the conditional probability, conditional and marginal probability, marginal probabilities of events ''A'' and ''B'', where ''B'' has a non-vanishing probability:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}\,\! &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Each term in Bayes' theorem has a conventional name:&lt;br /&gt;
* P(''A'') is the prior probability or marginal probability of ''A''. It is &amp;quot;prior&amp;quot; in the sense that it does not take into account any information about ''B''.&lt;br /&gt;
* P(''B'') is the prior or marginal probability of ''B'', and acts as a normalizing constant. &lt;br /&gt;
* P(''A''|''B'') is the conditional probability of ''A'', given ''B''. It is also called the posterior probability because it is derived from or depends upon the specified value of ''B''.&lt;br /&gt;
* P(''B''|''A'') is the conditional probability of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem in this form gives a mathematical representation of how the conditional probabability of event ''A'' given ''B'' is related to the converse conditional probabablity of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
Suppose there is a school having 60% boys and 40% girls as students. &lt;br /&gt;
&lt;br /&gt;
The female students wear trousers or skirts in equal numbers; the boys all wear trousers. &lt;br /&gt;
&lt;br /&gt;
An observer sees a (random) student from a distance; all the observer can see is that this student is wearing trousers. &lt;br /&gt;
&lt;br /&gt;
What is the probability this student is a girl? &lt;br /&gt;
&lt;br /&gt;
The correct answer can be computed using Bayes' theorem.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P(A) \equiv&amp;lt;/math&amp;gt; probability that  the student observed is a girl = 0.4&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B) \equiv&amp;lt;/math&amp;gt; probability  that the student observed is wearing trousers = 60+20/100 = 0.8&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B|A) \equiv&amp;lt;/math&amp;gt; probability the student is wearing trousers given that the student is a girl&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A|B) \equiv&amp;lt;/math&amp;gt; probability the student is a girl given that the student is wearing trousers&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(B|A) =0.5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B|A) P(A)}{P(B)} = \frac{0.5 \times 0.4}{0.8} = 0.25.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Method of Maximum Likelihood=&lt;br /&gt;
&lt;br /&gt;
;The principle of maximum likelihood is the cornerstone of Frequentist based hypothesis testing and may be written as&lt;br /&gt;
:The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observation is a maximum.&lt;br /&gt;
&lt;br /&gt;
= Least Squares Fit to a Line=&lt;br /&gt;
&lt;br /&gt;
== Applying the Method of Maximum Likelihood==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our object is to find the best straight line fit for an expected linear relationship between dependent variate &amp;lt;math&amp;gt;(y)&amp;lt;/math&amp;gt;  and independent variate &amp;lt;math&amp;gt;(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we let &amp;lt;math&amp;gt;y_0(x)&amp;lt;/math&amp;gt; represent the &amp;quot;true&amp;quot; linear relationship between independent variate &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and dependent variate &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_o(x) = A + B x&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i = \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A,B) = \Pi \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \left ( \frac{1}{\sigma \sqrt{2 \pi}}\right )^N e^{- \frac{1}{2} \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt; = Max&lt;br /&gt;
 &lt;br /&gt;
The maximum probability will result in the best values for &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\chi^2 = \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2 = \sum \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2&amp;lt;/math&amp;gt; = Min&lt;br /&gt;
&lt;br /&gt;
The min for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; occurs when the function is a minimum for both parameters A &amp;amp; B : ie&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \sum \frac{ \partial}{\partial A} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \sum \frac{ \partial}{\partial B} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;If &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt; : All variances are the same  (weighted fits don't make this assumption)&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial A} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial B} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum x_i \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum  x_i \left( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above equations represent a set of simultaneous of 2 equations and 2 unknowns which can be solved.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum y_i = \sum A + B \sum x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum x_i y_i = A \sum x_i + B \sum x_i^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} \sum y_i \\ \sum x_i y_i \end{array} \right) = \left( \begin{array}{cc} N &amp;amp; \sum x_i\\&lt;br /&gt;
\sum x_i &amp;amp; \sum x_i^2 \end{array} \right)\left( \begin{array}{c} A \\ B \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The Method of Determinants ===&lt;br /&gt;
for the matrix problem:&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} y_1 \\ y_2 \end{array} \right) = \left( \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right)\left( \begin{array}{c} x_1 \\ x_2 \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the above can be written as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_1 = a_{11} x_1 + a_{12} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;y_2 = a_{21} x_1 + a_{22} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
solving for &amp;lt;math&amp;gt;x_1&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;y_1&amp;lt;/math&amp;gt; is known&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;a_{22} (y_1 = a_{11} x_1 + a_{12} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-a_{12} (y_2 = a_{21} x_1 + a_{22} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow a_{22} y_1 - a_{12} y_2 = (a_{11}a_{22} - a_{12}a_{21}) x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| = \left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
test&lt;br /&gt;
or &lt;br /&gt;
: &amp;lt;math&amp;gt;x_1 = \frac{\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{12} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt; similarly &amp;lt;math&amp;gt;x_2 = \frac{\left| \begin{array}{cc}  a_{11} &amp;amp; y_1 \\  a_{21} &amp;amp; y_2  \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{12} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Solutions exist as long as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{12} &amp;amp; a_{22} \end{array} \right| \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apply the method of determinant for the maximum likelihood problem above&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the uncertainty in all the measurements is not the same then we need to insert &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; back into the system of equations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Uncertainty in the Linear Fit parameters==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
By definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}&amp;lt;/math&amp;gt;  : there are 2 parameters and N data points which translate to (N-2) degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
The least square fit ( assuming equal &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;) has the following solution for the parameters A &amp;amp; B as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\sum y_i \sum x_i^2 - \sum x_i \sum x_i y_i  }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \frac{(1) \sum x_i^2 - x_j\sum x_i   }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt; only the &amp;lt;math&amp;gt;y_j&amp;lt;/math&amp;gt; term survives &lt;br /&gt;
:&amp;lt;math&amp;gt; = D \left ( \sum x_i^2 - x_j\sum x_i \right)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D \equiv \frac{1}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}=\frac{1}{N\sum x_i^2 - \sum x_i \sum x_i }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_{j=1}^N \sigma_j^2 \left ( D \left ( \sum x_i^2 - x_j\sum x_i \right) \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2 - x_j\sum x_i \right )^2&amp;lt;/math&amp;gt; : Assume &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2\right )^2  + \left (x_j\sum x_i \right )^2 - 2 \left ( \sum x_i^2 x_j \sum x_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  \sum_{j=1}^N  \left ( \sum x_i^2\right ) +  \sum_{j=1}^N x_j^2  -  2 \sum x_i \sum_{j=1}^N x_j  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum x_i \sum_{j=1}^N x_j  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sum x_i \sum_{j=1}^N x_j \approx \sum_{j=1}^N x_j^2&amp;lt;/math&amp;gt; Both sums are over the number of observations &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum_{j=1}^N x_j^2  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2 \frac{1}{D}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \sigma^2  \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we redefine our origin in the linear plot so the line is centered a x=0 then &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum{x_i} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2} = \frac{\sum x_i^2 }{N\sum x_i^2 } = \frac{1}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{1}{N} = \frac{\sigma^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: The parameter A is the y-intercept so it makes some intuitive sense that the error in the Y -intercept would be dominated by the statistical error in Y&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in B===&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}= \frac{\partial}{\partial y_j} D \left ( N\sum x_i y_i -\sum x_i \sum y_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;=  D \left ( N x_j - \sum x_i \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 D^2 \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;\sigma_j = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N^2 x_j^2 - 2N x_j \sum x_i + \sum x_i^2\right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum_{j=1}^Nx_j^2 - 2N \sum x_i \sum_{j=1}^N x_j  + \sum x_i^2 \sum_{j=1}^N  \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum x_i^2 - 2N \sum x_i \sum_{j=1}^N x_j  + N \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - 2 \sum x_i \sum_{j=1}^N x_j  +  \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = N D^2 \sigma^2 \frac{1}{D} = ND \sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_B^2= \frac{N \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}} {N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Linear Fit with error==&lt;br /&gt;
&lt;br /&gt;
From above we know that if each independent measurement has a different error &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; then the fit parameters are given by &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D = \frac{1}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right| }= &lt;br /&gt;
\frac{1}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [ \sum\frac{ y_i}{\sigma_i^2} \sum\frac{ x_i^2}{\sigma_i^2}- \sum\frac{ x_i}{\sigma_i^2}  \sum\frac{ x_i y_i}{\sigma_i^2}  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ] =  \sum_{j=1}^N \left [ \sigma_j^2  D^2 \left ( \frac{ 1}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \sigma_j^2  \left [  \frac{ 1}{\sigma_j^4} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \frac{ x_j}{\sigma_j^4} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \frac{ x_j^2}{\sigma_j^4} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2   \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ 1}{\sigma_i^2} \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 -  \left( \sum \frac{ x_j}{\sigma_j^2} \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= D    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)  = \frac{ \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) }{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Compare with the unweighted error&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in B ===&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [\sum \frac{1}{\sigma_i^2}\sum \frac{x_i y_i}{\sigma_i^2}  - \sum \frac{ y_i}{\sigma_i^2}\sum \frac{x_i}{\sigma_i^2}   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_{j=1}^N \left [ \sigma_j^2 \left (  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \left [  \frac{ 1}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} + \left (\frac{1}{\sigma_j}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} + \left (\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 1 \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D \sum_{j=1}^N \frac{ 1}{\sigma_j^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_B^2 = \frac{  \sum\frac{ 1}{\sigma_i^2}}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Correlation Probability==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the Linear Fit has been performed, the next step will be to determine a probability that the Fit is actually describing the data.&lt;br /&gt;
&lt;br /&gt;
The Correlation Probability (R) is one method used to try and determine this probability.&lt;br /&gt;
&lt;br /&gt;
This method evaluates the &amp;quot;slope&amp;quot; parameter to determine if there is a correlation between the dependent and independent variables , x and y.&lt;br /&gt;
&lt;br /&gt;
The liner fit above was done to minimize \chi^2 for the following model&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y = A + Bx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What if we turn this  equation around such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = A^{\prime} + B^{\prime}y&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;B^{\prime} =0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is complete correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  &lt;br /&gt;
:&amp;lt;math&amp;gt;A = -\frac{A^{\prime}}{B^{\prime}}&amp;lt;/math&amp;gt;        and     &amp;lt;math&amp;gt;B = \frac{1}{B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: and &amp;lt;math&amp;gt;BB^{\prime} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So one can define a metric BB^{\prime} which has the natural range between 0 and 1 such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;R \equiv \sqrt{B B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
since&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and one can show that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B^{\prime} = \frac{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum y_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum y_i  &amp;amp; \sum y_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;R = \sqrt{ \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  } \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=   \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{\sqrt{\left( N\sum x_i^2 - \sum x_i \sum x_i  \right ) \left (N\sum y_i^2 - \sum y_i \sum y_i\right)  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:The correlation coefficient (R) CAN'T be used to indicate the degree of correlation.  The probability distribution &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; can be derived from a 2-D gaussian but knowledge of the correlation coefficient of the parent population &amp;lt;math&amp;gt;(\rho)&amp;lt;/math&amp;gt; is required to evaluate R of the sample distribution.&lt;br /&gt;
&lt;br /&gt;
Instead one assumes a correlation of &amp;lt;math&amp;gt;\rho=0&amp;lt;/math&amp;gt; in the parent distribution and then compares the sample value of &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; with what you would get if there were no correlation.&lt;br /&gt;
&lt;br /&gt;
The smaller &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; is the more likely that the data are correlated and that the linear fit is correct.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_R(R,\nu) = \frac{1}{\sqrt{\pi}} \frac{\Gamma\left ( \frac{\nu+1}{2}\right )}{\Gamma \left ( \frac{\nu}{2}\right)} \left( 1-R^2\right)^{\left( \frac{\nu-2}{2}\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
= Probability that any random sample of UNCORRELATED data would yield the correlation coefficient &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\Gamma(x) = \int_0^{\infty} t^{x-1}e^{-t} dt&amp;lt;/math&amp;gt;&lt;br /&gt;
 (ROOT::Math::tgamma(double x) )&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu=N-2&amp;lt;/math&amp;gt; = number of degrees of freedom = Number of data points - Number of parameters in fit function&lt;br /&gt;
&lt;br /&gt;
Derived in &amp;quot;Pugh and Winslow, The Analysis of Physical Measurement, Addison-Wesley Publishing, 1966.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Least Squares fit to a Polynomial=&lt;br /&gt;
&lt;br /&gt;
Let's assume we wish to now fit a polynomial instead of a straight line to the data.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) = \sum_{j=0}^{n} a_j x^{n}=\sum_{j=0}^{n} a_j f_j(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f_j(x) =&amp;lt;/math&amp;gt; a function which does not depend on &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i(a_0,a_1, \cdots ,a_n) = \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;a_n&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once again the probability is maximized when the numerator of the exponential is a minimum&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
The minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \frac{\partial \left( - \sum_{j=0}^{n} a_j f_j(x_i) \right)}{\partial a_k}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2 \sum_i^N  \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2\sum_i^N  \frac{1}{\sigma_i^2} \left (  -  f_k(x_i) \right) \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) =0&amp;lt;/math&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
: &amp;lt;math&amp;gt;\Rightarrow \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =  \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}  \sum_{j=0}^{n} a_j f_j(x_i)=  \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You now have a system of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; coupled equations for the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; with each equation summing over the &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; measurements.&lt;br /&gt;
&lt;br /&gt;
The first equation &amp;lt;math&amp;gt;(f_1)&amp;lt;/math&amp;gt; looks like this&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_i^N f_1(x_i) \frac{y_i}{\sigma_i^2} = \sum_i^N \frac{f_1(x_i)}{\sigma_i^2} \left ( a_1 f_1(x_i) + a_2 f_2(x_i) + \cdots a_n f_n(x_i)\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could use the method of determinants as we did to find the parameters &amp;lt;math&amp;gt;(a_n)&amp;lt;/math&amp;gt; for a linear fit but it is more convenient to use matrices in a technique referred to as regression analysis&lt;br /&gt;
&lt;br /&gt;
==Regression Analysis==&lt;br /&gt;
&lt;br /&gt;
The parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; in the previous section are linear parameters to a general function which may be a polynomial.&lt;br /&gt;
&lt;br /&gt;
The system of equations is composed of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations where the &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation is given as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
may be represented in matrix form as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\beta_k= \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{kj} = \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or in matrix form&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha} = \left ( \begin{matrix} \alpha_{11}  &amp;amp; \alpha_{12} &amp;amp; \cdots &amp;amp; \alpha_{1j} \\ \alpha_{21}  &amp;amp; \alpha_{22}&amp;amp;\cdots&amp;amp;\alpha_{2j} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1} &amp;amp;\alpha_{k2} &amp;amp;\cdots &amp;amp;\alpha_{kj}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
; the objective is to find the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
: To find &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; just invert the matrix&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \tilde{\beta} = \tilde{a} \tilde{\alpha} \right) \tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{\alpha}\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \Rightarrow  \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Thus if you invert the matrix &amp;lt;math&amp;gt;\tilde{\alpha}&amp;lt;/math&amp;gt; you find &amp;lt;math&amp;gt;\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt; and as a result the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Matrix inversion==&lt;br /&gt;
&lt;br /&gt;
The first thing to note is that for the inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A})&amp;lt;/math&amp;gt; to exist its determinant can not be zero&lt;br /&gt;
: &amp;lt;math&amp;gt;\left |\tilde{A} \right | \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A}^{-1})&amp;lt;/math&amp;gt; is defined such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{A}^{-1} = \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we divide both sides by the matrix &amp;lt;math&amp;gt;\tilde {A}&amp;lt;/math&amp;gt; then we have&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A}^{-1} = \frac{\tilde{1}}{\tilde{A} }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above ratio of the unity matrix to matrix &amp;lt;math&amp;gt;\tilde{A}&amp;lt;/math&amp;gt; is always equal to &amp;lt;math&amp;gt;\tilde{A}^{-1}&amp;lt;/math&amp;gt; as long as both the numerator and denominator are multiplied by the same constant factor.&lt;br /&gt;
&lt;br /&gt;
If we do such operations we can transform the ratio such that the denominator has the unity matrix and then the numerator will have the inverse matrix.  &lt;br /&gt;
&lt;br /&gt;
This is the principle of Gauss-Jordan Elimination.&lt;br /&gt;
&lt;br /&gt;
===Gauss-Jordan Elimination===&lt;br /&gt;
If Gauss–Jordan elimination is applied on a square matrix, it can be used to calculate the inverse matrix. This can be done by augmenting the square matrix with the identity matrix of the same dimensions, and through the following matrix operations:&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{1} \Rightarrow&lt;br /&gt;
 \tilde{1} \tilde{A}^{-1} .&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the original square matrix, &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;, is given by the following expression:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 \\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 \\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, after augmenting by the identity, the following is obtained:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A}\tilde{1} = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By performing elementary row operations on the &amp;lt;math&amp;gt;\tilde{A}\tilde{1}&amp;lt;/math&amp;gt; matrix until it reaches reduced row echelon form, the following is the final result:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1}\tilde{A}^{-1}  = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 &amp;amp; \frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1 &amp;amp; \frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix augmentation can now be undone, which gives the following:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}\qquad&lt;br /&gt;
 \tilde{A}^{-1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
\frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
\frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
\frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
:&amp;lt;math&amp;gt; &lt;br /&gt;
 \tilde{A}^{-1} =\frac{1}{4}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}=\frac{1}{det(A)}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
A matrix is non-singular (meaning that it has an inverse matrix) if and only if the identity matrix can be obtained using only elementary row operations.&lt;br /&gt;
&lt;br /&gt;
== Error Matrix==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
Where the definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - \sum_{j=0}^{n} a_j f_j(x_i) \right)^2}{N -n}&amp;lt;/math&amp;gt;  : there are &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; parameters and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; data points which translate to &amp;lt;math&amp;gt;(N-n)&amp;lt;/math&amp;gt; degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
Applying this for the parameter &amp;lt;math&amp;gt;a_k&amp;lt;/math&amp;gt; indicates that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k}^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial a_k}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;But what if there are covariances?&lt;br /&gt;
In that case the following general expression applies&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = &amp;lt;/math&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha}^{-1} = \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n) = ( \beta_1, \beta_2, \cdots , \beta_n) \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow  a_k = \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = \frac{\partial }{\partial y_i} \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\partial }{\partial y_i} \sum_j^n \left( \sum_i^N f_j(x_i) \frac{y_i}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt; :only one &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; in the sum over &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; survives the derivative&lt;br /&gt;
&lt;br /&gt;
similarly&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_l}{\partial y_i} = \sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
substituting&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^N \left [ \sigma_i^2  \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}\sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right)\alpha_{pl}^{-1} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;math&amp;gt; \sigma_i^2&amp;lt;/math&amp;gt; term appears on the  top and bottom.&lt;br /&gt;
;Move the outer most sum to the inside&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 =  \sum_j^n \left(   \alpha_{jk}^{-1}\sum_p^n \sum_i^N  \frac{f_j(x_i)  f_p(x_i)}{\sigma_i^2} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n  \alpha_{jk}^{-1}\sum_p^n \left(  \alpha_{jp} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n \alpha_{jk}^{-1}\tilde{1}_{jl}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{1}_{jl}&amp;lt;/math&amp;gt;  = the &amp;lt;math&amp;gt;j,l&amp;lt;/math&amp;gt; element of the unity matrix = 1&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{jk} = \alpha_{kj} &amp;lt;/math&amp;gt; : the matrix is symmetric.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sigma_{a_k,a_l}^2 =  \sum_j^n \alpha_{kj}^{-1}\tilde{1}_{jl}= \alpha_{kl}^{-1}&amp;lt;/math&amp;gt; = Covariance/Error matrix element&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse matrix &amp;lt;math&amp;gt;\alpha_{kl}^{-1}&amp;lt;/math&amp;gt; tells you the variance and covariance for the calculation of the total error.&lt;br /&gt;
&lt;br /&gt;
;Remember&lt;br /&gt;
:&amp;lt;math&amp;gt;Y = \sum_i^n a_i f_i(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_i}^2 = \alpha_{ii}^{-1}&amp;lt;/math&amp;gt;= error in the parameters&lt;br /&gt;
: &amp;lt;math&amp;gt;s^2 = \sum_i^n \sum_j^n \left ( \frac{\partial Y}{\partial a_i}\frac{\partial Y}{\partial a_j}\right) \sigma_{ij}=\sum_i^n \sum_j^n \left ( f_i(x)f_j(x)\right) \sigma_{ij} &amp;lt;/math&amp;gt; = error in the model's prediction&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^n \sum_j^n  x^{j+i} \sigma_{ij}&amp;lt;/math&amp;gt; If Y is a power series in x &amp;lt;math&amp;gt;(f_i(x) = x^i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Chi-Square Distribution=&lt;br /&gt;
&lt;br /&gt;
The above tools allow you to perform a least squares fit to data using high order polynomials.&lt;br /&gt;
&lt;br /&gt;
; The question though is how high in order should you go?  (ie; when should you stop adding parameters to the fit?)&lt;br /&gt;
&lt;br /&gt;
One argument is that you should stop increasing the number of parameters if they don't change much.  The parameters, using the above techniques, are correlated such that when you add another order to the fit all the parameters have the potential to change in value.  If their change is miniscule then you can ague that adding higher orders to the fit does not change the fit.  There are techniu&lt;br /&gt;
&lt;br /&gt;
A quantitative way to express the above uses the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value of the fit.  The above technique seeks to minimize &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  So if you add higher orders and more parameters but the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value does not change appreciably, you could argue that the fit is a good as you can make it with the given function.&lt;br /&gt;
&lt;br /&gt;
==Derivation==&lt;br /&gt;
&lt;br /&gt;
If you assume a series of measurements have a Gaussian parent distribution&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) = \frac{1}{\sqrt{2 \pi} \sigma} e^{-\frac{1}{2} \left ( \frac{x - \bar{x}}{\sigma}\right)^2}&amp;lt;/math&amp;gt; = probability of measuring the value &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; from a Gaussian distribution with s sample mean&amp;lt;math&amp;gt; \bar{x}&amp;lt;/math&amp;gt; from a parent distribution of with &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you break the above probability up into intervals of &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt; then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) d\bar{x}&amp;lt;/math&amp;gt; = probability that &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; lies within the interval &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you make N measurements of two variates (x_i and y_i) which may be correlated using a function with n parameters.&lt;br /&gt;
&lt;br /&gt;
== Chi-Square Cumulative Distribution==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution function is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\nu) = \frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; y(x_i)&amp;lt;/math&amp;gt; = the assumed functional dependence of the data on &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; =  N - n -1 = degrees of freedom&lt;br /&gt;
:&amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points&lt;br /&gt;
:&amp;lt;math&amp;gt;n + 1&amp;lt;/math&amp;gt; = number of parameters used in the fit (n coefficients + 1 constant term)&lt;br /&gt;
:&amp;lt;math&amp;gt; \Gamma(z) = \int_0^\infty  t^{z-1} e^{-t}\,dt\;&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above tells you the probability of getting the value of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; given the number of degrees of freedom &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; in your fit.&lt;br /&gt;
&lt;br /&gt;
While it is useful to know what the probability is of getting a value of &amp;lt;math&amp;gt;\chi^2 = x&amp;lt;/math&amp;gt; it is more useful to use the cumulative distribution function.&lt;br /&gt;
&lt;br /&gt;
The probability that the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; you received from your fit is as larger or larger than what you would get from a function described by the parent distribution is given &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty} P(x,\nu) dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A graph of &amp;lt;math&amp;gt;P(x,\nu)&amp;lt;/math&amp;gt; shows that the mean value of this function is &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow P(\chi^2 = \nu ,\nu)=\int_{\chi^2=\nu}^{\infty} P(x,\nu) dx = 0.5&amp;lt;/math&amp;gt; = probability of getting the average value for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; or larger is 0.5.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Reduced Chi-square==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced Chi-square &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2_{\nu} = \frac{\chi^2}{\nu}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the mean of &amp;lt;math&amp;gt;P(x,\nu) = \nu&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
then the mean of &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(\frac{x}{\nu},\nu) = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A reduced chi-squared distribution &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; has a mean value of 1.&lt;br /&gt;
&lt;br /&gt;
==p-Value==&lt;br /&gt;
&lt;br /&gt;
For the above fits,&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The p-value is defined as the cumulative &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution&lt;br /&gt;
&lt;br /&gt;
: p-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The p-value is the probability, under the assumption of a hypothesis H , of obtaining data at least as incompatible with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  small p-values are good.&lt;br /&gt;
&lt;br /&gt;
;The p-value is NOT&lt;br /&gt;
&lt;br /&gt;
# the probability that the null hypothesis is true. (This false conclusion is used to justify the &amp;quot;rule&amp;quot; of considering a result to be significant if its p-value is very small (near zero).) &amp;lt;br /&amp;gt; In fact, frequentist statistics does not, and cannot, attach probabilities to hypotheses. &lt;br /&gt;
# the probability that a finding is &amp;quot;merely a fluke.&amp;quot; (Again, this conclusion arises from the &amp;quot;rule&amp;quot; that small p-values indicate significant differences.) &amp;lt;br /&amp;gt; As the calculation of a p-value is based on the ''assumption'' that a finding is the product of chance alone, it patently cannot also be used to gauge the probability of that assumption being true. This is subtly different from the real meaning which is that the p-value is the chance that null hypothesis explains the result: the result might not be &amp;quot;merely a fluke,&amp;quot; ''and'' be explicable by the null hypothesis with confidence equal to the p-value.&lt;br /&gt;
#the probability of falsely rejecting the null hypothesis. &lt;br /&gt;
#the probability that a replicating experiment would not yield the same conclusion.&lt;br /&gt;
#1&amp;amp;nbsp;−&amp;amp;nbsp;(p-value) is ''not'' the probability of the alternative hypothesis being true.&lt;br /&gt;
#A determination of the significance level of the test. &amp;lt;br /&amp;gt; The significance level of a test is a value that should be decided upon by the agent interpreting the data before the data are viewed, and is compared against the p-value or any other statistic calculated after the test has been performed.&lt;br /&gt;
#an indication of  the size or importance of the observed effect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In ROOT&lt;br /&gt;
&lt;br /&gt;
 double ROOT::Math::chisquared_cdf_c (double &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;, double &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;, double x0 = 0 )		&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;=\int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
  TMath::Prob(&amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
You can turn things around the other way by defining P-value to be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: P-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\infty}^{\chi^2}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx = 1-(p-value)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here P-value would be the probability, under the assumption of a hypothesis H , of obtaining data at least as '''compatible''' with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
The P-value is the probability of observing a sample statistic as extreme as the test statistic.&lt;br /&gt;
&lt;br /&gt;
http://stattrek.com/chi-square-test/goodness-of-fit.aspx&lt;br /&gt;
&lt;br /&gt;
=F-test=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt; \chi^2&amp;lt;/math&amp;gt; test in the previous section measures both the difference between the data and the fit function as well as the difference between the fit function and the &amp;quot;parent&amp;quot; function.  The &amp;quot;parent&amp;quot; function is the true functional dependence of the data.&lt;br /&gt;
&lt;br /&gt;
The F-test can be used to determine the difference between the fit function and the parent function, to more directly test if you have come up with the correct fit function.&lt;br /&gt;
&lt;br /&gt;
== F-distribution==&lt;br /&gt;
&lt;br /&gt;
If, for example, you are comparing the Ratio of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; values from 2 different fits to the data then the function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then since &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 \equiv \sum_i^N \frac{\left (y_i-y(x_i)\right)^2}{\sigma_i^2}= \frac{s^2}{\sigma^2}&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; = constant&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and assuming &amp;lt;math&amp;gt;\sigma_1 = \sigma_2&amp;lt;/math&amp;gt; (same data set)&lt;br /&gt;
&lt;br /&gt;
one can argue that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_1}{\nu_1}} = \frac{s_1^2}{\sigma_1^2}\frac{\sigma_2^2}{s_2^2} \frac{\nu_2}{\nu_1} = \frac{\nu_2}{\nu_1} \frac{s_1^2}{s_2^2}&amp;lt;/math&amp;gt; = function that is independent of the error &amp;lt;math&amp;gt; \sigma&amp;lt;/math&amp;gt; intrinsic to the data thus the function is only comparing the fit residuals&amp;lt;math&amp;gt; (s^2)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The Function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
can be shown to follow the following probability distribution.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1, \nu_2) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
which is available in ROOT as&lt;br /&gt;
&lt;br /&gt;
 ROOT::Math::fdistribution_pdf(double x, double n, double m, double x0 = 0 )&lt;br /&gt;
&lt;br /&gt;
== The chi^2 difference test==&lt;br /&gt;
&lt;br /&gt;
In a similar fashion as above, one can define another ratio which is based on the difference between the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value using 2 different .&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} = \frac{\frac{\chi^2_1 - \chi^2_2}{\nu_1-\nu_2}}{\frac{\chi^2_1}{\nu_1}} =  \frac{\frac{\chi^2(m) - \chi^2(n)}{n-m}}{\frac{\chi^2(m)}{(N-m-1)}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under the null hypothesis that model 2 does not provide a significantly better fit than model 1, F will have an F distribution, with &amp;lt;math&amp;gt;(\nu_2 − \nu_1, \nu_1)&amp;lt;/math&amp;gt; degrees of freedom. The null hypothesis is rejected if the F calculated from the data is greater than the critical value of the F  distribution for some desired false-rejection probability (e.g. 0.05).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to determine if you need to continue adding parameters to the fit then you can consider an F-test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_1}{N-m-1}} = \frac{\Delta \chi^2}{\chi^2_{\nu}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above statistic will again follow the F-distribution &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1=1, \nu_2=N-m-1) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note: Some will define the fraction with respect to the next order fit&lt;br /&gt;
::&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_2}{N-m}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The multiple correlation coefficient test==&lt;br /&gt;
&lt;br /&gt;
While the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference F-test above is useful to evaluate the impact of adding another fit parameter, you will also want to evaluate the &amp;quot;goodness&amp;quot; of the entire fit in a manner which can be related to a correlation coefficient R (in this case it is a multiple-correlation coefficient because the fit can go beyond linear).&lt;br /&gt;
&lt;br /&gt;
I usually suggest that you do this after the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference test unless you have a theoretical model which constrains the number of fit parameters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Least Squares fit to an Arbitrary Function=&lt;br /&gt;
&lt;br /&gt;
The above Least Squares fit methods work well if your fit function has a linear dependence on the fit parameters.&lt;br /&gt;
&lt;br /&gt;
:ie; &amp;lt;math&amp;gt;y(x) =\sum_i^n a_i x^i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
such fit functions give you a set of  &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations that are linear in the parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; when you are minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  The &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation of this set of n equations is shown below.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your fit equation looks like&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) =a_1 e^{\frac{1}{2} \left (\frac{x-a_2}{a_3}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
now your set of equations minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; are non-linear with respect to the parameters.  You can't take separate the &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; term from the &amp;lt;math&amp;gt;f_k(x_i)&amp;lt;/math&amp;gt; function and thereby solve the system by inverting your matrix&lt;br /&gt;
:&amp;lt;math&amp;gt; \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
Because of this, a direct analytical solution is difficult (you need to find roots of coupled non-linear equations) and one resorts to approximation methods for the solution.&lt;br /&gt;
== Grid search==&lt;br /&gt;
&lt;br /&gt;
The fundamentals of the grid search is to basically change all parameters over some natural range to generate a hypersurface in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; and look for the smallest value of of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; that appears on the hypersurface.&lt;br /&gt;
&lt;br /&gt;
In Lab 15 you will generate this hypersurface for the simple least squares linear fit tot he Temp -vs- Voltage data in lab 14.  Your surface might look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:TF_ErrAna_Lab15.png | 200 px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As shown above, I have plotted the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; as a function of  the y-Intercept &amp;lt;math&amp;gt;(a_1)&amp;lt;/math&amp;gt; and the slope &amp;lt;math&amp;gt;(a_2)&amp;lt;/math&amp;gt;.  The minimum in this hypersurface should coincide with the values of Y-intercept=&amp;lt;math&amp;gt;a_1=-1.01&amp;lt;/math&amp;gt; and Slope=&amp;lt;math&amp;gt;a_2=0.0431&amp;lt;/math&amp;gt; from the linear regression solution.&lt;br /&gt;
&lt;br /&gt;
If we return to the beginning, the original problem is to use the max-likelihood principle on the probability function for finding the correct fit using the data. &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i -y(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
To maximize the probability of finding the best fit we need to find by minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right ) \frac{\partial \left( - y(x_i) \right)}{\partial a_k} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively you could also express \chi^2 in terms of the probability distributions as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n)  \propto e^{- \frac{1}{2}\chi^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Grid search method==&lt;br /&gt;
&lt;br /&gt;
The grid search method relies on the independence of the fit parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt;.    The search starts by selecting initial values for all parameters and then searching for a &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; minimum for one of the fit parameters.  You then set the parameter to the determined value and repeat the procedure on the next parameter.  You keep repeating until a stable value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found.&lt;br /&gt;
&lt;br /&gt;
Obviously, this method strongly depends on the initial values selected for the parameters.&lt;br /&gt;
&lt;br /&gt;
==Parameter Errors==&lt;br /&gt;
&lt;br /&gt;
Returning back to the equation&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
it may be observed that &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; represents the error in the parameter &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; and that the error alters &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once a minimum is found, the parabolic nature of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;  dependence on a single parameter is such that an increase in 1 standard deviation in the parameter results in an increase in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can turn this to determine the error in the fit parameter by determining how much the parameter must increase (or decrease) in order to increase &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Gradient Search Method==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Gradient search method improves on the Grid search method by attempting to search in a direction towards the minima as determined by simultaneous changes in all parameters.  The change in each parameter may differ in magnitude and is adjustable for each parameter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference  Go Back] [[Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91703</id>
		<title>TF ErrorAna StatInference</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91703"/>
		<updated>2014-03-21T19:13:30Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* The Method of Determinants */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Statistical Inference&lt;br /&gt;
=Frequentist -vs- Bayesian Inference=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When it comes to testing a hypothesis, there are  two dominant philosophies known as a Frequentist or a Bayesian perspective.&lt;br /&gt;
&lt;br /&gt;
The dominant discussion for this class will be from the Frequentist perspective.&lt;br /&gt;
&lt;br /&gt;
== frequentist statistical inference==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made using a null-hypothesis test; that is, one that answers the question, Assuming that the null hypothesis is true, what is the probability of observing a value for the test statistic that is at least as extreme as the value that was actually observed?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The relative frequency of occurrence of an event, in a number of repetitions of the experiment, is a measure of the probability of that event.&lt;br /&gt;
Thus, if &amp;lt;math&amp;gt;n_t&amp;lt;/math&amp;gt; is the total number of trials and &amp;lt;math&amp;gt;n_x&amp;lt;/math&amp;gt; is the number of trials where the event x occurred, the probability P(x) of the event occurring will be approximated by the relative frequency as follows:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) \approx \frac{n_x}{n_t}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Bayesian inference.==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made by using evidence or observations  to update or to newly infer the probability that a hypothesis may be true. The name &amp;quot;Bayesian&amp;quot; comes from the frequent use of Bayes' theorem in the inference process.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem relates the conditional probability, conditional and marginal probability, marginal probabilities of events ''A'' and ''B'', where ''B'' has a non-vanishing probability:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}\,\! &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Each term in Bayes' theorem has a conventional name:&lt;br /&gt;
* P(''A'') is the prior probability or marginal probability of ''A''. It is &amp;quot;prior&amp;quot; in the sense that it does not take into account any information about ''B''.&lt;br /&gt;
* P(''B'') is the prior or marginal probability of ''B'', and acts as a normalizing constant. &lt;br /&gt;
* P(''A''|''B'') is the conditional probability of ''A'', given ''B''. It is also called the posterior probability because it is derived from or depends upon the specified value of ''B''.&lt;br /&gt;
* P(''B''|''A'') is the conditional probability of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem in this form gives a mathematical representation of how the conditional probabability of event ''A'' given ''B'' is related to the converse conditional probabablity of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
Suppose there is a school having 60% boys and 40% girls as students. &lt;br /&gt;
&lt;br /&gt;
The female students wear trousers or skirts in equal numbers; the boys all wear trousers. &lt;br /&gt;
&lt;br /&gt;
An observer sees a (random) student from a distance; all the observer can see is that this student is wearing trousers. &lt;br /&gt;
&lt;br /&gt;
What is the probability this student is a girl? &lt;br /&gt;
&lt;br /&gt;
The correct answer can be computed using Bayes' theorem.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P(A) \equiv&amp;lt;/math&amp;gt; probability that  the student observed is a girl = 0.4&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B) \equiv&amp;lt;/math&amp;gt; probability  that the student observed is wearing trousers = 60+20/100 = 0.8&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B|A) \equiv&amp;lt;/math&amp;gt; probability the student is wearing trousers given that the student is a girl&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A|B) \equiv&amp;lt;/math&amp;gt; probability the student is a girl given that the student is wearing trousers&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(B|A) =0.5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B|A) P(A)}{P(B)} = \frac{0.5 \times 0.4}{0.8} = 0.25.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Method of Maximum Likelihood=&lt;br /&gt;
&lt;br /&gt;
;The principle of maximum likelihood is the cornerstone of Frequentist based hypothesis testing and may be written as&lt;br /&gt;
:The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observation is a maximum.&lt;br /&gt;
&lt;br /&gt;
= Least Squares Fit to a Line=&lt;br /&gt;
&lt;br /&gt;
== Applying the Method of Maximum Likelihood==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our object is to find the best straight line fit for an expected linear relationship between dependent variate &amp;lt;math&amp;gt;(y)&amp;lt;/math&amp;gt;  and independent variate &amp;lt;math&amp;gt;(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we let &amp;lt;math&amp;gt;y_0(x)&amp;lt;/math&amp;gt; represent the &amp;quot;true&amp;quot; linear relationship between independent variate &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and dependent variate &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_o(x) = A + B x&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i = \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A,B) = \Pi \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \left ( \frac{1}{\sigma \sqrt{2 \pi}}\right )^N e^{- \frac{1}{2} \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt; = Max&lt;br /&gt;
 &lt;br /&gt;
The maximum probability will result in the best values for &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\chi^2 = \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2 = \sum \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2&amp;lt;/math&amp;gt; = Min&lt;br /&gt;
&lt;br /&gt;
The min for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; occurs when the function is a minimum for both parameters A &amp;amp; B : ie&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \sum \frac{ \partial}{\partial A} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \sum \frac{ \partial}{\partial B} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;If &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt; : All variances are the same  (weighted fits don't make this assumption)&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial A} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial B} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum x_i \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum  x_i \left( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above equations represent a set of simultaneous of 2 equations and 2 unknowns which can be solved.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum y_i = \sum A + B \sum x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum x_i y_i = A \sum x_i + B \sum x_i^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} \sum y_i \\ \sum x_i y_i \end{array} \right) = \left( \begin{array}{cc} N &amp;amp; \sum x_i\\&lt;br /&gt;
\sum x_i &amp;amp; \sum x_i^2 \end{array} \right)\left( \begin{array}{c} A \\ B \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The Method of Determinants ===&lt;br /&gt;
for the matrix problem:&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} y_1 \\ y_2 \end{array} \right) = \left( \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right)\left( \begin{array}{c} x_1 \\ x_2 \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the above can be written as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_1 = a_{11} x_1 + a_{12} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;y_2 = a_{21} x_1 + a_{22} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
solving for &amp;lt;math&amp;gt;x_1&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;y_1&amp;lt;/math&amp;gt; is known&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;a_{22} (y_1 = a_{11} x_1 + a_{12} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-a_{12} (y_2 = a_{21} x_1 + a_{22} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow a_{22} y_1 - a_{12} y_2 = (a_{11}a_{22} - a_{12}a_{21}) x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| = \left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right| x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
: &amp;lt;math&amp;gt;x_1 = \frac{\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{12} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt; similarly &amp;lt;math&amp;gt;x_2 = \frac{\left| \begin{array}{cc}  a_{11} &amp;amp; y_1 \\  a_{21} &amp;amp; y_2  \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{12} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Solutions exist as long as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{12} &amp;amp; a_{22} \end{array} \right| \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apply the method of determinant for the maximum likelihood problem above&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the uncertainty in all the measurements is not the same then we need to insert &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; back into the system of equations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Uncertainty in the Linear Fit parameters==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
By definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}&amp;lt;/math&amp;gt;  : there are 2 parameters and N data points which translate to (N-2) degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
The least square fit ( assuming equal &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;) has the following solution for the parameters A &amp;amp; B as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\sum y_i \sum x_i^2 - \sum x_i \sum x_i y_i  }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \frac{(1) \sum x_i^2 - x_j\sum x_i   }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt; only the &amp;lt;math&amp;gt;y_j&amp;lt;/math&amp;gt; term survives &lt;br /&gt;
:&amp;lt;math&amp;gt; = D \left ( \sum x_i^2 - x_j\sum x_i \right)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D \equiv \frac{1}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}=\frac{1}{N\sum x_i^2 - \sum x_i \sum x_i }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_{j=1}^N \sigma_j^2 \left ( D \left ( \sum x_i^2 - x_j\sum x_i \right) \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2 - x_j\sum x_i \right )^2&amp;lt;/math&amp;gt; : Assume &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2\right )^2  + \left (x_j\sum x_i \right )^2 - 2 \left ( \sum x_i^2 x_j \sum x_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  \sum_{j=1}^N  \left ( \sum x_i^2\right ) +  \sum_{j=1}^N x_j^2  -  2 \sum x_i \sum_{j=1}^N x_j  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum x_i \sum_{j=1}^N x_j  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sum x_i \sum_{j=1}^N x_j \approx \sum_{j=1}^N x_j^2&amp;lt;/math&amp;gt; Both sums are over the number of observations &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum_{j=1}^N x_j^2  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2 \frac{1}{D}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \sigma^2  \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we redefine our origin in the linear plot so the line is centered a x=0 then &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum{x_i} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2} = \frac{\sum x_i^2 }{N\sum x_i^2 } = \frac{1}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{1}{N} = \frac{\sigma^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: The parameter A is the y-intercept so it makes some intuitive sense that the error in the Y -intercept would be dominated by the statistical error in Y&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in B===&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}= \frac{\partial}{\partial y_j} D \left ( N\sum x_i y_i -\sum x_i \sum y_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;=  D \left ( N x_j - \sum x_i \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 D^2 \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;\sigma_j = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N^2 x_j^2 - 2N x_j \sum x_i + \sum x_i^2\right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum_{j=1}^Nx_j^2 - 2N \sum x_i \sum_{j=1}^N x_j  + \sum x_i^2 \sum_{j=1}^N  \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum x_i^2 - 2N \sum x_i \sum_{j=1}^N x_j  + N \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - 2 \sum x_i \sum_{j=1}^N x_j  +  \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = N D^2 \sigma^2 \frac{1}{D} = ND \sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_B^2= \frac{N \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}} {N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Linear Fit with error==&lt;br /&gt;
&lt;br /&gt;
From above we know that if each independent measurement has a different error &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; then the fit parameters are given by &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D = \frac{1}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right| }= &lt;br /&gt;
\frac{1}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [ \sum\frac{ y_i}{\sigma_i^2} \sum\frac{ x_i^2}{\sigma_i^2}- \sum\frac{ x_i}{\sigma_i^2}  \sum\frac{ x_i y_i}{\sigma_i^2}  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ] =  \sum_{j=1}^N \left [ \sigma_j^2  D^2 \left ( \frac{ 1}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \sigma_j^2  \left [  \frac{ 1}{\sigma_j^4} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \frac{ x_j}{\sigma_j^4} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \frac{ x_j^2}{\sigma_j^4} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2   \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ 1}{\sigma_i^2} \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 -  \left( \sum \frac{ x_j}{\sigma_j^2} \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= D    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)  = \frac{ \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) }{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Compare with the unweighted error&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in B ===&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [\sum \frac{1}{\sigma_i^2}\sum \frac{x_i y_i}{\sigma_i^2}  - \sum \frac{ y_i}{\sigma_i^2}\sum \frac{x_i}{\sigma_i^2}   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_{j=1}^N \left [ \sigma_j^2 \left (  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \left [  \frac{ 1}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} + \left (\frac{1}{\sigma_j}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} + \left (\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 1 \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D \sum_{j=1}^N \frac{ 1}{\sigma_j^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_B^2 = \frac{  \sum\frac{ 1}{\sigma_i^2}}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Correlation Probability==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the Linear Fit has been performed, the next step will be to determine a probability that the Fit is actually describing the data.&lt;br /&gt;
&lt;br /&gt;
The Correlation Probability (R) is one method used to try and determine this probability.&lt;br /&gt;
&lt;br /&gt;
This method evaluates the &amp;quot;slope&amp;quot; parameter to determine if there is a correlation between the dependent and independent variables , x and y.&lt;br /&gt;
&lt;br /&gt;
The liner fit above was done to minimize \chi^2 for the following model&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y = A + Bx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What if we turn this  equation around such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = A^{\prime} + B^{\prime}y&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;B^{\prime} =0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is complete correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  &lt;br /&gt;
:&amp;lt;math&amp;gt;A = -\frac{A^{\prime}}{B^{\prime}}&amp;lt;/math&amp;gt;        and     &amp;lt;math&amp;gt;B = \frac{1}{B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: and &amp;lt;math&amp;gt;BB^{\prime} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So one can define a metric BB^{\prime} which has the natural range between 0 and 1 such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;R \equiv \sqrt{B B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
since&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and one can show that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B^{\prime} = \frac{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum y_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum y_i  &amp;amp; \sum y_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;R = \sqrt{ \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  } \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=   \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{\sqrt{\left( N\sum x_i^2 - \sum x_i \sum x_i  \right ) \left (N\sum y_i^2 - \sum y_i \sum y_i\right)  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:The correlation coefficient (R) CAN'T be used to indicate the degree of correlation.  The probability distribution &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; can be derived from a 2-D gaussian but knowledge of the correlation coefficient of the parent population &amp;lt;math&amp;gt;(\rho)&amp;lt;/math&amp;gt; is required to evaluate R of the sample distribution.&lt;br /&gt;
&lt;br /&gt;
Instead one assumes a correlation of &amp;lt;math&amp;gt;\rho=0&amp;lt;/math&amp;gt; in the parent distribution and then compares the sample value of &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; with what you would get if there were no correlation.&lt;br /&gt;
&lt;br /&gt;
The smaller &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; is the more likely that the data are correlated and that the linear fit is correct.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_R(R,\nu) = \frac{1}{\sqrt{\pi}} \frac{\Gamma\left ( \frac{\nu+1}{2}\right )}{\Gamma \left ( \frac{\nu}{2}\right)} \left( 1-R^2\right)^{\left( \frac{\nu-2}{2}\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
= Probability that any random sample of UNCORRELATED data would yield the correlation coefficient &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\Gamma(x) = \int_0^{\infty} t^{x-1}e^{-t} dt&amp;lt;/math&amp;gt;&lt;br /&gt;
 (ROOT::Math::tgamma(double x) )&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu=N-2&amp;lt;/math&amp;gt; = number of degrees of freedom = Number of data points - Number of parameters in fit function&lt;br /&gt;
&lt;br /&gt;
Derived in &amp;quot;Pugh and Winslow, The Analysis of Physical Measurement, Addison-Wesley Publishing, 1966.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Least Squares fit to a Polynomial=&lt;br /&gt;
&lt;br /&gt;
Let's assume we wish to now fit a polynomial instead of a straight line to the data.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) = \sum_{j=0}^{n} a_j x^{n}=\sum_{j=0}^{n} a_j f_j(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f_j(x) =&amp;lt;/math&amp;gt; a function which does not depend on &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i(a_0,a_1, \cdots ,a_n) = \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;a_n&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once again the probability is maximized when the numerator of the exponential is a minimum&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
The minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \frac{\partial \left( - \sum_{j=0}^{n} a_j f_j(x_i) \right)}{\partial a_k}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2 \sum_i^N  \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2\sum_i^N  \frac{1}{\sigma_i^2} \left (  -  f_k(x_i) \right) \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) =0&amp;lt;/math&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
: &amp;lt;math&amp;gt;\Rightarrow \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =  \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}  \sum_{j=0}^{n} a_j f_j(x_i)=  \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You now have a system of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; coupled equations for the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; with each equation summing over the &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; measurements.&lt;br /&gt;
&lt;br /&gt;
The first equation &amp;lt;math&amp;gt;(f_1)&amp;lt;/math&amp;gt; looks like this&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_i^N f_1(x_i) \frac{y_i}{\sigma_i^2} = \sum_i^N \frac{f_1(x_i)}{\sigma_i^2} \left ( a_1 f_1(x_i) + a_2 f_2(x_i) + \cdots a_n f_n(x_i)\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could use the method of determinants as we did to find the parameters &amp;lt;math&amp;gt;(a_n)&amp;lt;/math&amp;gt; for a linear fit but it is more convenient to use matrices in a technique referred to as regression analysis&lt;br /&gt;
&lt;br /&gt;
==Regression Analysis==&lt;br /&gt;
&lt;br /&gt;
The parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; in the previous section are linear parameters to a general function which may be a polynomial.&lt;br /&gt;
&lt;br /&gt;
The system of equations is composed of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations where the &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation is given as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
may be represented in matrix form as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\beta_k= \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{kj} = \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or in matrix form&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha} = \left ( \begin{matrix} \alpha_{11}  &amp;amp; \alpha_{12} &amp;amp; \cdots &amp;amp; \alpha_{1j} \\ \alpha_{21}  &amp;amp; \alpha_{22}&amp;amp;\cdots&amp;amp;\alpha_{2j} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1} &amp;amp;\alpha_{k2} &amp;amp;\cdots &amp;amp;\alpha_{kj}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
; the objective is to find the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
: To find &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; just invert the matrix&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \tilde{\beta} = \tilde{a} \tilde{\alpha} \right) \tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{\alpha}\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \Rightarrow  \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Thus if you invert the matrix &amp;lt;math&amp;gt;\tilde{\alpha}&amp;lt;/math&amp;gt; you find &amp;lt;math&amp;gt;\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt; and as a result the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Matrix inversion==&lt;br /&gt;
&lt;br /&gt;
The first thing to note is that for the inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A})&amp;lt;/math&amp;gt; to exist its determinant can not be zero&lt;br /&gt;
: &amp;lt;math&amp;gt;\left |\tilde{A} \right | \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A}^{-1})&amp;lt;/math&amp;gt; is defined such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{A}^{-1} = \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we divide both sides by the matrix &amp;lt;math&amp;gt;\tilde {A}&amp;lt;/math&amp;gt; then we have&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A}^{-1} = \frac{\tilde{1}}{\tilde{A} }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above ratio of the unity matrix to matrix &amp;lt;math&amp;gt;\tilde{A}&amp;lt;/math&amp;gt; is always equal to &amp;lt;math&amp;gt;\tilde{A}^{-1}&amp;lt;/math&amp;gt; as long as both the numerator and denominator are multiplied by the same constant factor.&lt;br /&gt;
&lt;br /&gt;
If we do such operations we can transform the ratio such that the denominator has the unity matrix and then the numerator will have the inverse matrix.  &lt;br /&gt;
&lt;br /&gt;
This is the principle of Gauss-Jordan Elimination.&lt;br /&gt;
&lt;br /&gt;
===Gauss-Jordan Elimination===&lt;br /&gt;
If Gauss–Jordan elimination is applied on a square matrix, it can be used to calculate the inverse matrix. This can be done by augmenting the square matrix with the identity matrix of the same dimensions, and through the following matrix operations:&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{1} \Rightarrow&lt;br /&gt;
 \tilde{1} \tilde{A}^{-1} .&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the original square matrix, &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;, is given by the following expression:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 \\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 \\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, after augmenting by the identity, the following is obtained:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A}\tilde{1} = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By performing elementary row operations on the &amp;lt;math&amp;gt;\tilde{A}\tilde{1}&amp;lt;/math&amp;gt; matrix until it reaches reduced row echelon form, the following is the final result:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1}\tilde{A}^{-1}  = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 &amp;amp; \frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1 &amp;amp; \frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix augmentation can now be undone, which gives the following:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}\qquad&lt;br /&gt;
 \tilde{A}^{-1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
\frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
\frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
\frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
:&amp;lt;math&amp;gt; &lt;br /&gt;
 \tilde{A}^{-1} =\frac{1}{4}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}=\frac{1}{det(A)}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
A matrix is non-singular (meaning that it has an inverse matrix) if and only if the identity matrix can be obtained using only elementary row operations.&lt;br /&gt;
&lt;br /&gt;
== Error Matrix==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
Where the definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - \sum_{j=0}^{n} a_j f_j(x_i) \right)^2}{N -n}&amp;lt;/math&amp;gt;  : there are &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; parameters and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; data points which translate to &amp;lt;math&amp;gt;(N-n)&amp;lt;/math&amp;gt; degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
Applying this for the parameter &amp;lt;math&amp;gt;a_k&amp;lt;/math&amp;gt; indicates that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k}^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial a_k}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;But what if there are covariances?&lt;br /&gt;
In that case the following general expression applies&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = &amp;lt;/math&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha}^{-1} = \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n) = ( \beta_1, \beta_2, \cdots , \beta_n) \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow  a_k = \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = \frac{\partial }{\partial y_i} \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\partial }{\partial y_i} \sum_j^n \left( \sum_i^N f_j(x_i) \frac{y_i}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt; :only one &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; in the sum over &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; survives the derivative&lt;br /&gt;
&lt;br /&gt;
similarly&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_l}{\partial y_i} = \sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
substituting&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^N \left [ \sigma_i^2  \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}\sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right)\alpha_{pl}^{-1} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;math&amp;gt; \sigma_i^2&amp;lt;/math&amp;gt; term appears on the  top and bottom.&lt;br /&gt;
;Move the outer most sum to the inside&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 =  \sum_j^n \left(   \alpha_{jk}^{-1}\sum_p^n \sum_i^N  \frac{f_j(x_i)  f_p(x_i)}{\sigma_i^2} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n  \alpha_{jk}^{-1}\sum_p^n \left(  \alpha_{jp} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n \alpha_{jk}^{-1}\tilde{1}_{jl}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{1}_{jl}&amp;lt;/math&amp;gt;  = the &amp;lt;math&amp;gt;j,l&amp;lt;/math&amp;gt; element of the unity matrix = 1&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{jk} = \alpha_{kj} &amp;lt;/math&amp;gt; : the matrix is symmetric.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sigma_{a_k,a_l}^2 =  \sum_j^n \alpha_{kj}^{-1}\tilde{1}_{jl}= \alpha_{kl}^{-1}&amp;lt;/math&amp;gt; = Covariance/Error matrix element&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse matrix &amp;lt;math&amp;gt;\alpha_{kl}^{-1}&amp;lt;/math&amp;gt; tells you the variance and covariance for the calculation of the total error.&lt;br /&gt;
&lt;br /&gt;
;Remember&lt;br /&gt;
:&amp;lt;math&amp;gt;Y = \sum_i^n a_i f_i(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_i}^2 = \alpha_{ii}^{-1}&amp;lt;/math&amp;gt;= error in the parameters&lt;br /&gt;
: &amp;lt;math&amp;gt;s^2 = \sum_i^n \sum_j^n \left ( \frac{\partial Y}{\partial a_i}\frac{\partial Y}{\partial a_j}\right) \sigma_{ij}=\sum_i^n \sum_j^n \left ( f_i(x)f_j(x)\right) \sigma_{ij} &amp;lt;/math&amp;gt; = error in the model's prediction&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^n \sum_j^n  x^{j+i} \sigma_{ij}&amp;lt;/math&amp;gt; If Y is a power series in x &amp;lt;math&amp;gt;(f_i(x) = x^i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Chi-Square Distribution=&lt;br /&gt;
&lt;br /&gt;
The above tools allow you to perform a least squares fit to data using high order polynomials.&lt;br /&gt;
&lt;br /&gt;
; The question though is how high in order should you go?  (ie; when should you stop adding parameters to the fit?)&lt;br /&gt;
&lt;br /&gt;
One argument is that you should stop increasing the number of parameters if they don't change much.  The parameters, using the above techniques, are correlated such that when you add another order to the fit all the parameters have the potential to change in value.  If their change is miniscule then you can ague that adding higher orders to the fit does not change the fit.  There are techniu&lt;br /&gt;
&lt;br /&gt;
A quantitative way to express the above uses the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value of the fit.  The above technique seeks to minimize &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  So if you add higher orders and more parameters but the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value does not change appreciably, you could argue that the fit is a good as you can make it with the given function.&lt;br /&gt;
&lt;br /&gt;
==Derivation==&lt;br /&gt;
&lt;br /&gt;
If you assume a series of measurements have a Gaussian parent distribution&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) = \frac{1}{\sqrt{2 \pi} \sigma} e^{-\frac{1}{2} \left ( \frac{x - \bar{x}}{\sigma}\right)^2}&amp;lt;/math&amp;gt; = probability of measuring the value &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; from a Gaussian distribution with s sample mean&amp;lt;math&amp;gt; \bar{x}&amp;lt;/math&amp;gt; from a parent distribution of with &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you break the above probability up into intervals of &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt; then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) d\bar{x}&amp;lt;/math&amp;gt; = probability that &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; lies within the interval &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you make N measurements of two variates (x_i and y_i) which may be correlated using a function with n parameters.&lt;br /&gt;
&lt;br /&gt;
== Chi-Square Cumulative Distribution==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution function is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\nu) = \frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; y(x_i)&amp;lt;/math&amp;gt; = the assumed functional dependence of the data on &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; =  N - n -1 = degrees of freedom&lt;br /&gt;
:&amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points&lt;br /&gt;
:&amp;lt;math&amp;gt;n + 1&amp;lt;/math&amp;gt; = number of parameters used in the fit (n coefficients + 1 constant term)&lt;br /&gt;
:&amp;lt;math&amp;gt; \Gamma(z) = \int_0^\infty  t^{z-1} e^{-t}\,dt\;&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above tells you the probability of getting the value of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; given the number of degrees of freedom &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; in your fit.&lt;br /&gt;
&lt;br /&gt;
While it is useful to know what the probability is of getting a value of &amp;lt;math&amp;gt;\chi^2 = x&amp;lt;/math&amp;gt; it is more useful to use the cumulative distribution function.&lt;br /&gt;
&lt;br /&gt;
The probability that the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; you received from your fit is as larger or larger than what you would get from a function described by the parent distribution is given &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty} P(x,\nu) dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A graph of &amp;lt;math&amp;gt;P(x,\nu)&amp;lt;/math&amp;gt; shows that the mean value of this function is &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow P(\chi^2 = \nu ,\nu)=\int_{\chi^2=\nu}^{\infty} P(x,\nu) dx = 0.5&amp;lt;/math&amp;gt; = probability of getting the average value for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; or larger is 0.5.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Reduced Chi-square==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced Chi-square &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2_{\nu} = \frac{\chi^2}{\nu}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the mean of &amp;lt;math&amp;gt;P(x,\nu) = \nu&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
then the mean of &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(\frac{x}{\nu},\nu) = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A reduced chi-squared distribution &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; has a mean value of 1.&lt;br /&gt;
&lt;br /&gt;
==p-Value==&lt;br /&gt;
&lt;br /&gt;
For the above fits,&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The p-value is defined as the cumulative &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution&lt;br /&gt;
&lt;br /&gt;
: p-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The p-value is the probability, under the assumption of a hypothesis H , of obtaining data at least as incompatible with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  small p-values are good.&lt;br /&gt;
&lt;br /&gt;
;The p-value is NOT&lt;br /&gt;
&lt;br /&gt;
# the probability that the null hypothesis is true. (This false conclusion is used to justify the &amp;quot;rule&amp;quot; of considering a result to be significant if its p-value is very small (near zero).) &amp;lt;br /&amp;gt; In fact, frequentist statistics does not, and cannot, attach probabilities to hypotheses. &lt;br /&gt;
# the probability that a finding is &amp;quot;merely a fluke.&amp;quot; (Again, this conclusion arises from the &amp;quot;rule&amp;quot; that small p-values indicate significant differences.) &amp;lt;br /&amp;gt; As the calculation of a p-value is based on the ''assumption'' that a finding is the product of chance alone, it patently cannot also be used to gauge the probability of that assumption being true. This is subtly different from the real meaning which is that the p-value is the chance that null hypothesis explains the result: the result might not be &amp;quot;merely a fluke,&amp;quot; ''and'' be explicable by the null hypothesis with confidence equal to the p-value.&lt;br /&gt;
#the probability of falsely rejecting the null hypothesis. &lt;br /&gt;
#the probability that a replicating experiment would not yield the same conclusion.&lt;br /&gt;
#1&amp;amp;nbsp;−&amp;amp;nbsp;(p-value) is ''not'' the probability of the alternative hypothesis being true.&lt;br /&gt;
#A determination of the significance level of the test. &amp;lt;br /&amp;gt; The significance level of a test is a value that should be decided upon by the agent interpreting the data before the data are viewed, and is compared against the p-value or any other statistic calculated after the test has been performed.&lt;br /&gt;
#an indication of  the size or importance of the observed effect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In ROOT&lt;br /&gt;
&lt;br /&gt;
 double ROOT::Math::chisquared_cdf_c (double &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;, double &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;, double x0 = 0 )		&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;=\int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
  TMath::Prob(&amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
You can turn things around the other way by defining P-value to be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: P-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\infty}^{\chi^2}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx = 1-(p-value)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here P-value would be the probability, under the assumption of a hypothesis H , of obtaining data at least as '''compatible''' with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
The P-value is the probability of observing a sample statistic as extreme as the test statistic.&lt;br /&gt;
&lt;br /&gt;
http://stattrek.com/chi-square-test/goodness-of-fit.aspx&lt;br /&gt;
&lt;br /&gt;
=F-test=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt; \chi^2&amp;lt;/math&amp;gt; test in the previous section measures both the difference between the data and the fit function as well as the difference between the fit function and the &amp;quot;parent&amp;quot; function.  The &amp;quot;parent&amp;quot; function is the true functional dependence of the data.&lt;br /&gt;
&lt;br /&gt;
The F-test can be used to determine the difference between the fit function and the parent function, to more directly test if you have come up with the correct fit function.&lt;br /&gt;
&lt;br /&gt;
== F-distribution==&lt;br /&gt;
&lt;br /&gt;
If, for example, you are comparing the Ratio of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; values from 2 different fits to the data then the function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then since &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 \equiv \sum_i^N \frac{\left (y_i-y(x_i)\right)^2}{\sigma_i^2}= \frac{s^2}{\sigma^2}&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; = constant&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and assuming &amp;lt;math&amp;gt;\sigma_1 = \sigma_2&amp;lt;/math&amp;gt; (same data set)&lt;br /&gt;
&lt;br /&gt;
one can argue that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_1}{\nu_1}} = \frac{s_1^2}{\sigma_1^2}\frac{\sigma_2^2}{s_2^2} \frac{\nu_2}{\nu_1} = \frac{\nu_2}{\nu_1} \frac{s_1^2}{s_2^2}&amp;lt;/math&amp;gt; = function that is independent of the error &amp;lt;math&amp;gt; \sigma&amp;lt;/math&amp;gt; intrinsic to the data thus the function is only comparing the fit residuals&amp;lt;math&amp;gt; (s^2)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The Function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
can be shown to follow the following probability distribution.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1, \nu_2) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
which is available in ROOT as&lt;br /&gt;
&lt;br /&gt;
 ROOT::Math::fdistribution_pdf(double x, double n, double m, double x0 = 0 )&lt;br /&gt;
&lt;br /&gt;
== The chi^2 difference test==&lt;br /&gt;
&lt;br /&gt;
In a similar fashion as above, one can define another ratio which is based on the difference between the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value using 2 different .&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} = \frac{\frac{\chi^2_1 - \chi^2_2}{\nu_1-\nu_2}}{\frac{\chi^2_1}{\nu_1}} =  \frac{\frac{\chi^2(m) - \chi^2(n)}{n-m}}{\frac{\chi^2(m)}{(N-m-1)}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under the null hypothesis that model 2 does not provide a significantly better fit than model 1, F will have an F distribution, with &amp;lt;math&amp;gt;(\nu_2 − \nu_1, \nu_1)&amp;lt;/math&amp;gt; degrees of freedom. The null hypothesis is rejected if the F calculated from the data is greater than the critical value of the F  distribution for some desired false-rejection probability (e.g. 0.05).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to determine if you need to continue adding parameters to the fit then you can consider an F-test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_1}{N-m-1}} = \frac{\Delta \chi^2}{\chi^2_{\nu}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above statistic will again follow the F-distribution &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1=1, \nu_2=N-m-1) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note: Some will define the fraction with respect to the next order fit&lt;br /&gt;
::&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_2}{N-m}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The multiple correlation coefficient test==&lt;br /&gt;
&lt;br /&gt;
While the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference F-test above is useful to evaluate the impact of adding another fit parameter, you will also want to evaluate the &amp;quot;goodness&amp;quot; of the entire fit in a manner which can be related to a correlation coefficient R (in this case it is a multiple-correlation coefficient because the fit can go beyond linear).&lt;br /&gt;
&lt;br /&gt;
I usually suggest that you do this after the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference test unless you have a theoretical model which constrains the number of fit parameters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Least Squares fit to an Arbitrary Function=&lt;br /&gt;
&lt;br /&gt;
The above Least Squares fit methods work well if your fit function has a linear dependence on the fit parameters.&lt;br /&gt;
&lt;br /&gt;
:ie; &amp;lt;math&amp;gt;y(x) =\sum_i^n a_i x^i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
such fit functions give you a set of  &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations that are linear in the parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; when you are minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  The &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation of this set of n equations is shown below.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your fit equation looks like&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) =a_1 e^{\frac{1}{2} \left (\frac{x-a_2}{a_3}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
now your set of equations minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; are non-linear with respect to the parameters.  You can't take separate the &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; term from the &amp;lt;math&amp;gt;f_k(x_i)&amp;lt;/math&amp;gt; function and thereby solve the system by inverting your matrix&lt;br /&gt;
:&amp;lt;math&amp;gt; \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
Because of this, a direct analytical solution is difficult (you need to find roots of coupled non-linear equations) and one resorts to approximation methods for the solution.&lt;br /&gt;
== Grid search==&lt;br /&gt;
&lt;br /&gt;
The fundamentals of the grid search is to basically change all parameters over some natural range to generate a hypersurface in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; and look for the smallest value of of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; that appears on the hypersurface.&lt;br /&gt;
&lt;br /&gt;
In Lab 15 you will generate this hypersurface for the simple least squares linear fit tot he Temp -vs- Voltage data in lab 14.  Your surface might look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:TF_ErrAna_Lab15.png | 200 px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As shown above, I have plotted the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; as a function of  the y-Intercept &amp;lt;math&amp;gt;(a_1)&amp;lt;/math&amp;gt; and the slope &amp;lt;math&amp;gt;(a_2)&amp;lt;/math&amp;gt;.  The minimum in this hypersurface should coincide with the values of Y-intercept=&amp;lt;math&amp;gt;a_1=-1.01&amp;lt;/math&amp;gt; and Slope=&amp;lt;math&amp;gt;a_2=0.0431&amp;lt;/math&amp;gt; from the linear regression solution.&lt;br /&gt;
&lt;br /&gt;
If we return to the beginning, the original problem is to use the max-likelihood principle on the probability function for finding the correct fit using the data. &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i -y(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
To maximize the probability of finding the best fit we need to find by minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right ) \frac{\partial \left( - y(x_i) \right)}{\partial a_k} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively you could also express \chi^2 in terms of the probability distributions as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n)  \propto e^{- \frac{1}{2}\chi^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Grid search method==&lt;br /&gt;
&lt;br /&gt;
The grid search method relies on the independence of the fit parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt;.    The search starts by selecting initial values for all parameters and then searching for a &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; minimum for one of the fit parameters.  You then set the parameter to the determined value and repeat the procedure on the next parameter.  You keep repeating until a stable value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found.&lt;br /&gt;
&lt;br /&gt;
Obviously, this method strongly depends on the initial values selected for the parameters.&lt;br /&gt;
&lt;br /&gt;
==Parameter Errors==&lt;br /&gt;
&lt;br /&gt;
Returning back to the equation&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
it may be observed that &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; represents the error in the parameter &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; and that the error alters &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once a minimum is found, the parabolic nature of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;  dependence on a single parameter is such that an increase in 1 standard deviation in the parameter results in an increase in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can turn this to determine the error in the fit parameter by determining how much the parameter must increase (or decrease) in order to increase &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Gradient Search Method==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Gradient search method improves on the Grid search method by attempting to search in a direction towards the minima as determined by simultaneous changes in all parameters.  The change in each parameter may differ in magnitude and is adjustable for each parameter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference  Go Back] [[Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91702</id>
		<title>TF ErrorAna StatInference</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91702"/>
		<updated>2014-03-21T19:13:01Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* The Method of Determinants */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Statistical Inference&lt;br /&gt;
=Frequentist -vs- Bayesian Inference=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When it comes to testing a hypothesis, there are  two dominant philosophies known as a Frequentist or a Bayesian perspective.&lt;br /&gt;
&lt;br /&gt;
The dominant discussion for this class will be from the Frequentist perspective.&lt;br /&gt;
&lt;br /&gt;
== frequentist statistical inference==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made using a null-hypothesis test; that is, one that answers the question, Assuming that the null hypothesis is true, what is the probability of observing a value for the test statistic that is at least as extreme as the value that was actually observed?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The relative frequency of occurrence of an event, in a number of repetitions of the experiment, is a measure of the probability of that event.&lt;br /&gt;
Thus, if &amp;lt;math&amp;gt;n_t&amp;lt;/math&amp;gt; is the total number of trials and &amp;lt;math&amp;gt;n_x&amp;lt;/math&amp;gt; is the number of trials where the event x occurred, the probability P(x) of the event occurring will be approximated by the relative frequency as follows:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) \approx \frac{n_x}{n_t}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Bayesian inference.==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made by using evidence or observations  to update or to newly infer the probability that a hypothesis may be true. The name &amp;quot;Bayesian&amp;quot; comes from the frequent use of Bayes' theorem in the inference process.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem relates the conditional probability, conditional and marginal probability, marginal probabilities of events ''A'' and ''B'', where ''B'' has a non-vanishing probability:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}\,\! &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Each term in Bayes' theorem has a conventional name:&lt;br /&gt;
* P(''A'') is the prior probability or marginal probability of ''A''. It is &amp;quot;prior&amp;quot; in the sense that it does not take into account any information about ''B''.&lt;br /&gt;
* P(''B'') is the prior or marginal probability of ''B'', and acts as a normalizing constant. &lt;br /&gt;
* P(''A''|''B'') is the conditional probability of ''A'', given ''B''. It is also called the posterior probability because it is derived from or depends upon the specified value of ''B''.&lt;br /&gt;
* P(''B''|''A'') is the conditional probability of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem in this form gives a mathematical representation of how the conditional probabability of event ''A'' given ''B'' is related to the converse conditional probabablity of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
Suppose there is a school having 60% boys and 40% girls as students. &lt;br /&gt;
&lt;br /&gt;
The female students wear trousers or skirts in equal numbers; the boys all wear trousers. &lt;br /&gt;
&lt;br /&gt;
An observer sees a (random) student from a distance; all the observer can see is that this student is wearing trousers. &lt;br /&gt;
&lt;br /&gt;
What is the probability this student is a girl? &lt;br /&gt;
&lt;br /&gt;
The correct answer can be computed using Bayes' theorem.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P(A) \equiv&amp;lt;/math&amp;gt; probability that  the student observed is a girl = 0.4&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B) \equiv&amp;lt;/math&amp;gt; probability  that the student observed is wearing trousers = 60+20/100 = 0.8&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B|A) \equiv&amp;lt;/math&amp;gt; probability the student is wearing trousers given that the student is a girl&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A|B) \equiv&amp;lt;/math&amp;gt; probability the student is a girl given that the student is wearing trousers&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(B|A) =0.5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B|A) P(A)}{P(B)} = \frac{0.5 \times 0.4}{0.8} = 0.25.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Method of Maximum Likelihood=&lt;br /&gt;
&lt;br /&gt;
;The principle of maximum likelihood is the cornerstone of Frequentist based hypothesis testing and may be written as&lt;br /&gt;
:The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observation is a maximum.&lt;br /&gt;
&lt;br /&gt;
= Least Squares Fit to a Line=&lt;br /&gt;
&lt;br /&gt;
== Applying the Method of Maximum Likelihood==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our object is to find the best straight line fit for an expected linear relationship between dependent variate &amp;lt;math&amp;gt;(y)&amp;lt;/math&amp;gt;  and independent variate &amp;lt;math&amp;gt;(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we let &amp;lt;math&amp;gt;y_0(x)&amp;lt;/math&amp;gt; represent the &amp;quot;true&amp;quot; linear relationship between independent variate &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and dependent variate &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_o(x) = A + B x&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i = \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A,B) = \Pi \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \left ( \frac{1}{\sigma \sqrt{2 \pi}}\right )^N e^{- \frac{1}{2} \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt; = Max&lt;br /&gt;
 &lt;br /&gt;
The maximum probability will result in the best values for &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\chi^2 = \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2 = \sum \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2&amp;lt;/math&amp;gt; = Min&lt;br /&gt;
&lt;br /&gt;
The min for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; occurs when the function is a minimum for both parameters A &amp;amp; B : ie&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \sum \frac{ \partial}{\partial A} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \sum \frac{ \partial}{\partial B} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;If &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt; : All variances are the same  (weighted fits don't make this assumption)&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial A} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial B} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum x_i \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum  x_i \left( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above equations represent a set of simultaneous of 2 equations and 2 unknowns which can be solved.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum y_i = \sum A + B \sum x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum x_i y_i = A \sum x_i + B \sum x_i^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} \sum y_i \\ \sum x_i y_i \end{array} \right) = \left( \begin{array}{cc} N &amp;amp; \sum x_i\\&lt;br /&gt;
\sum x_i &amp;amp; \sum x_i^2 \end{array} \right)\left( \begin{array}{c} A \\ B \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The Method of Determinants ===&lt;br /&gt;
for the matrix problem:&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} y_1 \\ y_2 \end{array} \right) = \left( \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right)\left( \begin{array}{c} x_1 \\ x_2 \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the above can be written as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_1 = a_{11} x_1 + a_{12} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;y_2 = a_{21} x_1 + a_{22} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
solving for &amp;lt;math&amp;gt;x_1&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;y_1&amp;lt;/math&amp;gt; is known&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;a_{22} (y_1 = a_{11} x_1 + a_{12} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-a_{12} (y_2 = a_{21} x_1 + a_{22} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow a_{22} y_1 - a_{12} y_2 = (a_{11}a_{22} - a_{12}a_{21}) x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
:$\begin{matrix}a&amp;amp;a\\a&amp;amp;a\end{matrix}$&lt;br /&gt;
: &amp;lt;math&amp;gt;\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| = \left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{12} &amp;amp; a_{22} \end{array} \right| x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
: &amp;lt;math&amp;gt;x_1 = \frac{\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{12} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt; similarly &amp;lt;math&amp;gt;x_2 = \frac{\left| \begin{array}{cc}  a_{11} &amp;amp; y_1 \\  a_{21} &amp;amp; y_2  \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{12} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Solutions exist as long as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{12} &amp;amp; a_{22} \end{array} \right| \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apply the method of determinant for the maximum likelihood problem above&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the uncertainty in all the measurements is not the same then we need to insert &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; back into the system of equations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Uncertainty in the Linear Fit parameters==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
By definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}&amp;lt;/math&amp;gt;  : there are 2 parameters and N data points which translate to (N-2) degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
The least square fit ( assuming equal &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;) has the following solution for the parameters A &amp;amp; B as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\sum y_i \sum x_i^2 - \sum x_i \sum x_i y_i  }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \frac{(1) \sum x_i^2 - x_j\sum x_i   }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt; only the &amp;lt;math&amp;gt;y_j&amp;lt;/math&amp;gt; term survives &lt;br /&gt;
:&amp;lt;math&amp;gt; = D \left ( \sum x_i^2 - x_j\sum x_i \right)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D \equiv \frac{1}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}=\frac{1}{N\sum x_i^2 - \sum x_i \sum x_i }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_{j=1}^N \sigma_j^2 \left ( D \left ( \sum x_i^2 - x_j\sum x_i \right) \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2 - x_j\sum x_i \right )^2&amp;lt;/math&amp;gt; : Assume &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2\right )^2  + \left (x_j\sum x_i \right )^2 - 2 \left ( \sum x_i^2 x_j \sum x_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  \sum_{j=1}^N  \left ( \sum x_i^2\right ) +  \sum_{j=1}^N x_j^2  -  2 \sum x_i \sum_{j=1}^N x_j  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum x_i \sum_{j=1}^N x_j  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sum x_i \sum_{j=1}^N x_j \approx \sum_{j=1}^N x_j^2&amp;lt;/math&amp;gt; Both sums are over the number of observations &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum_{j=1}^N x_j^2  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2 \frac{1}{D}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \sigma^2  \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we redefine our origin in the linear plot so the line is centered a x=0 then &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum{x_i} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2} = \frac{\sum x_i^2 }{N\sum x_i^2 } = \frac{1}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{1}{N} = \frac{\sigma^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: The parameter A is the y-intercept so it makes some intuitive sense that the error in the Y -intercept would be dominated by the statistical error in Y&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in B===&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}= \frac{\partial}{\partial y_j} D \left ( N\sum x_i y_i -\sum x_i \sum y_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;=  D \left ( N x_j - \sum x_i \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 D^2 \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;\sigma_j = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N^2 x_j^2 - 2N x_j \sum x_i + \sum x_i^2\right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum_{j=1}^Nx_j^2 - 2N \sum x_i \sum_{j=1}^N x_j  + \sum x_i^2 \sum_{j=1}^N  \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum x_i^2 - 2N \sum x_i \sum_{j=1}^N x_j  + N \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - 2 \sum x_i \sum_{j=1}^N x_j  +  \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = N D^2 \sigma^2 \frac{1}{D} = ND \sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_B^2= \frac{N \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}} {N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Linear Fit with error==&lt;br /&gt;
&lt;br /&gt;
From above we know that if each independent measurement has a different error &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; then the fit parameters are given by &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D = \frac{1}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right| }= &lt;br /&gt;
\frac{1}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [ \sum\frac{ y_i}{\sigma_i^2} \sum\frac{ x_i^2}{\sigma_i^2}- \sum\frac{ x_i}{\sigma_i^2}  \sum\frac{ x_i y_i}{\sigma_i^2}  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ] =  \sum_{j=1}^N \left [ \sigma_j^2  D^2 \left ( \frac{ 1}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \sigma_j^2  \left [  \frac{ 1}{\sigma_j^4} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \frac{ x_j}{\sigma_j^4} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \frac{ x_j^2}{\sigma_j^4} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2   \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ 1}{\sigma_i^2} \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 -  \left( \sum \frac{ x_j}{\sigma_j^2} \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= D    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)  = \frac{ \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) }{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Compare with the unweighted error&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in B ===&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [\sum \frac{1}{\sigma_i^2}\sum \frac{x_i y_i}{\sigma_i^2}  - \sum \frac{ y_i}{\sigma_i^2}\sum \frac{x_i}{\sigma_i^2}   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_{j=1}^N \left [ \sigma_j^2 \left (  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \left [  \frac{ 1}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} + \left (\frac{1}{\sigma_j}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} + \left (\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 1 \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D \sum_{j=1}^N \frac{ 1}{\sigma_j^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_B^2 = \frac{  \sum\frac{ 1}{\sigma_i^2}}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Correlation Probability==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the Linear Fit has been performed, the next step will be to determine a probability that the Fit is actually describing the data.&lt;br /&gt;
&lt;br /&gt;
The Correlation Probability (R) is one method used to try and determine this probability.&lt;br /&gt;
&lt;br /&gt;
This method evaluates the &amp;quot;slope&amp;quot; parameter to determine if there is a correlation between the dependent and independent variables , x and y.&lt;br /&gt;
&lt;br /&gt;
The liner fit above was done to minimize \chi^2 for the following model&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y = A + Bx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What if we turn this  equation around such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = A^{\prime} + B^{\prime}y&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;B^{\prime} =0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is complete correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  &lt;br /&gt;
:&amp;lt;math&amp;gt;A = -\frac{A^{\prime}}{B^{\prime}}&amp;lt;/math&amp;gt;        and     &amp;lt;math&amp;gt;B = \frac{1}{B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: and &amp;lt;math&amp;gt;BB^{\prime} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So one can define a metric BB^{\prime} which has the natural range between 0 and 1 such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;R \equiv \sqrt{B B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
since&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and one can show that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B^{\prime} = \frac{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum y_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum y_i  &amp;amp; \sum y_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;R = \sqrt{ \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  } \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=   \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{\sqrt{\left( N\sum x_i^2 - \sum x_i \sum x_i  \right ) \left (N\sum y_i^2 - \sum y_i \sum y_i\right)  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:The correlation coefficient (R) CAN'T be used to indicate the degree of correlation.  The probability distribution &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; can be derived from a 2-D gaussian but knowledge of the correlation coefficient of the parent population &amp;lt;math&amp;gt;(\rho)&amp;lt;/math&amp;gt; is required to evaluate R of the sample distribution.&lt;br /&gt;
&lt;br /&gt;
Instead one assumes a correlation of &amp;lt;math&amp;gt;\rho=0&amp;lt;/math&amp;gt; in the parent distribution and then compares the sample value of &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; with what you would get if there were no correlation.&lt;br /&gt;
&lt;br /&gt;
The smaller &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; is the more likely that the data are correlated and that the linear fit is correct.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_R(R,\nu) = \frac{1}{\sqrt{\pi}} \frac{\Gamma\left ( \frac{\nu+1}{2}\right )}{\Gamma \left ( \frac{\nu}{2}\right)} \left( 1-R^2\right)^{\left( \frac{\nu-2}{2}\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
= Probability that any random sample of UNCORRELATED data would yield the correlation coefficient &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\Gamma(x) = \int_0^{\infty} t^{x-1}e^{-t} dt&amp;lt;/math&amp;gt;&lt;br /&gt;
 (ROOT::Math::tgamma(double x) )&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu=N-2&amp;lt;/math&amp;gt; = number of degrees of freedom = Number of data points - Number of parameters in fit function&lt;br /&gt;
&lt;br /&gt;
Derived in &amp;quot;Pugh and Winslow, The Analysis of Physical Measurement, Addison-Wesley Publishing, 1966.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Least Squares fit to a Polynomial=&lt;br /&gt;
&lt;br /&gt;
Let's assume we wish to now fit a polynomial instead of a straight line to the data.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) = \sum_{j=0}^{n} a_j x^{n}=\sum_{j=0}^{n} a_j f_j(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f_j(x) =&amp;lt;/math&amp;gt; a function which does not depend on &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i(a_0,a_1, \cdots ,a_n) = \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;a_n&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once again the probability is maximized when the numerator of the exponential is a minimum&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
The minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \frac{\partial \left( - \sum_{j=0}^{n} a_j f_j(x_i) \right)}{\partial a_k}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2 \sum_i^N  \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2\sum_i^N  \frac{1}{\sigma_i^2} \left (  -  f_k(x_i) \right) \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) =0&amp;lt;/math&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
: &amp;lt;math&amp;gt;\Rightarrow \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =  \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}  \sum_{j=0}^{n} a_j f_j(x_i)=  \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You now have a system of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; coupled equations for the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; with each equation summing over the &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; measurements.&lt;br /&gt;
&lt;br /&gt;
The first equation &amp;lt;math&amp;gt;(f_1)&amp;lt;/math&amp;gt; looks like this&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_i^N f_1(x_i) \frac{y_i}{\sigma_i^2} = \sum_i^N \frac{f_1(x_i)}{\sigma_i^2} \left ( a_1 f_1(x_i) + a_2 f_2(x_i) + \cdots a_n f_n(x_i)\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could use the method of determinants as we did to find the parameters &amp;lt;math&amp;gt;(a_n)&amp;lt;/math&amp;gt; for a linear fit but it is more convenient to use matrices in a technique referred to as regression analysis&lt;br /&gt;
&lt;br /&gt;
==Regression Analysis==&lt;br /&gt;
&lt;br /&gt;
The parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; in the previous section are linear parameters to a general function which may be a polynomial.&lt;br /&gt;
&lt;br /&gt;
The system of equations is composed of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations where the &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation is given as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
may be represented in matrix form as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\beta_k= \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{kj} = \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or in matrix form&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha} = \left ( \begin{matrix} \alpha_{11}  &amp;amp; \alpha_{12} &amp;amp; \cdots &amp;amp; \alpha_{1j} \\ \alpha_{21}  &amp;amp; \alpha_{22}&amp;amp;\cdots&amp;amp;\alpha_{2j} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1} &amp;amp;\alpha_{k2} &amp;amp;\cdots &amp;amp;\alpha_{kj}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
; the objective is to find the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
: To find &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; just invert the matrix&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \tilde{\beta} = \tilde{a} \tilde{\alpha} \right) \tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{\alpha}\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \Rightarrow  \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Thus if you invert the matrix &amp;lt;math&amp;gt;\tilde{\alpha}&amp;lt;/math&amp;gt; you find &amp;lt;math&amp;gt;\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt; and as a result the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Matrix inversion==&lt;br /&gt;
&lt;br /&gt;
The first thing to note is that for the inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A})&amp;lt;/math&amp;gt; to exist its determinant can not be zero&lt;br /&gt;
: &amp;lt;math&amp;gt;\left |\tilde{A} \right | \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A}^{-1})&amp;lt;/math&amp;gt; is defined such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{A}^{-1} = \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we divide both sides by the matrix &amp;lt;math&amp;gt;\tilde {A}&amp;lt;/math&amp;gt; then we have&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A}^{-1} = \frac{\tilde{1}}{\tilde{A} }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above ratio of the unity matrix to matrix &amp;lt;math&amp;gt;\tilde{A}&amp;lt;/math&amp;gt; is always equal to &amp;lt;math&amp;gt;\tilde{A}^{-1}&amp;lt;/math&amp;gt; as long as both the numerator and denominator are multiplied by the same constant factor.&lt;br /&gt;
&lt;br /&gt;
If we do such operations we can transform the ratio such that the denominator has the unity matrix and then the numerator will have the inverse matrix.  &lt;br /&gt;
&lt;br /&gt;
This is the principle of Gauss-Jordan Elimination.&lt;br /&gt;
&lt;br /&gt;
===Gauss-Jordan Elimination===&lt;br /&gt;
If Gauss–Jordan elimination is applied on a square matrix, it can be used to calculate the inverse matrix. This can be done by augmenting the square matrix with the identity matrix of the same dimensions, and through the following matrix operations:&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{1} \Rightarrow&lt;br /&gt;
 \tilde{1} \tilde{A}^{-1} .&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the original square matrix, &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;, is given by the following expression:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 \\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 \\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, after augmenting by the identity, the following is obtained:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A}\tilde{1} = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By performing elementary row operations on the &amp;lt;math&amp;gt;\tilde{A}\tilde{1}&amp;lt;/math&amp;gt; matrix until it reaches reduced row echelon form, the following is the final result:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1}\tilde{A}^{-1}  = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 &amp;amp; \frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1 &amp;amp; \frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix augmentation can now be undone, which gives the following:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}\qquad&lt;br /&gt;
 \tilde{A}^{-1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
\frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
\frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
\frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
:&amp;lt;math&amp;gt; &lt;br /&gt;
 \tilde{A}^{-1} =\frac{1}{4}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}=\frac{1}{det(A)}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
A matrix is non-singular (meaning that it has an inverse matrix) if and only if the identity matrix can be obtained using only elementary row operations.&lt;br /&gt;
&lt;br /&gt;
== Error Matrix==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
Where the definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - \sum_{j=0}^{n} a_j f_j(x_i) \right)^2}{N -n}&amp;lt;/math&amp;gt;  : there are &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; parameters and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; data points which translate to &amp;lt;math&amp;gt;(N-n)&amp;lt;/math&amp;gt; degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
Applying this for the parameter &amp;lt;math&amp;gt;a_k&amp;lt;/math&amp;gt; indicates that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k}^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial a_k}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;But what if there are covariances?&lt;br /&gt;
In that case the following general expression applies&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = &amp;lt;/math&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha}^{-1} = \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n) = ( \beta_1, \beta_2, \cdots , \beta_n) \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow  a_k = \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = \frac{\partial }{\partial y_i} \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\partial }{\partial y_i} \sum_j^n \left( \sum_i^N f_j(x_i) \frac{y_i}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt; :only one &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; in the sum over &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; survives the derivative&lt;br /&gt;
&lt;br /&gt;
similarly&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_l}{\partial y_i} = \sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
substituting&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^N \left [ \sigma_i^2  \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}\sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right)\alpha_{pl}^{-1} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;math&amp;gt; \sigma_i^2&amp;lt;/math&amp;gt; term appears on the  top and bottom.&lt;br /&gt;
;Move the outer most sum to the inside&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 =  \sum_j^n \left(   \alpha_{jk}^{-1}\sum_p^n \sum_i^N  \frac{f_j(x_i)  f_p(x_i)}{\sigma_i^2} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n  \alpha_{jk}^{-1}\sum_p^n \left(  \alpha_{jp} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n \alpha_{jk}^{-1}\tilde{1}_{jl}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{1}_{jl}&amp;lt;/math&amp;gt;  = the &amp;lt;math&amp;gt;j,l&amp;lt;/math&amp;gt; element of the unity matrix = 1&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{jk} = \alpha_{kj} &amp;lt;/math&amp;gt; : the matrix is symmetric.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sigma_{a_k,a_l}^2 =  \sum_j^n \alpha_{kj}^{-1}\tilde{1}_{jl}= \alpha_{kl}^{-1}&amp;lt;/math&amp;gt; = Covariance/Error matrix element&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse matrix &amp;lt;math&amp;gt;\alpha_{kl}^{-1}&amp;lt;/math&amp;gt; tells you the variance and covariance for the calculation of the total error.&lt;br /&gt;
&lt;br /&gt;
;Remember&lt;br /&gt;
:&amp;lt;math&amp;gt;Y = \sum_i^n a_i f_i(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_i}^2 = \alpha_{ii}^{-1}&amp;lt;/math&amp;gt;= error in the parameters&lt;br /&gt;
: &amp;lt;math&amp;gt;s^2 = \sum_i^n \sum_j^n \left ( \frac{\partial Y}{\partial a_i}\frac{\partial Y}{\partial a_j}\right) \sigma_{ij}=\sum_i^n \sum_j^n \left ( f_i(x)f_j(x)\right) \sigma_{ij} &amp;lt;/math&amp;gt; = error in the model's prediction&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^n \sum_j^n  x^{j+i} \sigma_{ij}&amp;lt;/math&amp;gt; If Y is a power series in x &amp;lt;math&amp;gt;(f_i(x) = x^i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Chi-Square Distribution=&lt;br /&gt;
&lt;br /&gt;
The above tools allow you to perform a least squares fit to data using high order polynomials.&lt;br /&gt;
&lt;br /&gt;
; The question though is how high in order should you go?  (ie; when should you stop adding parameters to the fit?)&lt;br /&gt;
&lt;br /&gt;
One argument is that you should stop increasing the number of parameters if they don't change much.  The parameters, using the above techniques, are correlated such that when you add another order to the fit all the parameters have the potential to change in value.  If their change is miniscule then you can ague that adding higher orders to the fit does not change the fit.  There are techniu&lt;br /&gt;
&lt;br /&gt;
A quantitative way to express the above uses the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value of the fit.  The above technique seeks to minimize &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  So if you add higher orders and more parameters but the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value does not change appreciably, you could argue that the fit is a good as you can make it with the given function.&lt;br /&gt;
&lt;br /&gt;
==Derivation==&lt;br /&gt;
&lt;br /&gt;
If you assume a series of measurements have a Gaussian parent distribution&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) = \frac{1}{\sqrt{2 \pi} \sigma} e^{-\frac{1}{2} \left ( \frac{x - \bar{x}}{\sigma}\right)^2}&amp;lt;/math&amp;gt; = probability of measuring the value &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; from a Gaussian distribution with s sample mean&amp;lt;math&amp;gt; \bar{x}&amp;lt;/math&amp;gt; from a parent distribution of with &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you break the above probability up into intervals of &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt; then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) d\bar{x}&amp;lt;/math&amp;gt; = probability that &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; lies within the interval &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you make N measurements of two variates (x_i and y_i) which may be correlated using a function with n parameters.&lt;br /&gt;
&lt;br /&gt;
== Chi-Square Cumulative Distribution==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution function is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\nu) = \frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; y(x_i)&amp;lt;/math&amp;gt; = the assumed functional dependence of the data on &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; =  N - n -1 = degrees of freedom&lt;br /&gt;
:&amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points&lt;br /&gt;
:&amp;lt;math&amp;gt;n + 1&amp;lt;/math&amp;gt; = number of parameters used in the fit (n coefficients + 1 constant term)&lt;br /&gt;
:&amp;lt;math&amp;gt; \Gamma(z) = \int_0^\infty  t^{z-1} e^{-t}\,dt\;&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above tells you the probability of getting the value of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; given the number of degrees of freedom &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; in your fit.&lt;br /&gt;
&lt;br /&gt;
While it is useful to know what the probability is of getting a value of &amp;lt;math&amp;gt;\chi^2 = x&amp;lt;/math&amp;gt; it is more useful to use the cumulative distribution function.&lt;br /&gt;
&lt;br /&gt;
The probability that the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; you received from your fit is as larger or larger than what you would get from a function described by the parent distribution is given &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty} P(x,\nu) dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A graph of &amp;lt;math&amp;gt;P(x,\nu)&amp;lt;/math&amp;gt; shows that the mean value of this function is &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow P(\chi^2 = \nu ,\nu)=\int_{\chi^2=\nu}^{\infty} P(x,\nu) dx = 0.5&amp;lt;/math&amp;gt; = probability of getting the average value for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; or larger is 0.5.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Reduced Chi-square==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced Chi-square &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2_{\nu} = \frac{\chi^2}{\nu}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the mean of &amp;lt;math&amp;gt;P(x,\nu) = \nu&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
then the mean of &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(\frac{x}{\nu},\nu) = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A reduced chi-squared distribution &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; has a mean value of 1.&lt;br /&gt;
&lt;br /&gt;
==p-Value==&lt;br /&gt;
&lt;br /&gt;
For the above fits,&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The p-value is defined as the cumulative &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution&lt;br /&gt;
&lt;br /&gt;
: p-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The p-value is the probability, under the assumption of a hypothesis H , of obtaining data at least as incompatible with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  small p-values are good.&lt;br /&gt;
&lt;br /&gt;
;The p-value is NOT&lt;br /&gt;
&lt;br /&gt;
# the probability that the null hypothesis is true. (This false conclusion is used to justify the &amp;quot;rule&amp;quot; of considering a result to be significant if its p-value is very small (near zero).) &amp;lt;br /&amp;gt; In fact, frequentist statistics does not, and cannot, attach probabilities to hypotheses. &lt;br /&gt;
# the probability that a finding is &amp;quot;merely a fluke.&amp;quot; (Again, this conclusion arises from the &amp;quot;rule&amp;quot; that small p-values indicate significant differences.) &amp;lt;br /&amp;gt; As the calculation of a p-value is based on the ''assumption'' that a finding is the product of chance alone, it patently cannot also be used to gauge the probability of that assumption being true. This is subtly different from the real meaning which is that the p-value is the chance that null hypothesis explains the result: the result might not be &amp;quot;merely a fluke,&amp;quot; ''and'' be explicable by the null hypothesis with confidence equal to the p-value.&lt;br /&gt;
#the probability of falsely rejecting the null hypothesis. &lt;br /&gt;
#the probability that a replicating experiment would not yield the same conclusion.&lt;br /&gt;
#1&amp;amp;nbsp;−&amp;amp;nbsp;(p-value) is ''not'' the probability of the alternative hypothesis being true.&lt;br /&gt;
#A determination of the significance level of the test. &amp;lt;br /&amp;gt; The significance level of a test is a value that should be decided upon by the agent interpreting the data before the data are viewed, and is compared against the p-value or any other statistic calculated after the test has been performed.&lt;br /&gt;
#an indication of  the size or importance of the observed effect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In ROOT&lt;br /&gt;
&lt;br /&gt;
 double ROOT::Math::chisquared_cdf_c (double &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;, double &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;, double x0 = 0 )		&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;=\int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
  TMath::Prob(&amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
You can turn things around the other way by defining P-value to be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: P-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\infty}^{\chi^2}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx = 1-(p-value)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here P-value would be the probability, under the assumption of a hypothesis H , of obtaining data at least as '''compatible''' with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
The P-value is the probability of observing a sample statistic as extreme as the test statistic.&lt;br /&gt;
&lt;br /&gt;
http://stattrek.com/chi-square-test/goodness-of-fit.aspx&lt;br /&gt;
&lt;br /&gt;
=F-test=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt; \chi^2&amp;lt;/math&amp;gt; test in the previous section measures both the difference between the data and the fit function as well as the difference between the fit function and the &amp;quot;parent&amp;quot; function.  The &amp;quot;parent&amp;quot; function is the true functional dependence of the data.&lt;br /&gt;
&lt;br /&gt;
The F-test can be used to determine the difference between the fit function and the parent function, to more directly test if you have come up with the correct fit function.&lt;br /&gt;
&lt;br /&gt;
== F-distribution==&lt;br /&gt;
&lt;br /&gt;
If, for example, you are comparing the Ratio of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; values from 2 different fits to the data then the function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then since &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 \equiv \sum_i^N \frac{\left (y_i-y(x_i)\right)^2}{\sigma_i^2}= \frac{s^2}{\sigma^2}&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; = constant&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and assuming &amp;lt;math&amp;gt;\sigma_1 = \sigma_2&amp;lt;/math&amp;gt; (same data set)&lt;br /&gt;
&lt;br /&gt;
one can argue that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_1}{\nu_1}} = \frac{s_1^2}{\sigma_1^2}\frac{\sigma_2^2}{s_2^2} \frac{\nu_2}{\nu_1} = \frac{\nu_2}{\nu_1} \frac{s_1^2}{s_2^2}&amp;lt;/math&amp;gt; = function that is independent of the error &amp;lt;math&amp;gt; \sigma&amp;lt;/math&amp;gt; intrinsic to the data thus the function is only comparing the fit residuals&amp;lt;math&amp;gt; (s^2)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The Function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
can be shown to follow the following probability distribution.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1, \nu_2) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
which is available in ROOT as&lt;br /&gt;
&lt;br /&gt;
 ROOT::Math::fdistribution_pdf(double x, double n, double m, double x0 = 0 )&lt;br /&gt;
&lt;br /&gt;
== The chi^2 difference test==&lt;br /&gt;
&lt;br /&gt;
In a similar fashion as above, one can define another ratio which is based on the difference between the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value using 2 different .&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} = \frac{\frac{\chi^2_1 - \chi^2_2}{\nu_1-\nu_2}}{\frac{\chi^2_1}{\nu_1}} =  \frac{\frac{\chi^2(m) - \chi^2(n)}{n-m}}{\frac{\chi^2(m)}{(N-m-1)}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under the null hypothesis that model 2 does not provide a significantly better fit than model 1, F will have an F distribution, with &amp;lt;math&amp;gt;(\nu_2 − \nu_1, \nu_1)&amp;lt;/math&amp;gt; degrees of freedom. The null hypothesis is rejected if the F calculated from the data is greater than the critical value of the F  distribution for some desired false-rejection probability (e.g. 0.05).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to determine if you need to continue adding parameters to the fit then you can consider an F-test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_1}{N-m-1}} = \frac{\Delta \chi^2}{\chi^2_{\nu}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above statistic will again follow the F-distribution &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1=1, \nu_2=N-m-1) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note: Some will define the fraction with respect to the next order fit&lt;br /&gt;
::&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_2}{N-m}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The multiple correlation coefficient test==&lt;br /&gt;
&lt;br /&gt;
While the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference F-test above is useful to evaluate the impact of adding another fit parameter, you will also want to evaluate the &amp;quot;goodness&amp;quot; of the entire fit in a manner which can be related to a correlation coefficient R (in this case it is a multiple-correlation coefficient because the fit can go beyond linear).&lt;br /&gt;
&lt;br /&gt;
I usually suggest that you do this after the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference test unless you have a theoretical model which constrains the number of fit parameters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Least Squares fit to an Arbitrary Function=&lt;br /&gt;
&lt;br /&gt;
The above Least Squares fit methods work well if your fit function has a linear dependence on the fit parameters.&lt;br /&gt;
&lt;br /&gt;
:ie; &amp;lt;math&amp;gt;y(x) =\sum_i^n a_i x^i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
such fit functions give you a set of  &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations that are linear in the parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; when you are minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  The &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation of this set of n equations is shown below.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your fit equation looks like&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) =a_1 e^{\frac{1}{2} \left (\frac{x-a_2}{a_3}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
now your set of equations minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; are non-linear with respect to the parameters.  You can't take separate the &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; term from the &amp;lt;math&amp;gt;f_k(x_i)&amp;lt;/math&amp;gt; function and thereby solve the system by inverting your matrix&lt;br /&gt;
:&amp;lt;math&amp;gt; \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
Because of this, a direct analytical solution is difficult (you need to find roots of coupled non-linear equations) and one resorts to approximation methods for the solution.&lt;br /&gt;
== Grid search==&lt;br /&gt;
&lt;br /&gt;
The fundamentals of the grid search is to basically change all parameters over some natural range to generate a hypersurface in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; and look for the smallest value of of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; that appears on the hypersurface.&lt;br /&gt;
&lt;br /&gt;
In Lab 15 you will generate this hypersurface for the simple least squares linear fit tot he Temp -vs- Voltage data in lab 14.  Your surface might look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:TF_ErrAna_Lab15.png | 200 px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As shown above, I have plotted the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; as a function of  the y-Intercept &amp;lt;math&amp;gt;(a_1)&amp;lt;/math&amp;gt; and the slope &amp;lt;math&amp;gt;(a_2)&amp;lt;/math&amp;gt;.  The minimum in this hypersurface should coincide with the values of Y-intercept=&amp;lt;math&amp;gt;a_1=-1.01&amp;lt;/math&amp;gt; and Slope=&amp;lt;math&amp;gt;a_2=0.0431&amp;lt;/math&amp;gt; from the linear regression solution.&lt;br /&gt;
&lt;br /&gt;
If we return to the beginning, the original problem is to use the max-likelihood principle on the probability function for finding the correct fit using the data. &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i -y(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
To maximize the probability of finding the best fit we need to find by minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right ) \frac{\partial \left( - y(x_i) \right)}{\partial a_k} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively you could also express \chi^2 in terms of the probability distributions as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n)  \propto e^{- \frac{1}{2}\chi^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Grid search method==&lt;br /&gt;
&lt;br /&gt;
The grid search method relies on the independence of the fit parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt;.    The search starts by selecting initial values for all parameters and then searching for a &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; minimum for one of the fit parameters.  You then set the parameter to the determined value and repeat the procedure on the next parameter.  You keep repeating until a stable value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found.&lt;br /&gt;
&lt;br /&gt;
Obviously, this method strongly depends on the initial values selected for the parameters.&lt;br /&gt;
&lt;br /&gt;
==Parameter Errors==&lt;br /&gt;
&lt;br /&gt;
Returning back to the equation&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
it may be observed that &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; represents the error in the parameter &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; and that the error alters &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once a minimum is found, the parabolic nature of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;  dependence on a single parameter is such that an increase in 1 standard deviation in the parameter results in an increase in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can turn this to determine the error in the fit parameter by determining how much the parameter must increase (or decrease) in order to increase &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Gradient Search Method==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Gradient search method improves on the Grid search method by attempting to search in a direction towards the minima as determined by simultaneous changes in all parameters.  The change in each parameter may differ in magnitude and is adjustable for each parameter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference  Go Back] [[Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91701</id>
		<title>TF ErrorAna StatInference</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_StatInference&amp;diff=91701"/>
		<updated>2014-03-21T19:12:10Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* The Method of Determinants */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Statistical Inference&lt;br /&gt;
=Frequentist -vs- Bayesian Inference=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When it comes to testing a hypothesis, there are  two dominant philosophies known as a Frequentist or a Bayesian perspective.&lt;br /&gt;
&lt;br /&gt;
The dominant discussion for this class will be from the Frequentist perspective.&lt;br /&gt;
&lt;br /&gt;
== frequentist statistical inference==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made using a null-hypothesis test; that is, one that answers the question, Assuming that the null hypothesis is true, what is the probability of observing a value for the test statistic that is at least as extreme as the value that was actually observed?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The relative frequency of occurrence of an event, in a number of repetitions of the experiment, is a measure of the probability of that event.&lt;br /&gt;
Thus, if &amp;lt;math&amp;gt;n_t&amp;lt;/math&amp;gt; is the total number of trials and &amp;lt;math&amp;gt;n_x&amp;lt;/math&amp;gt; is the number of trials where the event x occurred, the probability P(x) of the event occurring will be approximated by the relative frequency as follows:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) \approx \frac{n_x}{n_t}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Bayesian inference.==&lt;br /&gt;
&lt;br /&gt;
:Statistical inference is made by using evidence or observations  to update or to newly infer the probability that a hypothesis may be true. The name &amp;quot;Bayesian&amp;quot; comes from the frequent use of Bayes' theorem in the inference process.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem relates the conditional probability, conditional and marginal probability, marginal probabilities of events ''A'' and ''B'', where ''B'' has a non-vanishing probability:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}\,\! &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Each term in Bayes' theorem has a conventional name:&lt;br /&gt;
* P(''A'') is the prior probability or marginal probability of ''A''. It is &amp;quot;prior&amp;quot; in the sense that it does not take into account any information about ''B''.&lt;br /&gt;
* P(''B'') is the prior or marginal probability of ''B'', and acts as a normalizing constant. &lt;br /&gt;
* P(''A''|''B'') is the conditional probability of ''A'', given ''B''. It is also called the posterior probability because it is derived from or depends upon the specified value of ''B''.&lt;br /&gt;
* P(''B''|''A'') is the conditional probability of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
Bayes' theorem in this form gives a mathematical representation of how the conditional probabability of event ''A'' given ''B'' is related to the converse conditional probabablity of ''B'' given ''A''.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
Suppose there is a school having 60% boys and 40% girls as students. &lt;br /&gt;
&lt;br /&gt;
The female students wear trousers or skirts in equal numbers; the boys all wear trousers. &lt;br /&gt;
&lt;br /&gt;
An observer sees a (random) student from a distance; all the observer can see is that this student is wearing trousers. &lt;br /&gt;
&lt;br /&gt;
What is the probability this student is a girl? &lt;br /&gt;
&lt;br /&gt;
The correct answer can be computed using Bayes' theorem.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P(A) \equiv&amp;lt;/math&amp;gt; probability that  the student observed is a girl = 0.4&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B) \equiv&amp;lt;/math&amp;gt; probability  that the student observed is wearing trousers = 60+20/100 = 0.8&lt;br /&gt;
: &amp;lt;math&amp;gt;P(B|A) \equiv&amp;lt;/math&amp;gt; probability the student is wearing trousers given that the student is a girl&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A|B) \equiv&amp;lt;/math&amp;gt; probability the student is a girl given that the student is wearing trousers&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(B|A) =0.5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(A|B) = \frac{P(B|A) P(A)}{P(B)} = \frac{0.5 \times 0.4}{0.8} = 0.25.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Method of Maximum Likelihood=&lt;br /&gt;
&lt;br /&gt;
;The principle of maximum likelihood is the cornerstone of Frequentist based hypothesis testing and may be written as&lt;br /&gt;
:The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observation is a maximum.&lt;br /&gt;
&lt;br /&gt;
= Least Squares Fit to a Line=&lt;br /&gt;
&lt;br /&gt;
== Applying the Method of Maximum Likelihood==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Our object is to find the best straight line fit for an expected linear relationship between dependent variate &amp;lt;math&amp;gt;(y)&amp;lt;/math&amp;gt;  and independent variate &amp;lt;math&amp;gt;(x)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we let &amp;lt;math&amp;gt;y_0(x)&amp;lt;/math&amp;gt; represent the &amp;quot;true&amp;quot; linear relationship between independent variate &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and dependent variate &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_o(x) = A + B x&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i = \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(A,B) = \Pi \frac{1}{\sigma \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \left ( \frac{1}{\sigma \sqrt{2 \pi}}\right )^N e^{- \frac{1}{2} \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt; = Max&lt;br /&gt;
 &lt;br /&gt;
The maximum probability will result in the best values for &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\chi^2 = \sum \left ( \frac{y_i - y_0(x_i)}{\sigma_i}\right)^2 = \sum \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2&amp;lt;/math&amp;gt; = Min&lt;br /&gt;
&lt;br /&gt;
The min for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; occurs when the function is a minimum for both parameters A &amp;amp; B : ie&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \sum \frac{ \partial}{\partial A} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \sum \frac{ \partial}{\partial B} \left ( \frac{y_i - A - B x_i }{\sigma_i}\right)^2=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;If &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt; : All variances are the same  (weighted fits don't make this assumption)&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial A} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial A} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial B} = \frac{1}{\sigma^2}\sum \frac{ \partial}{\partial B} \left ( y_i - A - B x_i \right)^2=\frac{-2}{\sigma^2}\sum x_i \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum \left ( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum  x_i \left( y_i - A - B x_i \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above equations represent a set of simultaneous of 2 equations and 2 unknowns which can be solved.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum y_i = \sum A + B \sum x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum x_i y_i = A \sum x_i + B \sum x_i^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} \sum y_i \\ \sum x_i y_i \end{array} \right) = \left( \begin{array}{cc} N &amp;amp; \sum x_i\\&lt;br /&gt;
\sum x_i &amp;amp; \sum x_i^2 \end{array} \right)\left( \begin{array}{c} A \\ B \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===The Method of Determinants ===&lt;br /&gt;
for the matrix problem:&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{c} y_1 \\ y_2 \end{array} \right) = \left( \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{21} &amp;amp; a_{22} \end{array} \right)\left( \begin{array}{c} x_1 \\ x_2 \end{array} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the above can be written as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y_1 = a_{11} x_1 + a_{12} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;y_2 = a_{21} x_1 + a_{22} x_2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
solving for &amp;lt;math&amp;gt;x_1&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;y_1&amp;lt;/math&amp;gt; is known&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;a_{22} (y_1 = a_{11} x_1 + a_{12} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-a_{12} (y_2 = a_{21} x_1 + a_{22} x_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow a_{22} y_1 - a_{12} y_2 = (a_{11}a_{22} - a_{12}a_{21}) x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
test&lt;br /&gt;
: &amp;lt;math&amp;gt;\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| = \left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{12} &amp;amp; a_{22} \end{array} \right| x_1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
: &amp;lt;math&amp;gt;x_1 = \frac{\left| \begin{array}{cc} y_1 &amp;amp; a_{12}\\ y_2 &amp;amp; a_{22} \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{12} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt; similarly &amp;lt;math&amp;gt;x_2 = \frac{\left| \begin{array}{cc}  a_{11} &amp;amp; y_1 \\  a_{21} &amp;amp; y_2  \end{array} \right| }{\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{12} &amp;amp; a_{22} \end{array} \right| }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Solutions exist as long as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left| \begin{array}{cc} a_{11} &amp;amp; a_{12}\\ a_{12} &amp;amp; a_{22} \end{array} \right| \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apply the method of determinant for the maximum likelihood problem above&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the uncertainty in all the measurements is not the same then we need to insert &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; back into the system of equations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Uncertainty in the Linear Fit parameters==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
By definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}&amp;lt;/math&amp;gt;  : there are 2 parameters and N data points which translate to (N-2) degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
The least square fit ( assuming equal &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;) has the following solution for the parameters A &amp;amp; B as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum y_i &amp;amp; \sum x_i\\ \sum x_i y_i &amp;amp; \sum x_i^2 \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\sum y_i \sum x_i^2 - \sum x_i \sum x_i y_i  }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \frac{(1) \sum x_i^2 - x_j\sum x_i   }{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&amp;lt;/math&amp;gt; only the &amp;lt;math&amp;gt;y_j&amp;lt;/math&amp;gt; term survives &lt;br /&gt;
:&amp;lt;math&amp;gt; = D \left ( \sum x_i^2 - x_j\sum x_i \right)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D \equiv \frac{1}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}=\frac{1}{N\sum x_i^2 - \sum x_i \sum x_i }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_{j=1}^N \sigma_j^2 \left ( D \left ( \sum x_i^2 - x_j\sum x_i \right) \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2 - x_j\sum x_i \right )^2&amp;lt;/math&amp;gt; : Assume &amp;lt;math&amp;gt;\sigma_i = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2 \sum_{j=1}^N  \left ( \sum x_i^2\right )^2  + \left (x_j\sum x_i \right )^2 - 2 \left ( \sum x_i^2 x_j \sum x_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  \sum_{j=1}^N  \left ( \sum x_i^2\right ) +  \sum_{j=1}^N x_j^2  -  2 \sum x_i \sum_{j=1}^N x_j  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum x_i \sum_{j=1}^N x_j  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sum x_i \sum_{j=1}^N x_j \approx \sum_{j=1}^N x_j^2&amp;lt;/math&amp;gt; Both sums are over the number of observations &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2\left [  N  \left ( \sum x_i^2\right ) -  2 \sum_{j=1}^N x_j^2  +  \sum_{j=1}^N x_j^2   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \sigma^2 D^2\sum x_i^2 \frac{1}{D}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \sigma^2  \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we redefine our origin in the linear plot so the line is centered a x=0 then &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum{x_i} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2} = \frac{\sum x_i^2 }{N\sum x_i^2 } = \frac{1}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{1}{N} = \frac{\sigma^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: The parameter A is the y-intercept so it makes some intuitive sense that the error in the Y -intercept would be dominated by the statistical error in Y&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== uncertainty in B===&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} =\frac{\partial}{\partial y_j} \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|}= \frac{\partial}{\partial y_j} D \left ( N\sum x_i y_i -\sum x_i \sum y_i \right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;=  D \left ( N x_j - \sum x_i \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 D^2 \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N x_j - \sum x_i \right)^2 \right ]&amp;lt;/math&amp;gt; assuming &amp;lt;math&amp;gt;\sigma_j = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2 \sum_{j=1}^N \left [  \left ( N^2 x_j^2 - 2N x_j \sum x_i + \sum x_i^2\right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum_{j=1}^Nx_j^2 - 2N \sum x_i \sum_{j=1}^N x_j  + \sum x_i^2 \sum_{j=1}^N  \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 D^2  \left [  \left ( N^2 \sum x_i^2 - 2N \sum x_i \sum_{j=1}^N x_j  + N \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - 2 \sum x_i \sum_{j=1}^N x_j  +  \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= N \sigma^2 D^2  \left [  \left ( N \sum x_i^2 - \sum x_i^2 \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = N D^2 \sigma^2 \frac{1}{D} = ND \sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_B^2= \frac{N \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2}} {N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Linear Fit with error==&lt;br /&gt;
&lt;br /&gt;
From above we know that if each independent measurement has a different error &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; then the fit parameters are given by &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} \;\;\;\; B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in A===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;A = \frac{\left| \begin{array}{cc} \sum\frac{ y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i}{\sigma_i^2}\\ \sum\frac{ x_i y_i}{\sigma_i^2} &amp;amp; \sum\frac{ x_i^2}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;D = \frac{1}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right| }= &lt;br /&gt;
\frac{1}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial A}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [ \sum\frac{ y_i}{\sigma_i^2} \sum\frac{ x_i^2}{\sigma_i^2}- \sum\frac{ x_i}{\sigma_i^2}  \sum\frac{ x_i y_i}{\sigma_i^2}  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_A^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial A}{\partial y_j}\right )^2\right ] =  \sum_{j=1}^N \left [ \sigma_j^2  D^2 \left ( \frac{ 1}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}- \frac{ x_j}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \sigma_j^2  \left [  \frac{ 1}{\sigma_j^4} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \frac{ x_j}{\sigma_j^4} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \frac{ x_j^2}{\sigma_j^4} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2   \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i^2}{\sigma_i^2}\sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2} \right) ^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 - 2 \sum_{j=1}^N \frac{ x_j}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2} + \sum_{j=1}^N \frac{ x_j^2}{\sigma_j^2} \left (\sum\frac{ 1}{\sigma_i^2} \right) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) \left [  \sum_{j=1}^N \frac{ 1}{\sigma_j^2} \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)^2 -  \left( \sum \frac{ x_j}{\sigma_j^2} \right)^2 \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= D    \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right)  = \frac{ \left ( \sum\frac{ x_i^2}{\sigma_i^2}\right) }{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Compare with the unweighted error&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_A^2= \frac{\sum \left( y_i - A - B x_i \right)^2}{N -2} \frac{\sum x_i^2 }{N\sum x_i^2 - \left (\sum x_i \right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Weighted Error in B ===&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{ y_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i y_i}{\sigma_i^2} \end{array}\right|}{\left| \begin{array}{cc} \sum \frac{1}{\sigma_i^2} &amp;amp; \sum \frac{x_i}{\sigma_i^2}\\ \sum \frac{x_i}{\sigma_i^2}  &amp;amp; \sum \frac{x_i^2}{\sigma_i^2} \end{array}\right|}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial B}{\partial y_j} = D\frac{\partial }{\partial y_j} \left [\sum \frac{1}{\sigma_i^2}\sum \frac{x_i y_i}{\sigma_i^2}  - \sum \frac{ y_i}{\sigma_i^2}\sum \frac{x_i}{\sigma_i^2}   \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_B^2 = \sum_{j=1}^N \left [ \sigma_j^2 \left ( \frac{\partial B}{\partial y_j}\right )^2\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_{j=1}^N \left [ \sigma_j^2 \left (  \frac{ D}{\sigma_j^2} \sum\frac{ x_i}{\sigma_i^2}- \frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \left [  \frac{ 1}{\sigma_j^2} \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\frac{1}{\sigma_j^2}\sum\frac{ x_i}{\sigma_i^2} + \left (\frac{1}{\sigma_j}\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 2  \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} + \left (\sum\frac{ x_i}{\sigma_i^2} \right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D^2 \sum_{j=1}^N \frac{ 1}{\sigma_j^2}  \left [  \left (\sum\frac{ x_i}{\sigma_i^2}\right)^2 - 1 \left (\sum\frac{x_i}{\sigma_i^2}\right)\sum\frac{ x_i}{\sigma_i^2} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= D \sum_{j=1}^N \frac{ 1}{\sigma_j^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_B^2 = \frac{  \sum\frac{ 1}{\sigma_i^2}}{\sum \frac{1}{\sigma_i^2} \sum \frac{x_i^2}{\sigma_i^2} - \sum \frac{x_i}{\sigma_i^2} \sum \frac{x_i}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Correlation Probability==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the Linear Fit has been performed, the next step will be to determine a probability that the Fit is actually describing the data.&lt;br /&gt;
&lt;br /&gt;
The Correlation Probability (R) is one method used to try and determine this probability.&lt;br /&gt;
&lt;br /&gt;
This method evaluates the &amp;quot;slope&amp;quot; parameter to determine if there is a correlation between the dependent and independent variables , x and y.&lt;br /&gt;
&lt;br /&gt;
The liner fit above was done to minimize \chi^2 for the following model&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y = A + Bx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What if we turn this  equation around such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = A^{\prime} + B^{\prime}y&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is no correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt;B^{\prime} =0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there is complete correlation between &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; then &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  &lt;br /&gt;
:&amp;lt;math&amp;gt;A = -\frac{A^{\prime}}{B^{\prime}}&amp;lt;/math&amp;gt;        and     &amp;lt;math&amp;gt;B = \frac{1}{B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: and &amp;lt;math&amp;gt;BB^{\prime} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So one can define a metric BB^{\prime} which has the natural range between 0 and 1 such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;R \equiv \sqrt{B B^{\prime}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
since&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B = \frac{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum x_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum x_i  &amp;amp; \sum x_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and one can show that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;B^{\prime} = \frac{\left| \begin{array}{cc} N &amp;amp; \sum x_i\\ \sum y_i  &amp;amp; \sum x_i y_i \end{array}\right|}{\left| \begin{array}{cc} N &amp;amp; \sum y_i\\ \sum y_i  &amp;amp; \sum y_i^2 \end{array}\right|} = \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;R = \sqrt{ \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{N\sum x_i^2 - \sum x_i \sum x_i  } \frac{N\sum x_i y_i - \sum x_i \sum y_i  }{N\sum y_i^2 - \sum y_i \sum y_i  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=   \frac{N\sum x_i y_i - \sum y_i \sum x_i  }{\sqrt{\left( N\sum x_i^2 - \sum x_i \sum x_i  \right ) \left (N\sum y_i^2 - \sum y_i \sum y_i\right)  } }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
:The correlation coefficient (R) CAN'T be used to indicate the degree of correlation.  The probability distribution &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; can be derived from a 2-D gaussian but knowledge of the correlation coefficient of the parent population &amp;lt;math&amp;gt;(\rho)&amp;lt;/math&amp;gt; is required to evaluate R of the sample distribution.&lt;br /&gt;
&lt;br /&gt;
Instead one assumes a correlation of &amp;lt;math&amp;gt;\rho=0&amp;lt;/math&amp;gt; in the parent distribution and then compares the sample value of &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; with what you would get if there were no correlation.&lt;br /&gt;
&lt;br /&gt;
The smaller &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; is the more likely that the data are correlated and that the linear fit is correct.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_R(R,\nu) = \frac{1}{\sqrt{\pi}} \frac{\Gamma\left ( \frac{\nu+1}{2}\right )}{\Gamma \left ( \frac{\nu}{2}\right)} \left( 1-R^2\right)^{\left( \frac{\nu-2}{2}\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
= Probability that any random sample of UNCORRELATED data would yield the correlation coefficient &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\Gamma(x) = \int_0^{\infty} t^{x-1}e^{-t} dt&amp;lt;/math&amp;gt;&lt;br /&gt;
 (ROOT::Math::tgamma(double x) )&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu=N-2&amp;lt;/math&amp;gt; = number of degrees of freedom = Number of data points - Number of parameters in fit function&lt;br /&gt;
&lt;br /&gt;
Derived in &amp;quot;Pugh and Winslow, The Analysis of Physical Measurement, Addison-Wesley Publishing, 1966.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
= Least Squares fit to a Polynomial=&lt;br /&gt;
&lt;br /&gt;
Let's assume we wish to now fit a polynomial instead of a straight line to the data.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) = \sum_{j=0}^{n} a_j x^{n}=\sum_{j=0}^{n} a_j f_j(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f_j(x) =&amp;lt;/math&amp;gt; a function which does not depend on &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the Probability of observing the value &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; with a standard deviation &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_i(a_0,a_1, \cdots ,a_n) = \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
assuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you repeat the experiment &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; times then the probability of deducing the values &amp;lt;math&amp;gt;a_n&amp;lt;/math&amp;gt; from the data can be expressed as the joint probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; values for each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once again the probability is maximized when the numerator of the exponential is a minimum&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i - \sum_{j=0}^{n} a_j f_j(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
The minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \frac{\partial \left( - \sum_{j=0}^{n} a_j f_j(x_i) \right)}{\partial a_k}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2 \sum_i^N  \frac{1}{\sigma_i^2}\left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) \left (  -  f_k(x_i) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2\sum_i^N  \frac{1}{\sigma_i^2} \left (  -  f_k(x_i) \right) \left ( y_i - \sum_{j=0}^{n} a_j f_j(x_i)\right ) =0&amp;lt;/math&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
: &amp;lt;math&amp;gt;\Rightarrow \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =  \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}  \sum_{j=0}^{n} a_j f_j(x_i)=  \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You now have a system of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; coupled equations for the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; with each equation summing over the &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; measurements.&lt;br /&gt;
&lt;br /&gt;
The first equation &amp;lt;math&amp;gt;(f_1)&amp;lt;/math&amp;gt; looks like this&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_i^N f_1(x_i) \frac{y_i}{\sigma_i^2} = \sum_i^N \frac{f_1(x_i)}{\sigma_i^2} \left ( a_1 f_1(x_i) + a_2 f_2(x_i) + \cdots a_n f_n(x_i)\right )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could use the method of determinants as we did to find the parameters &amp;lt;math&amp;gt;(a_n)&amp;lt;/math&amp;gt; for a linear fit but it is more convenient to use matrices in a technique referred to as regression analysis&lt;br /&gt;
&lt;br /&gt;
==Regression Analysis==&lt;br /&gt;
&lt;br /&gt;
The parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; in the previous section are linear parameters to a general function which may be a polynomial.&lt;br /&gt;
&lt;br /&gt;
The system of equations is composed of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations where the &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation is given as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
may be represented in matrix form as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
:&amp;lt;math&amp;gt;\beta_k= \sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{kj} = \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or in matrix form&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha} = \left ( \begin{matrix} \alpha_{11}  &amp;amp; \alpha_{12} &amp;amp; \cdots &amp;amp; \alpha_{1j} \\ \alpha_{21}  &amp;amp; \alpha_{22}&amp;amp;\cdots&amp;amp;\alpha_{2j} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1} &amp;amp;\alpha_{k2} &amp;amp;\cdots &amp;amp;\alpha_{kj}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
; the objective is to find the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;&lt;br /&gt;
: To find &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; just invert the matrix&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta} = \tilde{a} \tilde{\alpha}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \tilde{\beta} = \tilde{a} \tilde{\alpha} \right) \tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{\alpha}\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\beta}\tilde{\alpha}^{-1} = \tilde{a} \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \Rightarrow  \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Thus if you invert the matrix &amp;lt;math&amp;gt;\tilde{\alpha}&amp;lt;/math&amp;gt; you find &amp;lt;math&amp;gt;\tilde{\alpha}^{-1}&amp;lt;/math&amp;gt; and as a result the parameters &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Matrix inversion==&lt;br /&gt;
&lt;br /&gt;
The first thing to note is that for the inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A})&amp;lt;/math&amp;gt; to exist its determinant can not be zero&lt;br /&gt;
: &amp;lt;math&amp;gt;\left |\tilde{A} \right | \ne 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse of a matrix &amp;lt;math&amp;gt;(\tilde{A}^{-1})&amp;lt;/math&amp;gt; is defined such that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{A}^{-1} = \tilde{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we divide both sides by the matrix &amp;lt;math&amp;gt;\tilde {A}&amp;lt;/math&amp;gt; then we have&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A}^{-1} = \frac{\tilde{1}}{\tilde{A} }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above ratio of the unity matrix to matrix &amp;lt;math&amp;gt;\tilde{A}&amp;lt;/math&amp;gt; is always equal to &amp;lt;math&amp;gt;\tilde{A}^{-1}&amp;lt;/math&amp;gt; as long as both the numerator and denominator are multiplied by the same constant factor.&lt;br /&gt;
&lt;br /&gt;
If we do such operations we can transform the ratio such that the denominator has the unity matrix and then the numerator will have the inverse matrix.  &lt;br /&gt;
&lt;br /&gt;
This is the principle of Gauss-Jordan Elimination.&lt;br /&gt;
&lt;br /&gt;
===Gauss-Jordan Elimination===&lt;br /&gt;
If Gauss–Jordan elimination is applied on a square matrix, it can be used to calculate the inverse matrix. This can be done by augmenting the square matrix with the identity matrix of the same dimensions, and through the following matrix operations:&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{A} \tilde{1} \Rightarrow&lt;br /&gt;
 \tilde{1} \tilde{A}^{-1} .&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the original square matrix, &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;, is given by the following expression:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 \\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 \\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, after augmenting by the identity, the following is obtained:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A}\tilde{1} = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By performing elementary row operations on the &amp;lt;math&amp;gt;\tilde{A}\tilde{1}&amp;lt;/math&amp;gt; matrix until it reaches reduced row echelon form, the following is the final result:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1}\tilde{A}^{-1}  = &lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 &amp;amp; \frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1 &amp;amp; \frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix augmentation can now be undone, which gives the following:&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}\qquad&lt;br /&gt;
 \tilde{A}^{-1} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
\frac{3}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{1}{4}\\&lt;br /&gt;
\frac{1}{2} &amp;amp; 1 &amp;amp; \frac{1}{2}\\&lt;br /&gt;
\frac{1}{4} &amp;amp; \frac{1}{2} &amp;amp; \frac{3}{4}&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
:&amp;lt;math&amp;gt; &lt;br /&gt;
 \tilde{A}^{-1} =\frac{1}{4}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}=\frac{1}{det(A)}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
3 &amp;amp; 2 &amp;amp; 1\\&lt;br /&gt;
2 &amp;amp; 4 &amp;amp; 2\\&lt;br /&gt;
1 &amp;amp; 2 &amp;amp; 3&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
A matrix is non-singular (meaning that it has an inverse matrix) if and only if the identity matrix can be obtained using only elementary row operations.&lt;br /&gt;
&lt;br /&gt;
== Error Matrix==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As always the uncertainty is determined by the Taylor expansion in quadrature such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_P^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial P}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt; = error in parameter P: here covariance has been assumed to be zero&lt;br /&gt;
&lt;br /&gt;
Where the definition of variance&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_i^2 \approx s^2 = \frac{\sum \left( y_i - \sum_{j=0}^{n} a_j f_j(x_i) \right)^2}{N -n}&amp;lt;/math&amp;gt;  : there are &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; parameters and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; data points which translate to &amp;lt;math&amp;gt;(N-n)&amp;lt;/math&amp;gt; degrees of freedom.&lt;br /&gt;
&lt;br /&gt;
Applying this for the parameter &amp;lt;math&amp;gt;a_k&amp;lt;/math&amp;gt; indicates that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k}^2 = \sum \left [ \sigma_i^2 \left ( \frac{\partial a_k}{\partial y_i}\right )^2\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;But what if there are covariances?&lt;br /&gt;
In that case the following general expression applies&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = &amp;lt;/math&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \tilde{a} =\tilde{\beta}\tilde{\alpha}^{-1} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n)&amp;lt;/math&amp;gt; = a row matrix of the parameters&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{\beta}= ( \beta_1, \beta_2, \cdots , \beta_n) &amp;lt;/math&amp;gt;  = a row matrix of order &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{\alpha}^{-1} = \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; = a &amp;lt;math&amp;gt;k \times j = n \times n&amp;lt;/math&amp;gt; matrix&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\tilde{a} =( a_1, a_2, \cdots , a_n) = ( \beta_1, \beta_2, \cdots , \beta_n) \left ( \begin{matrix} \alpha_{11}^{-1}  &amp;amp; \alpha_{12}^{-1} &amp;amp; \cdots &amp;amp; \alpha_{1j}^{-1} \\ \alpha_{21}^{-1}  &amp;amp; \alpha_{22}^{-1}&amp;amp;\cdots&amp;amp;\alpha_{2j}^{-1} \\ \vdots &amp;amp;\vdots &amp;amp;\ddots &amp;amp;\vdots \\ \alpha_{k1}^{-1} &amp;amp;\alpha_{k2}^{-1} &amp;amp;\cdots &amp;amp;\alpha_{kj}^{-1}\end{matrix} \right )&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow  a_k = \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_k}{\partial y_i} = \frac{\partial }{\partial y_i} \sum_j^n \beta_j \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\partial }{\partial y_i} \sum_j^n \left( \sum_i^N f_j(x_i) \frac{y_i}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}&amp;lt;/math&amp;gt; :only one &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; in the sum over &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; survives the derivative&lt;br /&gt;
&lt;br /&gt;
similarly&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial a_l}{\partial y_i} = \sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
substituting&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 = \sum_i^N \left [ \sigma_i^2  \frac{\partial a_k}{\partial y_i}\frac{\partial a_l}{\partial y_i}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^N \left [ \sigma_i^2  \sum_j^n \left(  f_j(x_i) \frac{1}{\sigma_i^2}\right) \alpha_{jk}^{-1}\sum_p^n \left(  f_p(x_i) \frac{1}{\sigma_i^2}\right)\alpha_{pl}^{-1} \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;math&amp;gt; \sigma_i^2&amp;lt;/math&amp;gt; term appears on the  top and bottom.&lt;br /&gt;
;Move the outer most sum to the inside&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_{a_k,a_l}^2 =  \sum_j^n \left(   \alpha_{jk}^{-1}\sum_p^n \sum_i^N  \frac{f_j(x_i)  f_p(x_i)}{\sigma_i^2} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n  \alpha_{jk}^{-1}\sum_p^n \left(  \alpha_{jp} \right)\alpha_{pl}^{-1}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_j^n \alpha_{jk}^{-1}\tilde{1}_{jl}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\tilde{1}_{jl}&amp;lt;/math&amp;gt;  = the &amp;lt;math&amp;gt;j,l&amp;lt;/math&amp;gt; element of the unity matrix = 1&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
: &amp;lt;math&amp;gt;\alpha_{jk} = \alpha_{kj} &amp;lt;/math&amp;gt; : the matrix is symmetric.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; \sigma_{a_k,a_l}^2 =  \sum_j^n \alpha_{kj}^{-1}\tilde{1}_{jl}= \alpha_{kl}^{-1}&amp;lt;/math&amp;gt; = Covariance/Error matrix element&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The inverse matrix &amp;lt;math&amp;gt;\alpha_{kl}^{-1}&amp;lt;/math&amp;gt; tells you the variance and covariance for the calculation of the total error.&lt;br /&gt;
&lt;br /&gt;
;Remember&lt;br /&gt;
:&amp;lt;math&amp;gt;Y = \sum_i^n a_i f_i(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{a_i}^2 = \alpha_{ii}^{-1}&amp;lt;/math&amp;gt;= error in the parameters&lt;br /&gt;
: &amp;lt;math&amp;gt;s^2 = \sum_i^n \sum_j^n \left ( \frac{\partial Y}{\partial a_i}\frac{\partial Y}{\partial a_j}\right) \sigma_{ij}=\sum_i^n \sum_j^n \left ( f_i(x)f_j(x)\right) \sigma_{ij} &amp;lt;/math&amp;gt; = error in the model's prediction&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_i^n \sum_j^n  x^{j+i} \sigma_{ij}&amp;lt;/math&amp;gt; If Y is a power series in x &amp;lt;math&amp;gt;(f_i(x) = x^i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Chi-Square Distribution=&lt;br /&gt;
&lt;br /&gt;
The above tools allow you to perform a least squares fit to data using high order polynomials.&lt;br /&gt;
&lt;br /&gt;
; The question though is how high in order should you go?  (ie; when should you stop adding parameters to the fit?)&lt;br /&gt;
&lt;br /&gt;
One argument is that you should stop increasing the number of parameters if they don't change much.  The parameters, using the above techniques, are correlated such that when you add another order to the fit all the parameters have the potential to change in value.  If their change is miniscule then you can ague that adding higher orders to the fit does not change the fit.  There are techniu&lt;br /&gt;
&lt;br /&gt;
A quantitative way to express the above uses the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value of the fit.  The above technique seeks to minimize &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  So if you add higher orders and more parameters but the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value does not change appreciably, you could argue that the fit is a good as you can make it with the given function.&lt;br /&gt;
&lt;br /&gt;
==Derivation==&lt;br /&gt;
&lt;br /&gt;
If you assume a series of measurements have a Gaussian parent distribution&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) = \frac{1}{\sqrt{2 \pi} \sigma} e^{-\frac{1}{2} \left ( \frac{x - \bar{x}}{\sigma}\right)^2}&amp;lt;/math&amp;gt; = probability of measuring the value &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; from a Gaussian distribution with s sample mean&amp;lt;math&amp;gt; \bar{x}&amp;lt;/math&amp;gt; from a parent distribution of with &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you break the above probability up into intervals of &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt; then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\bar{x},\sigma) d\bar{x}&amp;lt;/math&amp;gt; = probability that &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; lies within the interval &amp;lt;math&amp;gt;d\bar{x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you make N measurements of two variates (x_i and y_i) which may be correlated using a function with n parameters.&lt;br /&gt;
&lt;br /&gt;
== Chi-Square Cumulative Distribution==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution function is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x,\nu) = \frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; y(x_i)&amp;lt;/math&amp;gt; = the assumed functional dependence of the data on &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; =  N - n -1 = degrees of freedom&lt;br /&gt;
:&amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points&lt;br /&gt;
:&amp;lt;math&amp;gt;n + 1&amp;lt;/math&amp;gt; = number of parameters used in the fit (n coefficients + 1 constant term)&lt;br /&gt;
:&amp;lt;math&amp;gt; \Gamma(z) = \int_0^\infty  t^{z-1} e^{-t}\,dt\;&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above tells you the probability of getting the value of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; given the number of degrees of freedom &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; in your fit.&lt;br /&gt;
&lt;br /&gt;
While it is useful to know what the probability is of getting a value of &amp;lt;math&amp;gt;\chi^2 = x&amp;lt;/math&amp;gt; it is more useful to use the cumulative distribution function.&lt;br /&gt;
&lt;br /&gt;
The probability that the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; you received from your fit is as larger or larger than what you would get from a function described by the parent distribution is given &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty} P(x,\nu) dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A graph of &amp;lt;math&amp;gt;P(x,\nu)&amp;lt;/math&amp;gt; shows that the mean value of this function is &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow P(\chi^2 = \nu ,\nu)=\int_{\chi^2=\nu}^{\infty} P(x,\nu) dx = 0.5&amp;lt;/math&amp;gt; = probability of getting the average value for &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt; or larger is 0.5.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Reduced Chi-square==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced Chi-square &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2_{\nu} = \frac{\chi^2}{\nu}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the mean of &amp;lt;math&amp;gt;P(x,\nu) = \nu&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
then the mean of &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(\frac{x}{\nu},\nu) = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A reduced chi-squared distribution &amp;lt;math&amp;gt;\chi^2_{\nu}&amp;lt;/math&amp;gt; has a mean value of 1.&lt;br /&gt;
&lt;br /&gt;
==p-Value==&lt;br /&gt;
&lt;br /&gt;
For the above fits,&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \frac{\left( y_i-y(x_i)\right)^2}{\sigma_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The p-value is defined as the cumulative &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; probability distribution&lt;br /&gt;
&lt;br /&gt;
: p-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The p-value is the probability, under the assumption of a hypothesis H , of obtaining data at least as incompatible with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  small p-values are good.&lt;br /&gt;
&lt;br /&gt;
;The p-value is NOT&lt;br /&gt;
&lt;br /&gt;
# the probability that the null hypothesis is true. (This false conclusion is used to justify the &amp;quot;rule&amp;quot; of considering a result to be significant if its p-value is very small (near zero).) &amp;lt;br /&amp;gt; In fact, frequentist statistics does not, and cannot, attach probabilities to hypotheses. &lt;br /&gt;
# the probability that a finding is &amp;quot;merely a fluke.&amp;quot; (Again, this conclusion arises from the &amp;quot;rule&amp;quot; that small p-values indicate significant differences.) &amp;lt;br /&amp;gt; As the calculation of a p-value is based on the ''assumption'' that a finding is the product of chance alone, it patently cannot also be used to gauge the probability of that assumption being true. This is subtly different from the real meaning which is that the p-value is the chance that null hypothesis explains the result: the result might not be &amp;quot;merely a fluke,&amp;quot; ''and'' be explicable by the null hypothesis with confidence equal to the p-value.&lt;br /&gt;
#the probability of falsely rejecting the null hypothesis. &lt;br /&gt;
#the probability that a replicating experiment would not yield the same conclusion.&lt;br /&gt;
#1&amp;amp;nbsp;−&amp;amp;nbsp;(p-value) is ''not'' the probability of the alternative hypothesis being true.&lt;br /&gt;
#A determination of the significance level of the test. &amp;lt;br /&amp;gt; The significance level of a test is a value that should be decided upon by the agent interpreting the data before the data are viewed, and is compared against the p-value or any other statistic calculated after the test has been performed.&lt;br /&gt;
#an indication of  the size or importance of the observed effect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In ROOT&lt;br /&gt;
&lt;br /&gt;
 double ROOT::Math::chisquared_cdf_c (double &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;, double &amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;, double x0 = 0 )		&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;=\int_{\chi^2}^{\infty}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
  TMath::Prob(&amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\nu&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
You can turn things around the other way by defining P-value to be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: P-value= &amp;lt;math&amp;gt;P(\chi^2,\nu) = \int_{\infty}^{\chi^2}\frac{x^{\frac{\nu}{2}-1} e^{-\frac{x}{2}}}{2^{\nu/2} \Gamma(\nu/2)} dx = 1-(p-value)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here P-value would be the probability, under the assumption of a hypothesis H , of obtaining data at least as '''compatible''' with H as the data actually observed.&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
The P-value is the probability of observing a sample statistic as extreme as the test statistic.&lt;br /&gt;
&lt;br /&gt;
http://stattrek.com/chi-square-test/goodness-of-fit.aspx&lt;br /&gt;
&lt;br /&gt;
=F-test=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt; \chi^2&amp;lt;/math&amp;gt; test in the previous section measures both the difference between the data and the fit function as well as the difference between the fit function and the &amp;quot;parent&amp;quot; function.  The &amp;quot;parent&amp;quot; function is the true functional dependence of the data.&lt;br /&gt;
&lt;br /&gt;
The F-test can be used to determine the difference between the fit function and the parent function, to more directly test if you have come up with the correct fit function.&lt;br /&gt;
&lt;br /&gt;
== F-distribution==&lt;br /&gt;
&lt;br /&gt;
If, for example, you are comparing the Ratio of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; values from 2 different fits to the data then the function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then since &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 \equiv \sum_i^N \frac{\left (y_i-y(x_i)\right)^2}{\sigma_i^2}= \frac{s^2}{\sigma^2}&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; = constant&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and assuming &amp;lt;math&amp;gt;\sigma_1 = \sigma_2&amp;lt;/math&amp;gt; (same data set)&lt;br /&gt;
&lt;br /&gt;
one can argue that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_1}{\nu_1}} = \frac{s_1^2}{\sigma_1^2}\frac{\sigma_2^2}{s_2^2} \frac{\nu_2}{\nu_1} = \frac{\nu_2}{\nu_1} \frac{s_1^2}{s_2^2}&amp;lt;/math&amp;gt; = function that is independent of the error &amp;lt;math&amp;gt; \sigma&amp;lt;/math&amp;gt; intrinsic to the data thus the function is only comparing the fit residuals&amp;lt;math&amp;gt; (s^2)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The Function&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F = \frac{\frac{\chi^2_1}{\nu_1}}{\frac{\chi^2_2}{\nu_2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
can be shown to follow the following probability distribution.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1, \nu_2) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
which is available in ROOT as&lt;br /&gt;
&lt;br /&gt;
 ROOT::Math::fdistribution_pdf(double x, double n, double m, double x0 = 0 )&lt;br /&gt;
&lt;br /&gt;
== The chi^2 difference test==&lt;br /&gt;
&lt;br /&gt;
In a similar fashion as above, one can define another ratio which is based on the difference between the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; value using 2 different .&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} = \frac{\frac{\chi^2_1 - \chi^2_2}{\nu_1-\nu_2}}{\frac{\chi^2_1}{\nu_1}} =  \frac{\frac{\chi^2(m) - \chi^2(n)}{n-m}}{\frac{\chi^2(m)}{(N-m-1)}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Under the null hypothesis that model 2 does not provide a significantly better fit than model 1, F will have an F distribution, with &amp;lt;math&amp;gt;(\nu_2 − \nu_1, \nu_1)&amp;lt;/math&amp;gt; degrees of freedom. The null hypothesis is rejected if the F calculated from the data is greater than the critical value of the F  distribution for some desired false-rejection probability (e.g. 0.05).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to determine if you need to continue adding parameters to the fit then you can consider an F-test.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_1}{N-m-1}} = \frac{\Delta \chi^2}{\chi^2_{\nu}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above statistic will again follow the F-distribution &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_F(f,\nu_1=1, \nu_2=N-m-1) = \frac{\Gamma[\frac{\nu_1 + \nu_2}{2}]}{\Gamma[\frac{\nu_1}{2}]\Gamma[\frac{\nu_2}{2}]} \left ( \frac{\nu_1}{\nu_2}\right )^{\frac{\nu_1}{2}} \frac{f^{\frac{\nu_1}{2}-1}}{(1+f \frac{\nu_1}{\nu_2})^{\frac{\nu_1+\nu_2}{2}}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Note: Some will define the fraction with respect to the next order fit&lt;br /&gt;
::&amp;lt;math&amp;gt;F_{\chi} =\frac{\frac{\chi^2_1(m) - \chi^2_2(m+1)}{1}}{\frac{\chi^2_2}{N-m}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The multiple correlation coefficient test==&lt;br /&gt;
&lt;br /&gt;
While the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference F-test above is useful to evaluate the impact of adding another fit parameter, you will also want to evaluate the &amp;quot;goodness&amp;quot; of the entire fit in a manner which can be related to a correlation coefficient R (in this case it is a multiple-correlation coefficient because the fit can go beyond linear).&lt;br /&gt;
&lt;br /&gt;
I usually suggest that you do this after the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; difference test unless you have a theoretical model which constrains the number of fit parameters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Least Squares fit to an Arbitrary Function=&lt;br /&gt;
&lt;br /&gt;
The above Least Squares fit methods work well if your fit function has a linear dependence on the fit parameters.&lt;br /&gt;
&lt;br /&gt;
:ie; &amp;lt;math&amp;gt;y(x) =\sum_i^n a_i x^i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
such fit functions give you a set of  &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; equations that are linear in the parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; when you are minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.  The &amp;lt;math&amp;gt;k^{\mbox{th}}&amp;lt;/math&amp;gt; equation of this set of n equations is shown below.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sum_i^N   y_i \frac{ f_k(x_i)}{\sigma_i^2} =   \sum_{j=0}^{n} a_j \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your fit equation looks like&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y(x) =a_1 e^{\frac{1}{2} \left (\frac{x-a_2}{a_3}\right)^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
now your set of equations minimizing &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; are non-linear with respect to the parameters.  You can't take separate the &amp;lt;math&amp;gt;a_j&amp;lt;/math&amp;gt; term from the &amp;lt;math&amp;gt;f_k(x_i)&amp;lt;/math&amp;gt; function and thereby solve the system by inverting your matrix&lt;br /&gt;
:&amp;lt;math&amp;gt; \sum_i^N  \frac{ f_k(x_i)}{\sigma_i^2}   f_j(x_i)&amp;lt;/math&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
Because of this, a direct analytical solution is difficult (you need to find roots of coupled non-linear equations) and one resorts to approximation methods for the solution.&lt;br /&gt;
== Grid search==&lt;br /&gt;
&lt;br /&gt;
The fundamentals of the grid search is to basically change all parameters over some natural range to generate a hypersurface in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; and look for the smallest value of of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; that appears on the hypersurface.&lt;br /&gt;
&lt;br /&gt;
In Lab 15 you will generate this hypersurface for the simple least squares linear fit tot he Temp -vs- Voltage data in lab 14.  Your surface might look like the following.&lt;br /&gt;
&lt;br /&gt;
[[File:TF_ErrAna_Lab15.png | 200 px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As shown above, I have plotted the value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; as a function of  the y-Intercept &amp;lt;math&amp;gt;(a_1)&amp;lt;/math&amp;gt; and the slope &amp;lt;math&amp;gt;(a_2)&amp;lt;/math&amp;gt;.  The minimum in this hypersurface should coincide with the values of Y-intercept=&amp;lt;math&amp;gt;a_1=-1.01&amp;lt;/math&amp;gt; and Slope=&amp;lt;math&amp;gt;a_2=0.0431&amp;lt;/math&amp;gt; from the linear regression solution.&lt;br /&gt;
&lt;br /&gt;
If we return to the beginning, the original problem is to use the max-likelihood principle on the probability function for finding the correct fit using the data. &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n) = \Pi_i P_i(a_0,a_1, \cdots ,a_n) =\Pi_i \frac{1}{\sigma_i \sqrt{2 \pi}} e^{- \frac{1}{2} \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2} \propto e^{- \frac{1}{2}\left [ \sum_i^N \left ( \frac{y_i - y(x_i)}{\sigma_i}\right)^2 \right]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = \sum_i^N \left ( \frac{y_i -y(x_i)}{\sigma_i}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; = number of data points and &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; = order of polynomial used to fit the data.&lt;br /&gt;
&lt;br /&gt;
To maximize the probability of finding the best fit we need to find by minimum in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by setting the partial derivate with respect to the fit parameters &amp;lt;math&amp;gt;\left (\frac{\partial \chi}{\partial a_k} \right)&amp;lt;/math&amp;gt; to zero&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial a_k}  = \frac{\partial}{\partial a_k}\sum_i^N \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i^N 2 \frac{1}{\sigma_i^2} \left ( y_i - y(x_i)\right ) \frac{\partial \left( - y(x_i) \right)}{\partial a_k} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively you could also express \chi^2 in terms of the probability distributions as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P(a_0,a_1, \cdots ,a_n)  \propto e^{- \frac{1}{2}\chi^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Grid search method==&lt;br /&gt;
&lt;br /&gt;
The grid search method relies on the independence of the fit parameters &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt;.    The search starts by selecting initial values for all parameters and then searching for a &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; minimum for one of the fit parameters.  You then set the parameter to the determined value and repeat the procedure on the next parameter.  You keep repeating until a stable value of &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; is found.&lt;br /&gt;
&lt;br /&gt;
Obviously, this method strongly depends on the initial values selected for the parameters.&lt;br /&gt;
&lt;br /&gt;
==Parameter Errors==&lt;br /&gt;
&lt;br /&gt;
Returning back to the equation&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\chi^2 = -2\ln\left [P(a_0,a_1, \cdots ,a_n) \right ] + 2\sum \ln(\sigma_i \sqrt{2 \pi})&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
it may be observed that &amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt; represents the error in the parameter &amp;lt;math&amp;gt;a_i&amp;lt;/math&amp;gt; and that the error alters &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once a minimum is found, the parabolic nature of the &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt;  dependence on a single parameter is such that an increase in 1 standard deviation in the parameter results in an increase in &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; of 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can turn this to determine the error in the fit parameter by determining how much the parameter must increase (or decrease) in order to increase &amp;lt;math&amp;gt;\chi^2&amp;lt;/math&amp;gt; by 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Gradient Search Method==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Gradient search method improves on the Grid search method by attempting to search in a direction towards the minima as determined by simultaneous changes in all parameters.  The change in each parameter may differ in magnitude and is adjustable for each parameter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference  Go Back] [[Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrAna_Homework&amp;diff=91700</id>
		<title>TF ErrAna Homework</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrAna_Homework&amp;diff=91700"/>
		<updated>2014-03-21T19:08:48Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* 3 Eq. 3 unknowns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Errors=&lt;br /&gt;
&lt;br /&gt;
== Give 5 examples of  a  different type of Systematic error.==&lt;br /&gt;
&lt;br /&gt;
==Find 3 published examples of data which is wrongly represented.  ==&lt;br /&gt;
Identify what is incorrect about it.  What does it mean to be wrongly presented?  A typical example is a political poll which does not identify the statistical uncertainty properly or at all.&lt;br /&gt;
&lt;br /&gt;
==Create a Histogram using ROOT==&lt;br /&gt;
&lt;br /&gt;
some commands that may interest you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
root [1] TH1F *Hist1=new TH1F(&amp;quot;Hist1&amp;quot;,&amp;quot;Hist1&amp;quot;,50,-0.5,49.5);&lt;br /&gt;
root [2] Hist1-&amp;gt;Fill(10);&lt;br /&gt;
root [3] Hist1-&amp;gt;Draw();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use the above commands but you need to change the names and numbers above to receive credit.  You must also add a title to the histogram which contains your full name.  You will printout the histogram and hand it in with the above two problems.&lt;br /&gt;
&lt;br /&gt;
;Notice how the square rectangle in the histogram is centered at 10!&lt;br /&gt;
;Notice that if you do the commands&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root [2] Hist1-&amp;gt;Fill(10);&lt;br /&gt;
root [3] Hist1-&amp;gt;Draw();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the rectangle centered a 10 will reach the value of 2 on the vertical axis.&lt;br /&gt;
&lt;br /&gt;
Two dice are rolled 20 times.  Create a histogram to represent the 20 trials below&lt;br /&gt;
&lt;br /&gt;
 {| border=&amp;quot;1&amp;quot;  |cellpadding=&amp;quot;20&amp;quot; cellspacing=&amp;quot;0 &lt;br /&gt;
|-&lt;br /&gt;
| Trial || Value&lt;br /&gt;
|-&lt;br /&gt;
|1 ||8&lt;br /&gt;
|-&lt;br /&gt;
|2 || 10&lt;br /&gt;
|-&lt;br /&gt;
|3 || 9&lt;br /&gt;
|-&lt;br /&gt;
|4 || 5&lt;br /&gt;
|-&lt;br /&gt;
|5 || 9&lt;br /&gt;
|-&lt;br /&gt;
|6 || 6&lt;br /&gt;
|-&lt;br /&gt;
|7 || 5&lt;br /&gt;
|-&lt;br /&gt;
|8 || 6&lt;br /&gt;
|-&lt;br /&gt;
|9 || 3&lt;br /&gt;
|-&lt;br /&gt;
|10 || 9&lt;br /&gt;
|-&lt;br /&gt;
|11 || 8&lt;br /&gt;
|-&lt;br /&gt;
|12 || 5&lt;br /&gt;
|-&lt;br /&gt;
|13 || 8&lt;br /&gt;
|-&lt;br /&gt;
|14 || 10&lt;br /&gt;
|-&lt;br /&gt;
|15 || 8&lt;br /&gt;
|-&lt;br /&gt;
|16 || 11&lt;br /&gt;
|-&lt;br /&gt;
|17 || 12&lt;br /&gt;
|-&lt;br /&gt;
|18 || 6&lt;br /&gt;
|-&lt;br /&gt;
|19 || 7&lt;br /&gt;
|-&lt;br /&gt;
|20 || 8&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Mean and SD=&lt;br /&gt;
==Electron radius==&lt;br /&gt;
The probability that an electron is a distance &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; from the center of the hydrogen atom&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(r) = Cr^2 \exp^{-2 \frac{r}{R}}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Doing the integrals by hand (no tables) ,&lt;br /&gt;
&lt;br /&gt;
a.)Find the value of C&lt;br /&gt;
&lt;br /&gt;
b.) Find the mean electron radius and standard deviation for an electron in a hydrogen atom&lt;br /&gt;
&lt;br /&gt;
==Histograms by Hand==&lt;br /&gt;
&lt;br /&gt;
Given the following test scores from 40 students.&lt;br /&gt;
&lt;br /&gt;
 {| border=&amp;quot;1&amp;quot;  |cellpadding=&amp;quot;20&amp;quot; cellspacing=&amp;quot;0 &lt;br /&gt;
|-&lt;br /&gt;
| Trial || Value || Trial || Value|| Trial || Value|| Trial || Value&lt;br /&gt;
|-&lt;br /&gt;
|1 ||49 || 11 ||90 || 21 || 69 || 31 || 74&lt;br /&gt;
|-&lt;br /&gt;
|2 || 80 || 12 || 84 || 22 ||69 || 32 ||86&lt;br /&gt;
|-&lt;br /&gt;
|3 || 84 || 13 || 59 || 23 || 53 || 33 || 78&lt;br /&gt;
|-&lt;br /&gt;
|4 || 73 || 14 || 56 || 24 || 55 || 34 || 55&lt;br /&gt;
|-&lt;br /&gt;
|5 || 89 || 15 || 62 || 25 || 77 || 35 || 66&lt;br /&gt;
|-&lt;br /&gt;
|6 || 78 || 16 || 53 || 26 || 82 || 36 || 60&lt;br /&gt;
|-&lt;br /&gt;
|7 || 78 || 17 || 83 || 27 || 81 || 37 || 68&lt;br /&gt;
|-&lt;br /&gt;
|8 || 92 || 18 || 81 || 28 || 76 || 38 || 92&lt;br /&gt;
|-&lt;br /&gt;
|9 || 56 || 19 || 65 || 29 || 79 || 39 || 87&lt;br /&gt;
|-&lt;br /&gt;
|10 || 85 || 20 || 81 || 30 || 83 || 40 || 86&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
a.) calculate the mean and standard deviation&lt;br /&gt;
&lt;br /&gt;
b.) construct a histogram by hand which has 10 bins centered on 10,20,...&lt;br /&gt;
&lt;br /&gt;
c.) Use ROOT to construct a histogram.  Compare the mean and RMS from ROOT with your result in part (a) above.  What is the difference between the RMS report in the ROOT histogram and the standard deviation you calculated in part (a)?&lt;br /&gt;
&lt;br /&gt;
== Variance using Probability function==&lt;br /&gt;
&lt;br /&gt;
Given that &lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 = \lim_{N \rightarrow \infty} \frac{1}{N}\sum_{j=1}^n \left [ \left (x_j - \mu \right)^2) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Justify that&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\lim_{N \rightarrow \infty} \frac{1}{N}\sum_{j=1}^n \left [ \left (x_j - \mu \right)^2  \right ] = \lim_{N \rightarrow \infty} \left [  \frac{1}{N}\sum_{j=1}^n x_j^2\right ] - \mu^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Note:The standard deviation (&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;) is the root mean square (RMS) of the deviations.&lt;br /&gt;
&lt;br /&gt;
RMS = &amp;lt;math&amp;gt;\sqrt{\frac{1}{N}\sum_i^N x_i^2}&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\sigma = \mbox{RMS}(x_i -\mu)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Binomial Probability Distributions=&lt;br /&gt;
1.)Evaluate the following (at least one by hand)&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
a.) &amp;lt;math&amp;gt;{6\choose 3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
b.) &amp;lt;math&amp;gt;{4\choose 2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
c.) &amp;lt;math&amp;gt;{10\choose 3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
d.) &amp;lt;math&amp;gt;{52\choose 4}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2.) Plot the binomial distribution P(x) for n=6 and p=1/2 from x=0 to 6.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) = {n\choose x}p^{x}q^{n-x} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3.)  Given the probability distribution below for the sum of the point on a pair of dice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) =\left \{  {\frac{x-1}{36} \;\;\;\; 2 \le x \le 7 \atop \frac{13-x}{36} \;\;\; 7 &amp;lt; x \le 12} \right .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a.) find the mean&lt;br /&gt;
&lt;br /&gt;
b.) find the standard deviation &amp;lt;math&amp;gt;(\sigma)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4.) Prove that &amp;lt;math&amp;gt;\sigma^2 = npq&amp;lt;/math&amp;gt; for the Binomial distribution.&lt;br /&gt;
&lt;br /&gt;
=Poisson Prob Dist=&lt;br /&gt;
&lt;br /&gt;
==Variance==&lt;br /&gt;
&lt;br /&gt;
Show that &amp;lt;math&amp;gt;\sigma^2 = \mu&amp;lt;/math&amp;gt; for the Poisson Distribution starting with the definition of variance.&lt;br /&gt;
&lt;br /&gt;
==Binomial/Poisson Statistic==&lt;br /&gt;
The probability that a student will fail this course is 7.3%.&lt;br /&gt;
&lt;br /&gt;
a.) Calculate by hand (i.e. without a computer/calculator)  the expected number of students that will fail this course if there are 32 enrolled?&lt;br /&gt;
&lt;br /&gt;
b.) Calculate by hand the probability that 5 or more will fail in one semester.&lt;br /&gt;
&lt;br /&gt;
== Deadtime==&lt;br /&gt;
&lt;br /&gt;
In a counting experiment it is possible for a detector to be &amp;quot;too busy&amp;quot; recording the effects of a detected particle that it is unable to measure another particle traversing the detector during the short time interval.   &amp;quot;Dead time&amp;quot; is a measure of the time interval over  which your detector is unable to make a measurement because it is currently making a measurement.&lt;br /&gt;
&lt;br /&gt;
Assume that particle hit your detector at a rate of &amp;lt;math&amp;gt;1 \times 10^6&amp;lt;/math&amp;gt; particles/sec and that your detector has a deadtime of 200 ns &amp;lt;math&amp;gt;(200 \times 10^{-9} sec)&amp;lt;/math&amp;gt;.  The mean number of particles hitting the detector during this deadtime is &amp;lt;math&amp;gt;\mu = 0.2&amp;lt;/math&amp;gt;.   The detector efficiency is defined as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\epsilon = \frac{\mbox{average number of particles counted}}{\mbox{number of particles passing through the detector in 200 ns}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a.)  Find the efficiency of the detector assuming the process follows the Poisson distribution.&lt;br /&gt;
&lt;br /&gt;
b.) Graph the efficiency as a function of the incident particle flux for rates between 0 and &amp;lt;math&amp;gt;10 \times 10^6&amp;lt;/math&amp;gt; particles/sec.&lt;br /&gt;
&lt;br /&gt;
= Gaussian Prob Dist=&lt;br /&gt;
== Counting experiment variance==&lt;br /&gt;
&lt;br /&gt;
a.)What is the standard deviation for a counting experiment with a mean &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; = 100.&lt;br /&gt;
&lt;br /&gt;
b.)What is the standard deviation if the mean number of counts is increased by a factor of 4?&lt;br /&gt;
&lt;br /&gt;
== Half Width -vs- variance==&lt;br /&gt;
Show that the full-width at half maximum &amp;lt;math&amp;gt;(\Gamma)&amp;lt;/math&amp;gt; is related to the standard devision by &amp;lt;math&amp;gt;\Gamma = 2.3548 \sigma&amp;lt;/math&amp;gt;  for the Gaussian probability distribution.  Begin with the definition that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_G\left (\mu + \frac{\Gamma}{2} \right ) = \frac{P_G(\mu)}{2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gaussian Probability==&lt;br /&gt;
a.) Determine, by direct integration, the probability  of observing a value beyond 1 standard deviation from the mean of a Gaussian distribution? ie: &amp;lt;math&amp;gt;P_G(X \le \mu - \sigma, \mu, \sigma)+ P_G(X \ge \mu + \sigma, \mu, \sigma)&amp;lt;/math&amp;gt; =?&lt;br /&gt;
&lt;br /&gt;
b.) Find the value of &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;P_G(\mu + \sigma, \mu, \sigma) = A P_G(\mu,\mu,\sigma)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
c.) repeat parts a.) and b.) above for &amp;lt;math&amp;gt;P_G(\mu + P.E., \mu, \sigma)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_G(\mu + \Gamma/2, \mu, \sigma)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P_G(X =\mu + \sigma, \mu, \sigma)=0.24197 = 0.60653 P_G(X = \mu , \mu, \sigma)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P_G(X =\mu + PE, \mu, \sigma)=0.3178 = 0.7965 P_G(X = \mu , \mu, \sigma)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P_G(X =\mu - \Gamma/2, \mu, \sigma)=0.19947 = 0.5 P_G(X = \mu , \mu, \sigma)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Error Propagation=&lt;br /&gt;
==Lorentzian==&lt;br /&gt;
&lt;br /&gt;
a.)What fraction of the area of a Lorentzian curve is enclosed within the interval &amp;lt;math&amp;gt;(\mu \pm \frac{3}{2} \Gamma)&amp;lt;/math&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
b.) The probability of observing a value from the Lorentzian distribution that is more than 2 half-widths (&amp;lt;math&amp;gt;\Gamma/2&amp;lt;/math&amp;gt;) from the mean.&lt;br /&gt;
&lt;br /&gt;
== Derivatives==&lt;br /&gt;
&lt;br /&gt;
Find the uncertainty &amp;lt;math&amp;gt;\sigma_x&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; as a function of the uncertainties&amp;lt;math&amp;gt; \sigma_u&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sigma_v&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; for the following functions:&lt;br /&gt;
&lt;br /&gt;
a.) &amp;lt;math&amp;gt;x = \frac{1}{2(u-v)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
b.) &amp;lt;math&amp;gt;x= uv^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
c.) &amp;lt;math&amp;gt;x = u^2 + v^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
d.) &amp;lt;math&amp;gt;x = \frac{u-v}{u+v}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Snell's Law==&lt;br /&gt;
&lt;br /&gt;
Given Snell's Law&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;n_1 \sin(\theta_1) = n_2 \sin(\theta_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Assume &amp;lt;math&amp;gt;n_1=1&amp;lt;/math&amp;gt; is known with absolute certainty and find &amp;lt;math&amp;gt;n_2&amp;lt;/math&amp;gt; and it's uncertainty when the following angles are measured&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\theta_1 = (22.03 \pm 0.02)^{\circ}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\theta_2 = (14.45 \pm 0.2)^{\circ}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Linear Fit=&lt;br /&gt;
&lt;br /&gt;
==2 Eq. 2 unknowns==&lt;br /&gt;
Determine &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; for the system below&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;7x + 8y =100&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;2x-9y = 10&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==3 Eq. 3 unknowns==&lt;br /&gt;
&lt;br /&gt;
Given the system of 3 Equations and 3 Unkowns:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;a_{11}x + a_{12}y + a_{13}z = A&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;a_{21}x + a_{22}y +a_{23}z= B&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;a_{31}x + a_{32}y +a_{33}z= C&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or in matrix form&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{ccc} a_{11} &amp;amp; a_{12} &amp;amp; a_{13}\\ a_{21} &amp;amp; a_{22} &amp;amp; a_{23} \\ a_{31} &amp;amp; a_{32} &amp;amp; a_{33} \end{array} \right)\left( \begin{array}{c} x \\ y  \\z\end{array} \right)= \left( \begin{array}{c} A \\ B \\C \end{array} \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a.)Express a the solution for x,y, and z in matrix form assuming the remaining terms in the above are known (&amp;lt;math&amp;gt;A,B,C&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;a_{ij}&amp;lt;/math&amp;gt; are known)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
b.) Find expressions for x,y, and z in terms of A,B,C when&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x + y -z = A&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;z= B&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;2x + y +2z= C&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Linear Data Fit==&lt;br /&gt;
&lt;br /&gt;
A metal rod is placed with its ends in two different temperature baths.  One bath is at zero degree Celsius and the other at 100.  The temperature along the rod is measure and given in the table below.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;  |cellpadding=&amp;quot;20&amp;quot; cellspacing=&amp;quot;0 &lt;br /&gt;
|-&lt;br /&gt;
| Trial || Posiiton (cm) ||Temperature (Celsius) &lt;br /&gt;
|-&lt;br /&gt;
|1 ||1.0||15.6 &lt;br /&gt;
|-&lt;br /&gt;
|2 || 2.0 || 17.5&lt;br /&gt;
|-&lt;br /&gt;
|3 || 3.0|| 36.6&lt;br /&gt;
|-&lt;br /&gt;
|4 || 4.0 || 43.8&lt;br /&gt;
|-&lt;br /&gt;
|5 || 5.0 || 58.2&lt;br /&gt;
|-&lt;br /&gt;
|6 || 6.0 ||61.6&lt;br /&gt;
|-&lt;br /&gt;
|7 || 7.0 || 64.2&lt;br /&gt;
|-&lt;br /&gt;
|8 || 8.0 || 70.4&lt;br /&gt;
|-&lt;br /&gt;
|9 || 9.0 || 98.8&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
a.) Fit the above data assuming a linear function &lt;br /&gt;
T = A + B X&lt;br /&gt;
&lt;br /&gt;
assuming all of the data has the same uncertainty.  Report the value of A &amp;amp; B and the uncertainty in the parameters.&lt;br /&gt;
&lt;br /&gt;
b.) repeat part a.) above except this time assume each data point has an uncertainty given by the Poisson distribution as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma_i^2 \approx T_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Polynomial Least Squares Fit=&lt;br /&gt;
&lt;br /&gt;
==Matrix Inversion==&lt;br /&gt;
&lt;br /&gt;
Use the Gauss-Jordan method to find the inverse matrix &amp;lt;math&amp;gt;\tilde{A}^{-1}&amp;lt;/math&amp;gt; given&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0\\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 \\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Poly Fit using ROOT==&lt;br /&gt;
&lt;br /&gt;
Hand in your source code and graphs for Lab 13&lt;br /&gt;
&lt;br /&gt;
= Polynomial Least Squares Fit=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Perform a least squares fit to the data in Lab 14 using the Grid search method from &lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/TF_ErrAna_InClassLab#Lab_16 Lab 16].&lt;br /&gt;
&lt;br /&gt;
This will be a way to check your grid search algorithm against a known solution.  Use the Temp -vs- Voltage data and the Linear function in Lab 13 above.&lt;br /&gt;
&lt;br /&gt;
Hand in your source code in ROOT and a graph showing the linear fit with the Grid search parameters and the parameters found through Matrix inversion.&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences] [[Forest_Error_Analysis_for_the_Physical_Sciences]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrAna_Homework&amp;diff=91692</id>
		<title>TF ErrAna Homework</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrAna_Homework&amp;diff=91692"/>
		<updated>2014-03-21T07:34:36Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Linear Data Fit */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Errors=&lt;br /&gt;
&lt;br /&gt;
== Give 5 examples of  a  different type of Systematic error.==&lt;br /&gt;
&lt;br /&gt;
==Find 3 published examples of data which is wrongly represented.  ==&lt;br /&gt;
Identify what is incorrect about it.  What does it mean to be wrongly presented?  A typical example is a political poll which does not identify the statistical uncertainty properly or at all.&lt;br /&gt;
&lt;br /&gt;
==Create a Histogram using ROOT==&lt;br /&gt;
&lt;br /&gt;
some commands that may interest you&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
root [1] TH1F *Hist1=new TH1F(&amp;quot;Hist1&amp;quot;,&amp;quot;Hist1&amp;quot;,50,-0.5,49.5);&lt;br /&gt;
root [2] Hist1-&amp;gt;Fill(10);&lt;br /&gt;
root [3] Hist1-&amp;gt;Draw();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use the above commands but you need to change the names and numbers above to receive credit.  You must also add a title to the histogram which contains your full name.  You will printout the histogram and hand it in with the above two problems.&lt;br /&gt;
&lt;br /&gt;
;Notice how the square rectangle in the histogram is centered at 10!&lt;br /&gt;
;Notice that if you do the commands&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root [2] Hist1-&amp;gt;Fill(10);&lt;br /&gt;
root [3] Hist1-&amp;gt;Draw();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the rectangle centered a 10 will reach the value of 2 on the vertical axis.&lt;br /&gt;
&lt;br /&gt;
Two dice are rolled 20 times.  Create a histogram to represent the 20 trials below&lt;br /&gt;
&lt;br /&gt;
 {| border=&amp;quot;1&amp;quot;  |cellpadding=&amp;quot;20&amp;quot; cellspacing=&amp;quot;0 &lt;br /&gt;
|-&lt;br /&gt;
| Trial || Value&lt;br /&gt;
|-&lt;br /&gt;
|1 ||8&lt;br /&gt;
|-&lt;br /&gt;
|2 || 10&lt;br /&gt;
|-&lt;br /&gt;
|3 || 9&lt;br /&gt;
|-&lt;br /&gt;
|4 || 5&lt;br /&gt;
|-&lt;br /&gt;
|5 || 9&lt;br /&gt;
|-&lt;br /&gt;
|6 || 6&lt;br /&gt;
|-&lt;br /&gt;
|7 || 5&lt;br /&gt;
|-&lt;br /&gt;
|8 || 6&lt;br /&gt;
|-&lt;br /&gt;
|9 || 3&lt;br /&gt;
|-&lt;br /&gt;
|10 || 9&lt;br /&gt;
|-&lt;br /&gt;
|11 || 8&lt;br /&gt;
|-&lt;br /&gt;
|12 || 5&lt;br /&gt;
|-&lt;br /&gt;
|13 || 8&lt;br /&gt;
|-&lt;br /&gt;
|14 || 10&lt;br /&gt;
|-&lt;br /&gt;
|15 || 8&lt;br /&gt;
|-&lt;br /&gt;
|16 || 11&lt;br /&gt;
|-&lt;br /&gt;
|17 || 12&lt;br /&gt;
|-&lt;br /&gt;
|18 || 6&lt;br /&gt;
|-&lt;br /&gt;
|19 || 7&lt;br /&gt;
|-&lt;br /&gt;
|20 || 8&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Mean and SD=&lt;br /&gt;
==Electron radius==&lt;br /&gt;
The probability that an electron is a distance &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; from the center of the hydrogen atom&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(r) = Cr^2 \exp^{-2 \frac{r}{R}}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Doing the integrals by hand (no tables) ,&lt;br /&gt;
&lt;br /&gt;
a.)Find the value of C&lt;br /&gt;
&lt;br /&gt;
b.) Find the mean electron radius and standard deviation for an electron in a hydrogen atom&lt;br /&gt;
&lt;br /&gt;
==Histograms by Hand==&lt;br /&gt;
&lt;br /&gt;
Given the following test scores from 40 students.&lt;br /&gt;
&lt;br /&gt;
 {| border=&amp;quot;1&amp;quot;  |cellpadding=&amp;quot;20&amp;quot; cellspacing=&amp;quot;0 &lt;br /&gt;
|-&lt;br /&gt;
| Trial || Value || Trial || Value|| Trial || Value|| Trial || Value&lt;br /&gt;
|-&lt;br /&gt;
|1 ||49 || 11 ||90 || 21 || 69 || 31 || 74&lt;br /&gt;
|-&lt;br /&gt;
|2 || 80 || 12 || 84 || 22 ||69 || 32 ||86&lt;br /&gt;
|-&lt;br /&gt;
|3 || 84 || 13 || 59 || 23 || 53 || 33 || 78&lt;br /&gt;
|-&lt;br /&gt;
|4 || 73 || 14 || 56 || 24 || 55 || 34 || 55&lt;br /&gt;
|-&lt;br /&gt;
|5 || 89 || 15 || 62 || 25 || 77 || 35 || 66&lt;br /&gt;
|-&lt;br /&gt;
|6 || 78 || 16 || 53 || 26 || 82 || 36 || 60&lt;br /&gt;
|-&lt;br /&gt;
|7 || 78 || 17 || 83 || 27 || 81 || 37 || 68&lt;br /&gt;
|-&lt;br /&gt;
|8 || 92 || 18 || 81 || 28 || 76 || 38 || 92&lt;br /&gt;
|-&lt;br /&gt;
|9 || 56 || 19 || 65 || 29 || 79 || 39 || 87&lt;br /&gt;
|-&lt;br /&gt;
|10 || 85 || 20 || 81 || 30 || 83 || 40 || 86&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
a.) calculate the mean and standard deviation&lt;br /&gt;
&lt;br /&gt;
b.) construct a histogram by hand which has 10 bins centered on 10,20,...&lt;br /&gt;
&lt;br /&gt;
c.) Use ROOT to construct a histogram.  Compare the mean and RMS from ROOT with your result in part (a) above.  What is the difference between the RMS report in the ROOT histogram and the standard deviation you calculated in part (a)?&lt;br /&gt;
&lt;br /&gt;
== Variance using Probability function==&lt;br /&gt;
&lt;br /&gt;
Given that &lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 = \lim_{N \rightarrow \infty} \frac{1}{N}\sum_{j=1}^n \left [ \left (x_j - \mu \right)^2) \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Justify that&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\lim_{N \rightarrow \infty} \frac{1}{N}\sum_{j=1}^n \left [ \left (x_j - \mu \right)^2  \right ] = \lim_{N \rightarrow \infty} \left [  \frac{1}{N}\sum_{j=1}^n x_j^2\right ] - \mu^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Note:The standard deviation (&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;) is the root mean square (RMS) of the deviations.&lt;br /&gt;
&lt;br /&gt;
RMS = &amp;lt;math&amp;gt;\sqrt{\frac{1}{N}\sum_i^N x_i^2}&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\sigma = \mbox{RMS}(x_i -\mu)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Binomial Probability Distributions=&lt;br /&gt;
1.)Evaluate the following (at least one by hand)&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
a.) &amp;lt;math&amp;gt;{6\choose 3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
b.) &amp;lt;math&amp;gt;{4\choose 2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
c.) &amp;lt;math&amp;gt;{10\choose 3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
d.) &amp;lt;math&amp;gt;{52\choose 4}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2.) Plot the binomial distribution P(x) for n=6 and p=1/2 from x=0 to 6.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) = {n\choose x}p^{x}q^{n-x} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3.)  Given the probability distribution below for the sum of the point on a pair of dice&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) =\left \{  {\frac{x-1}{36} \;\;\;\; 2 \le x \le 7 \atop \frac{13-x}{36} \;\;\; 7 &amp;lt; x \le 12} \right .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a.) find the mean&lt;br /&gt;
&lt;br /&gt;
b.) find the standard deviation &amp;lt;math&amp;gt;(\sigma)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4.) Prove that &amp;lt;math&amp;gt;\sigma^2 = npq&amp;lt;/math&amp;gt; for the Binomial distribution.&lt;br /&gt;
&lt;br /&gt;
=Poisson Prob Dist=&lt;br /&gt;
&lt;br /&gt;
==Variance==&lt;br /&gt;
&lt;br /&gt;
Show that &amp;lt;math&amp;gt;\sigma^2 = \mu&amp;lt;/math&amp;gt; for the Poisson Distribution starting with the definition of variance.&lt;br /&gt;
&lt;br /&gt;
==Binomial/Poisson Statistic==&lt;br /&gt;
The probability that a student will fail this course is 7.3%.&lt;br /&gt;
&lt;br /&gt;
a.) Calculate by hand (i.e. without a computer/calculator)  the expected number of students that will fail this course if there are 32 enrolled?&lt;br /&gt;
&lt;br /&gt;
b.) Calculate by hand the probability that 5 or more will fail in one semester.&lt;br /&gt;
&lt;br /&gt;
== Deadtime==&lt;br /&gt;
&lt;br /&gt;
In a counting experiment it is possible for a detector to be &amp;quot;too busy&amp;quot; recording the effects of a detected particle that it is unable to measure another particle traversing the detector during the short time interval.   &amp;quot;Dead time&amp;quot; is a measure of the time interval over  which your detector is unable to make a measurement because it is currently making a measurement.&lt;br /&gt;
&lt;br /&gt;
Assume that particle hit your detector at a rate of &amp;lt;math&amp;gt;1 \times 10^6&amp;lt;/math&amp;gt; particles/sec and that your detector has a deadtime of 200 ns &amp;lt;math&amp;gt;(200 \times 10^{-9} sec)&amp;lt;/math&amp;gt;.  The mean number of particles hitting the detector during this deadtime is &amp;lt;math&amp;gt;\mu = 0.2&amp;lt;/math&amp;gt;.   The detector efficiency is defined as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\epsilon = \frac{\mbox{average number of particles counted}}{\mbox{number of particles passing through the detector in 200 ns}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a.)  Find the efficiency of the detector assuming the process follows the Poisson distribution.&lt;br /&gt;
&lt;br /&gt;
b.) Graph the efficiency as a function of the incident particle flux for rates between 0 and &amp;lt;math&amp;gt;10 \times 10^6&amp;lt;/math&amp;gt; particles/sec.&lt;br /&gt;
&lt;br /&gt;
= Gaussian Prob Dist=&lt;br /&gt;
== Counting experiment variance==&lt;br /&gt;
&lt;br /&gt;
a.)What is the standard deviation for a counting experiment with a mean &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; = 100.&lt;br /&gt;
&lt;br /&gt;
b.)What is the standard deviation if the mean number of counts is increased by a factor of 4?&lt;br /&gt;
&lt;br /&gt;
== Half Width -vs- variance==&lt;br /&gt;
Show that the full-width at half maximum &amp;lt;math&amp;gt;(\Gamma)&amp;lt;/math&amp;gt; is related to the standard devision by &amp;lt;math&amp;gt;\Gamma = 2.3548 \sigma&amp;lt;/math&amp;gt;  for the Gaussian probability distribution.  Begin with the definition that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_G\left (\mu + \frac{\Gamma}{2} \right ) = \frac{P_G(\mu)}{2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Gaussian Probability==&lt;br /&gt;
a.) Determine, by direct integration, the probability  of observing a value beyond 1 standard deviation from the mean of a Gaussian distribution? ie: &amp;lt;math&amp;gt;P_G(X \le \mu - \sigma, \mu, \sigma)+ P_G(X \ge \mu + \sigma, \mu, \sigma)&amp;lt;/math&amp;gt; =?&lt;br /&gt;
&lt;br /&gt;
b.) Find the value of &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;P_G(\mu + \sigma, \mu, \sigma) = A P_G(\mu,\mu,\sigma)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
c.) repeat parts a.) and b.) above for &amp;lt;math&amp;gt;P_G(\mu + P.E., \mu, \sigma)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;P_G(\mu + \Gamma/2, \mu, \sigma)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P_G(X =\mu + \sigma, \mu, \sigma)=0.24197 = 0.60653 P_G(X = \mu , \mu, \sigma)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P_G(X =\mu + PE, \mu, \sigma)=0.3178 = 0.7965 P_G(X = \mu , \mu, \sigma)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P_G(X =\mu - \Gamma/2, \mu, \sigma)=0.19947 = 0.5 P_G(X = \mu , \mu, \sigma)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Error Propagation=&lt;br /&gt;
==Lorentzian==&lt;br /&gt;
&lt;br /&gt;
a.)What fraction of the area of a Lorentzian curve is enclosed within the interval &amp;lt;math&amp;gt;(\mu \pm \frac{3}{2} \Gamma)&amp;lt;/math&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
b.) The probability of observing a value from the Lorentzian distribution that is more than 2 half-widths (&amp;lt;math&amp;gt;\Gamma/2&amp;lt;/math&amp;gt;) from the mean.&lt;br /&gt;
&lt;br /&gt;
== Derivatives==&lt;br /&gt;
&lt;br /&gt;
Find the uncertainty &amp;lt;math&amp;gt;\sigma_x&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; as a function of the uncertainties&amp;lt;math&amp;gt; \sigma_u&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sigma_v&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;u&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; for the following functions:&lt;br /&gt;
&lt;br /&gt;
a.) &amp;lt;math&amp;gt;x = \frac{1}{2(u-v)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
b.) &amp;lt;math&amp;gt;x= uv^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
c.) &amp;lt;math&amp;gt;x = u^2 + v^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
d.) &amp;lt;math&amp;gt;x = \frac{u-v}{u+v}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Snell's Law==&lt;br /&gt;
&lt;br /&gt;
Given Snell's Law&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;n_1 \sin(\theta_1) = n_2 \sin(\theta_2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Assume &amp;lt;math&amp;gt;n_1=1&amp;lt;/math&amp;gt; is known with absolute certainty and find &amp;lt;math&amp;gt;n_2&amp;lt;/math&amp;gt; and it's uncertainty when the following angles are measured&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\theta_1 = (22.03 \pm 0.02)^{\circ}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\theta_2 = (14.45 \pm 0.2)^{\circ}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Linear Fit=&lt;br /&gt;
&lt;br /&gt;
==2 Eq. 2 unknowns==&lt;br /&gt;
Determine &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; for the system below&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;7x + 8y =100&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;2x-9y = 10&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==3 Eq. 3 unknowns==&lt;br /&gt;
&lt;br /&gt;
Given the system of 3 Equations and 3 Unkowns:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;a_{11}x + a_{12}y + a_{13}z = A&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;a_{21}x + a_{22}y +a_{23}z= B&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;a_{31}x + a_{32}y +a_{33}z= C&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or in matrix form&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left( \begin{array}{ccc} a_{11} &amp;amp; a_{12} &amp;amp; a_{13}\\ a_{21} &amp;amp; a_{22} &amp;amp; a_{23} \\ a_{31} &amp;amp; a_{32} &amp;amp; a_{33} \end{array} \right)\left( \begin{array}{c} x \\ y  \\z\end{array} \right)= \left( \begin{array}{c} A \\ B \\C \end{array} \right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a.)Express a the solution for X,Y, and Z in matrix form assuming the remaining terms in the above are known (&amp;lt;math&amp;gt;A,B,C&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;a_{ij}&amp;lt;/math&amp;gt; are known)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
b.) Find expressions for x,y, and z in terms of A,B,C when&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;x + y -z = A&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;z= B&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;2x + y +2z= C&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Linear Data Fit==&lt;br /&gt;
&lt;br /&gt;
A metal rod is placed with its ends in two different temperature baths.  One bath is at zero degree Celsius and the other at 100.  The temperature along the rod is measure and given in the table below.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;  |cellpadding=&amp;quot;20&amp;quot; cellspacing=&amp;quot;0 &lt;br /&gt;
|-&lt;br /&gt;
| Trial || Posiiton (cm) ||Temperature (Celsius) &lt;br /&gt;
|-&lt;br /&gt;
|1 ||1.0||15.6 &lt;br /&gt;
|-&lt;br /&gt;
|2 || 2.0 || 17.5&lt;br /&gt;
|-&lt;br /&gt;
|3 || 3.0|| 36.6&lt;br /&gt;
|-&lt;br /&gt;
|4 || 4.0 || 43.8&lt;br /&gt;
|-&lt;br /&gt;
|5 || 5.0 || 58.2&lt;br /&gt;
|-&lt;br /&gt;
|6 || 6.0 ||61.6&lt;br /&gt;
|-&lt;br /&gt;
|7 || 7.0 || 64.2&lt;br /&gt;
|-&lt;br /&gt;
|8 || 8.0 || 70.4&lt;br /&gt;
|-&lt;br /&gt;
|9 || 9.0 || 98.8&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
a.) Fit the above data assuming a linear function &lt;br /&gt;
T = A + B X&lt;br /&gt;
&lt;br /&gt;
assuming all of the data has the same uncertainty.  Report the value of A &amp;amp; B and the uncertainty in the parameters.&lt;br /&gt;
&lt;br /&gt;
b.) repeat part a.) above except this time assume each data point has an uncertainty given by the Poisson distribution as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma_i^2 \approx T_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Polynomial Least Squares Fit=&lt;br /&gt;
&lt;br /&gt;
==Matrix Inversion==&lt;br /&gt;
&lt;br /&gt;
Use the Gauss-Jordan method to find the inverse matrix &amp;lt;math&amp;gt;\tilde{A}^{-1}&amp;lt;/math&amp;gt; given&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \tilde{A} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
2 &amp;amp; -1 &amp;amp; 0\\&lt;br /&gt;
-1 &amp;amp; 2 &amp;amp; -1 \\&lt;br /&gt;
0 &amp;amp; -1 &amp;amp; 2&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Poly Fit using ROOT==&lt;br /&gt;
&lt;br /&gt;
Hand in your source code and graphs for Lab 13&lt;br /&gt;
&lt;br /&gt;
= Polynomial Least Squares Fit=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Perform a least squares fit to the data in Lab 14 using the Grid search method from &lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/TF_ErrAna_InClassLab#Lab_16 Lab 16].&lt;br /&gt;
&lt;br /&gt;
This will be a way to check your grid search algorithm against a known solution.  Use the Temp -vs- Voltage data and the Linear function in Lab 13 above.&lt;br /&gt;
&lt;br /&gt;
Hand in your source code in ROOT and a graph showing the linear fit with the Grid search parameters and the parameters found through Matrix inversion.&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences] [[Forest_Error_Analysis_for_the_Physical_Sciences]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=Forest_ErrAna_StatDist&amp;diff=91649</id>
		<title>Forest ErrAna StatDist</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=Forest_ErrAna_StatDist&amp;diff=91649"/>
		<updated>2014-03-14T19:27:55Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Variance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Parent Distribution==&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; represent our ith attempt to measurement the quantity &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Due to the random errors present in any experiment we should not expect &amp;lt;math&amp;gt;x_i = x&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we neglect systematic errors, then we should expect &amp;lt;math&amp;gt; x_i&amp;lt;/math&amp;gt; to, on average, follow some probability distribution around the correct value &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This probability distribution can be referred to as the &amp;quot;parent population&amp;quot;.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Average and Variance ==&lt;br /&gt;
===Average===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The word &amp;quot;average&amp;quot; is used to describe a property of a &amp;quot;parent&amp;quot; probability distribution or a set of observations/measurements made in an experiment which gives an indication of a likely outcome of an experiment.&lt;br /&gt;
&lt;br /&gt;
The symbol&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is usually used to represent the &amp;quot;mean&amp;quot; of a known probability (parent) distribution (parent mean) while the &amp;quot;average&amp;quot; of a set of observations/measurements is denoted as &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and is commonly referred to as the &amp;quot;sample&amp;quot; average or &amp;quot;sample mean&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Definition of the mean&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu \equiv \lim_{N\rightarrow \infty} \frac{\sum x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here the above average of a parent distribution is defined in terms of an infinite sum of observations (x_i) of an observable x divided by the number of observations.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; is a calculation of the mean using a finite number of observations&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \bar{x} \equiv  \frac{\sum x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This definition uses the assumption that the result of an experiment, measuring a sample average of &amp;lt;math&amp;gt;(\bar{x})&amp;lt;/math&amp;gt;, asymptotically approaches the &amp;quot;true&amp;quot; average of the parent distribution &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
===Variance===&lt;br /&gt;
&lt;br /&gt;
The word &amp;quot;variance&amp;quot; is used to describe a property of a probability distribution or a set of observations/measurements made in an experiment which gives an indication how much an observation will deviate from and average value.&lt;br /&gt;
&lt;br /&gt;
A deviation &amp;lt;math&amp;gt;(d_i)&amp;lt;/math&amp;gt; of any measurement &amp;lt;math&amp;gt;(x_i)&amp;lt;/math&amp;gt; from a parent distribution with a mean &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; can be defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;d_i\equiv x_i - \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the deviations should average to ZERO for an infinite number of observations by definition of the mean.&lt;br /&gt;
&lt;br /&gt;
Definition of the average&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu \equiv \lim_{N\rightarrow \infty} \frac{\sum x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\lim_{N\rightarrow \infty} \frac{\sum (x_i - \mu)}{N}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \left ( \lim_{N\rightarrow \infty} \frac{\sum (x_i }{N}\right ) - \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \left ( \lim_{N\rightarrow \infty} \frac{\sum (x_i }{N}\right ) - \lim_{N\rightarrow \infty} \frac{\sum x_i}{N} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But the AVERAGE DEVIATION &amp;lt;math&amp;gt;(\bar{d})&amp;lt;/math&amp;gt; is given by an average of the magnitude of the deviations given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{d} = \lim_{N\rightarrow \infty} \frac{\sum \left | (x_i - \mu)\right |}{N}&amp;lt;/math&amp;gt; = a measure of the dispersion of the expected observations about the mean&lt;br /&gt;
&lt;br /&gt;
Taking the absolute value though is cumbersome when performing a statistical analysis so one may express this dispersion in terms of the variance&lt;br /&gt;
&lt;br /&gt;
A typical variable used to denote the variance is&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and is defined as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \lim_{N\rightarrow \infty}\left [ \frac{\sum (x_i-\mu)^2 }{N}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Standard Deviation====&lt;br /&gt;
&lt;br /&gt;
The standard deviation is defined as the square root of the variance&lt;br /&gt;
&lt;br /&gt;
:S.D. = &amp;lt;math&amp;gt;\sqrt{\sigma^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The mean should be thought of as a parameter which characterizes the observations we are making in an experiment.  In general the mean specifies the probability distribution that is representative of the observable we are trying to measure through experimentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The variance characterizes the uncertainty associated with our experimental attempts to determine the &amp;quot;true&amp;quot; value.  Although the mean and true value may not be equal, their difference should be less than the uncertainty given by the governing probability distribution.&lt;br /&gt;
&lt;br /&gt;
==== Another Expression for Variance====&lt;br /&gt;
&lt;br /&gt;
Using the definition of variance (omitting the limit as &amp;lt;math&amp;gt;n \rightarrow \infty&amp;lt;/math&amp;gt;) &lt;br /&gt;
;Evaluating the definition of variance: &amp;lt;math&amp;gt;\sigma^2 \equiv \frac{\sum(x_i-\mu)^2}{N} = \frac{\sum (x_i^2 -2x_i \mu + \mu^2)}{N} = \frac{\sum x_i^2}{N} - 2 \mu \frac{\sum x_i}{N} + \frac{N \mu^2}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \frac{\sum x_i^2}{N} -2 \mu^2 + \mu^2 =\frac{\sum x_i^2}{N} - \mu^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum(x_i-\mu)^2}{N}  =\frac{\sum x_i^2}{N} - \mu^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can recast the above in terms of expectation value where &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E[x] \equiv \sum x_i P_x(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \sigma^2 = E[(x-\mu)^2] = \sum_{x=0}^n (x_i - \mu)^2 P(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= E[x^2] - \left ( E[x]\right )^2 = \sum_{x=0}^n x_i^2 P(x_i) - \left ( \sum_{x=0}^n x_i P(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Average for an unknown probability distribution (parent population)==&lt;br /&gt;
&lt;br /&gt;
If the &amp;quot;Parent Population&amp;quot; is not known, you are just given a list of numbers with no indication of the probability distribution that they were drawn from, then the average and variance may be calculate as shown below.&lt;br /&gt;
&lt;br /&gt;
===Arithmetic Mean and variance===&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; observables are mode in an experiment then the arithmetic mean of those observables is defined as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{x} = \frac{\sum_{i=1}^{i=N} x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;unbiased&amp;quot; variance of the above sample is defined as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;s^2 = \frac{\sum_{i=1}^{i=N} (x_i - \bar{x})^2}{N-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;If you were told that the average is &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; then you can calculate the &lt;br /&gt;
&amp;quot;true&amp;quot;  variance of the above sample as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \frac{\sum_{i=1}^{i=N} (x_i - \bar{x})^2}{N}&amp;lt;/math&amp;gt; = RMS Error= Root Mean Squared Error&lt;br /&gt;
&lt;br /&gt;
;Note:RMS = Root Mean Square = &amp;lt;math&amp;gt;\frac{\sum_i^n x_i^2}{N}&amp;lt;/math&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
==== Statistical Variance decreases with  N====&lt;br /&gt;
&lt;br /&gt;
The repetition of an experiment can decrease the STATISTICAL error of the experiment&lt;br /&gt;
&lt;br /&gt;
Consider the following:&lt;br /&gt;
&lt;br /&gt;
The average value of the mean of a sample of n observations drawn from the parent population is the same as the average value of each observation.  (The average of the averages  is the same as one of the averages)&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\bar{x} = \frac{\sum x_i}{N} =&amp;lt;/math&amp;gt; sample mean&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\overline{\left ( \bar{x} \right ) } = \frac{\sum{\bar{x}_i}}{N} =\frac{1}{N} N \bar{x_i} = \bar{x}&amp;lt;/math&amp;gt; if all means are the same&lt;br /&gt;
&lt;br /&gt;
This is the reason why the sample mean is a measure of the population average ( &amp;lt;math&amp;gt;\bar{x} \sim \mu&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Now consider the variance of the average of the averages (this is not the variance of the individual measurements but the variance of their means)&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2_{\bar{x}} = \frac{\sum \left (\bar{x} -\overline{\left ( \bar{x} \right ) }  \right )^2}{N} =\frac{\sum \bar{x_i}^2}{N}  -\left( \overline{\left ( \bar{x} \right ) }  \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{\sum \bar{x_i}^2}{N}  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{\sum \left( \sum \frac{x_i}{N}\right)^2}{N}  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2}\frac{\sum \left( \sum x_i\right)^2}{N}  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2}\frac{\sum \left (\sum x_i^2 + \sum_{i \ne j} x_ix_j \right )}{N}  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2} \left [ \frac{\sum \left(\sum x_i^2 \right)}{N}  + \frac{ \sum \left (\sum_{i \ne j} x_ix_j \right )}{N} \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;If the measurements are all independent&lt;br /&gt;
:Then &amp;lt;math&amp;gt; \frac{\sum_{i \ne j} x_i x_j}{N} = \frac{\sum x_i}{N} \frac{ \sum x_j}{N}&amp;lt;/math&amp;gt; : if &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; is independent of &amp;lt;math&amp;gt;x_j&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;i \ne j&amp;lt;/math&amp;gt;)&lt;br /&gt;
:&amp;lt;math&amp;gt;= \left ( \frac{\sum x_i}{N} \right)^2 = \bar{x}^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
example:&lt;br /&gt;
:(x_1x_2 + x_1x_3 + x_2x_1+x_2x_3+x_3x_1+x_3x_2+ ...) = (x_1+x_2+x_3)&lt;br /&gt;
 The above part of the proof needs work&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2_{\bar{x}}=\frac{1}{N^2} \left [ \frac{\sum \left(\sum x_i^2 \right)}{N}  + \sum_{i \ne j} \bar{x}^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I use the expression &amp;lt;math&amp;gt;\sigma^2 = E[x^2] - \left ( E[x] \right)^2&amp;lt;/math&amp;gt;  again, except for&amp;lt;math&amp;gt; x_i&amp;lt;/math&amp;gt; and not &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; and turn it around so&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\left(\sum x_i^2 \right)}{N} = \sigma^2 + \left ( \frac{\sum x_i}{N}\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now I have&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2_{\bar{x}}=\frac{1}{N^2} \left [ \sum \left (\sigma^2 +  \left ( \frac{\sum x_i}{N} \right )^2 \right )+ \sum_{i \ne j} \bar{x}^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2} \left [ N\sigma^2 +  N\left ( \frac{\sum x_i}{N} \right )^2 + \sum_{i \ne j} \bar{x}^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2} \left [ N\sigma^2 +  N\left ( \frac{\sum x_i}{N} \right )^2 + N(N-1) \bar{x}^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt; Number of cross terms is N*(N-1)&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2} \left [ N\sigma^2 +  N\left ( \frac{\sum x_i}{N} \right )^2 + (N^2 -N) \left ( \frac{\sum x_i}{N} \right )^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt; Number of cross terms is N*(N-1)&lt;br /&gt;
:&amp;lt;math&amp;gt;= \left [ \frac{\sigma^2}{N} +  \left ( \frac{\sum x_i}{N} \right )^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;= \left [ \frac{\sigma^2}{N} +  \left (  \bar{x}\right )^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sigma^2}{N} &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above is the essence of counting statistics.&lt;br /&gt;
&lt;br /&gt;
It says that the STATISTICAL error in an experiment decreases as a function of &amp;lt;math&amp;gt;\frac{1}{\sqrt N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Biased and Unbiased variance====&lt;br /&gt;
&lt;br /&gt;
Where does this idea of an unbiased variance come from?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using the same procedure as the previous section let's look at the average variance of the variances.&lt;br /&gt;
&lt;br /&gt;
A sample variance of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; measurements of &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; is&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_n^2 = \frac{\sum(x_i-\bar{x})^2}{n} = E[x^2] - \left ( E[x] \right)^2 = \frac{\sum x_i^2}{n} -\left ( \bar{x} \right)^2&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To determine the &amp;quot;true&amp;quot; variance consider taking average of several sample variances (this is the same argument used above which let to &amp;lt;math&amp;gt;\overline{(\bar{x})} = \bar{x}&amp;lt;/math&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum_j \left [ \sigma_n^2 \right ]_j}{N} = \frac{ \sum_j \left [ \frac{\sum_i x_i^2}{n} -\left ( \bar{x} \right)^2 \right ]_j}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{1}{n}\sum_i \left ( \frac{\sum_j x_j^2}{N} \right )_i - \frac {\sum_j \left ( \bar{x} \right)^2 }{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{1}{n}\sum_i \left ( \frac{\sum_j x_j^2}{N} \right )_i - \left [ \left ( \frac {\sum_j \bar{x}}{N} \right)^2  + \sigma_{\bar{x}}^2\right ]&amp;lt;/math&amp;gt;  :  as shown previously      &amp;lt;math&amp;gt;E[\bar{x}^2] = \left ( E[\bar{x}] \right )^2 + \sigma_{\bar{x}}^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{1}{n}\sum_i \left ( \left [ \left (\frac{\sum_j x_j}{N}\right)^2 + \sigma^2 \right ]\right )_i - \left [ \left ( \frac {\sum_j x_j}{N} \right)^2  + \frac{\sigma^2}{n}\right ]&amp;lt;/math&amp;gt; : also shown previously&amp;lt;math&amp;gt;\overline{\left ( \bar{x} \right ) } =  \bar{x}&amp;lt;/math&amp;gt;  the universe average is the same as the sample average&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{1}{n} \left ( n\left [ \left (\frac{\sum_j x_j}{N}\right)^2 + n\sigma^2 \right ]\right )_i - \left [ \left ( \frac {\sum_j x_j}{N} \right)^2  + \frac{\sigma^2}{n}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 - \frac{\sigma^2}{n}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{n-1}{n}\sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \sigma^2 = \frac{n}{n-1}\frac{\sum \sigma_i^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 =&amp;lt;/math&amp;gt; the sample variance&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum \sigma_i^2}{N} =&amp;lt;/math&amp;gt; an average of all possible sample variance which should be equivalent to the &amp;quot;true&amp;quot; population variance.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \frac{\sum \sigma_i^2}{N} \sim \sum \frac{x_i-\bar{x}}{n}&amp;lt;/math&amp;gt; : if all the variances are the same this would be equivalent&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 = \frac{n}{n-1}\frac{\sum(x_i-\bar{x})}{n}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\sum(x_i-\bar{x})}{n-1} =&amp;lt;/math&amp;gt; unbiased sample variance&lt;br /&gt;
&lt;br /&gt;
==Probability Distributions==&lt;br /&gt;
&lt;br /&gt;
=== Mean(Expectation value) and variance===&lt;br /&gt;
====Mean of Discrete Probability Distribution====&lt;br /&gt;
&lt;br /&gt;
In the case that you know the probability distribution you can calculate the mean&amp;lt;math&amp;gt; (\mu)&amp;lt;/math&amp;gt; or expectation value E(x) and standard deviation as&lt;br /&gt;
&lt;br /&gt;
For a Discrete probability distribution&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = E[x]=\lim_{N \rightarrow \infty} \frac{\sum_{i=1}^n x_i P(x_i)}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;N=&amp;lt;/math&amp;gt; number of observations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;n=&amp;lt;/math&amp;gt; number of different possible observable variables&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x_i =&amp;lt;/math&amp;gt; ith observable quantity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(x_i) =&amp;lt;/math&amp;gt; probability of observing &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; = Probability Mass Distribution for a discrete probability distribution&lt;br /&gt;
&lt;br /&gt;
====Mean of a continuous probability distibution====&lt;br /&gt;
The average (mean) of a sample drawn from any probability distribution is defined in terms of the expectation value E(x) such that&lt;br /&gt;
&lt;br /&gt;
The expectation value for a  continuous probability distribution  is calculated as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\mu = E(x) = \int_{-\infty}^{\infty} x P(x)dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variance===&lt;br /&gt;
&lt;br /&gt;
==== Variance of a discrete PDF====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma^2 = \sum_{i=1}^n \left [ (x_i - \mu)^2 P(x_i)\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variance of a Continuous PDF ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma^2 = \int_{-\infty}^{\infty} \left [ (x - \mu)^2 P(x)\right ]dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Expectation of Arbitrary function====&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;f(x)&amp;lt;/math&amp;gt; is an arbitrary function of a variable &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; governed by a probability distribution &amp;lt;math&amp;gt;P(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then the expectation value of &amp;lt;math&amp;gt;f(x)&amp;lt;/math&amp;gt; is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E[f(x)] = \sum_{i=1}^N f(x_i) P(x_i) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
or if a continuous distribtion&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E[f(x)] = \int_{-\infty}^{\infty} f(x) P(x)dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Uniform===&lt;br /&gt;
&lt;br /&gt;
The Uniform probability distribution function is a continuous probability function over a specified interval in which any value within the interval has the same probability of occurring.&lt;br /&gt;
&lt;br /&gt;
Mathematically the uniform distribution over an interval from a to b is given by&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_U(x) =\left \{  {\frac{1}{b-a} \;\;\;\; x &amp;gt;a \mbox{ and } x &amp;lt;b \atop 0 \;\;\;\; x&amp;gt;b \mbox{ or } x &amp;lt; a} \right .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Mean of Uniform PDF====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = \int_{-\infty}^{\infty} xP_U(x)dx = \int_{a}^{b} \frac{x}{b-a} dx = \left . \frac{x^2}{2(b-a)} \right |_a^b = \frac{1}{2}\frac{b^2 - a^2}{b-a} = \frac{1}{2}(b+a)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Variance of Uniform PDF====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \int_{-\infty}^{\infty} (x-\mu)^2 P_U(x)dx = \int_{a}^{b} \frac{\left (x-\frac{b+a}{2}\right )^2}{b-a} dx = \left . \frac{(x -\frac{b+a}{2})^3}{3(b-a)} \right |_a^b &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{3(b-a)}\left [ \left (b -\frac{b+a}{2} \right )^3 - \left (a -\frac{b+a}{2} \right)^3\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{3(b-a)}\left [ \left (\frac{b-a}{2} \right )^3 - \left (\frac{a-b}{2} \right)^3\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{24(b-a)}\left [ (b-a)^3 - (-1)^3 (b-a)^3\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{12}(b-a)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now use ROOT to generate uniform distributions.&lt;br /&gt;
http://wiki.iac.isu.edu/index.php/TF_ErrAna_InClassLab#Day_3&lt;br /&gt;
&lt;br /&gt;
===Binomial Distribution===&lt;br /&gt;
&lt;br /&gt;
Binomial random variable describes experiments in which the outcome has only 2 possibilities.   The two possible outcomes can be labeled as &amp;quot;success&amp;quot; or &amp;quot;failure&amp;quot;. The probabilities may be defined as &lt;br /&gt;
&lt;br /&gt;
;p&lt;br /&gt;
: the probability of a success&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
;q&lt;br /&gt;
:the probability of a failure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we let &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; represent the number of successes after repeating the experiment &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; times&lt;br /&gt;
&lt;br /&gt;
Experiments with &amp;lt;math&amp;gt;n=1&amp;lt;/math&amp;gt; are also known as Bernoulli trails.&lt;br /&gt;
&lt;br /&gt;
Then &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; is the Binomial random variable with parameters &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The number of ways in which the &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; successful outcomes can be organized in &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; repeated  trials is&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{n !}{ \left [ (n-x) ! x !\right ]}&amp;lt;/math&amp;gt;  where the &amp;lt;math&amp;gt; !&amp;lt;/math&amp;gt; denotes a factorial such that &amp;lt;math&amp;gt;5! = 5\times4\times3\times2\times1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The expression is known as the binomial coefficient and is represented as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;{n\choose x}=\frac{n!}{x!(n-x)!}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of any one ordering of the success and failures is given by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P( \mbox{experimental ordering}) = p^{x}q^{n-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This means the probability of getting exactly k successes after n trials is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_B(x) = {n\choose x}p^{x}q^{n-x} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Mean====&lt;br /&gt;
&lt;br /&gt;
It can be shown that the Expectation Value of the distribution is&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = n p&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = \sum_{x=0}^n x P_B(x) = \sum_{x=0}^n x \frac{n!}{x!(n-x)!} p^{x}q^{n-x}&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt; =  \sum_{x=1}^n  \frac{n!}{(x-1)!(n-x)!} p^{x}q^{n-x}&amp;lt;/math&amp;gt;  :summation starts from x=1 and not x=0 now&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np \sum_{x=1}^n  \frac{(n-1)!}{(x-1)!(n-x)!} p^{x-1}q^{n-x}&amp;lt;/math&amp;gt;  :factor out &amp;lt;math&amp;gt;np&amp;lt;/math&amp;gt; : replace n-1 with m everywhere and it looks like binomial distribution&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np \sum_{y=0}^{n-1}  \frac{(n-1)!}{(y)!(n-y-1)!} p^{y}q^{n-y-1}&amp;lt;/math&amp;gt; :change summation index so y=x-1, now n become n-1&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np \sum_{y=0}^{n-1}  \frac{(n-1)!}{(y)!(n-1-y)!} p^{y}q^{n-1-y}&amp;lt;/math&amp;gt; :&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np (q+p)^{n-1}&amp;lt;/math&amp;gt;  :definition of binomial expansion&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np 1^{n-1}&amp;lt;/math&amp;gt;  :q+p =1&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====variance ====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = npq&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Remember: &amp;lt;math&amp;gt;\frac{\sum(x_i-\mu)^2}{N} = \frac{\sum (x_i^2 -2x_i \mu + \mu^2)}{N} = \frac{\sum x_i^2}{N} - 2 \mu \frac{\sum x_i}{N} + \frac{N \mu^2}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \frac{\sum x_i^2}{N} -2 \mu^2 + \mu^2 =\frac{\sum x_i^2}{N} - \mu^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum(x_i-\mu)^2}{N}  =\frac{\sum x_i^2}{N} - \mu^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \sigma^2 = E[(x-\mu)^2] = \sum_{x=0}^n (x_i - \mu)^2 P_B(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= E[x^2] - \left ( E[x]\right )^2 = \sum_{x=0}^n x_i^2 P_B(x_i) - \left ( \sum_{x=0}^n x_i P_B(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To calculate the variance of the Binomial distribution I will just calculate &amp;lt;math&amp;gt;E[x^2]&amp;lt;/math&amp;gt; and then subtract off &amp;lt;math&amp;gt;\left ( E[x]\right )^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;E[x^2] = \sum_{x=0}^n x^2 P_B(x)&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_{x=1}^n x^2 P_B(x)&amp;lt;/math&amp;gt;   : x=0 term is zero so no contribution&lt;br /&gt;
:&amp;lt;math&amp;gt;=\sum_{x=1}^n x^2 \frac{n!}{x!(n-x)!} p^{x}q^{n-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \sum_{x=1}^n x \frac{(n-1)!}{(x-1)!(n-x)!} p^{x-1}q^{n-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let m=n-1 and y=x-1&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \sum_{y=0}^n (y+1) \frac{m!}{(y)!(m-1-y+1)!} p^{y}q^{m-1-y+1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \sum_{y=0}^n (y+1) P(y)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \left ( \sum_{y=0}^n y P(y) + \sum_{y=0}^n (1) P(y) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \left ( mp + 1 \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \left ( (n-1)p + 1 \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = E[x^2] - \left ( E[x] \right)^2 = np \left ( (n-1)p + 1 \right) - (np)^2 = np(1-p) = npq&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examples===&lt;br /&gt;
&lt;br /&gt;
==== The number of times a coin toss is heads.====&lt;br /&gt;
&lt;br /&gt;
The probability of a coin landing with the head of the coin facing up is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P = \frac{\mbox{number of desired outcomes}}{\mbox{number of possible outcomes}} = \frac{1}{2}&amp;lt;/math&amp;gt; = Uniform distribution with a=0 (tails) b=1 (heads).&lt;br /&gt;
&lt;br /&gt;
Suppose you toss a coin 4 times.  Here are the possible outcomes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;  |cellpadding=&amp;quot;20&amp;quot; cellspacing=&amp;quot;0 &lt;br /&gt;
|order Number&lt;br /&gt;
|colspan= &amp;quot;4&amp;quot; | Trial #&lt;br /&gt;
| # of Heads&lt;br /&gt;
|-&lt;br /&gt;
| || 1|| 2 || 3|| 4 ||&lt;br /&gt;
|-&lt;br /&gt;
|1 ||t || t || t|| t ||0&lt;br /&gt;
|-&lt;br /&gt;
|2||h || t || t|| t ||1&lt;br /&gt;
|-&lt;br /&gt;
|3||t || h || t|| t ||1&lt;br /&gt;
|-&lt;br /&gt;
|4||t || t || h|| t ||1&lt;br /&gt;
|-&lt;br /&gt;
|5||t || t || t|| h ||1&lt;br /&gt;
|-&lt;br /&gt;
|6||h || h || t|| t ||2&lt;br /&gt;
|-&lt;br /&gt;
|7||h || t || h|| t ||2&lt;br /&gt;
|-&lt;br /&gt;
|8||h || t || t|| h||2&lt;br /&gt;
|-&lt;br /&gt;
|9||t || h || h|| t ||2&lt;br /&gt;
|-&lt;br /&gt;
|10||t || h || t|| h ||2&lt;br /&gt;
|-&lt;br /&gt;
|11||t || t || h|| h ||2&lt;br /&gt;
|-&lt;br /&gt;
|12||t|| h || h|| h||3&lt;br /&gt;
|-&lt;br /&gt;
|13||h|| t || h|| h||3&lt;br /&gt;
|-&lt;br /&gt;
|14||h|| h || t|| h||3&lt;br /&gt;
|-&lt;br /&gt;
|15||h|| h || h|| t||3&lt;br /&gt;
|-&lt;br /&gt;
|16||h|| h || h|| h||4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of order #1 happening is&lt;br /&gt;
&lt;br /&gt;
P( order #1) = &amp;lt;math&amp;gt;\left ( \frac{1}{2} \right )^0\left ( \frac{1}{2} \right )^4 = \frac{1}{16}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
P( order #2) = &amp;lt;math&amp;gt;\left ( \frac{1}{2} \right )^1\left ( \frac{1}{2} \right )^3 = \frac{1}{16}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The probability of observing the coin land on heads 3 times out of 4 trials is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(x=3) = \frac{4}{16} = \frac{1}{4} =  {n\choose x}p^{x}q^{n-x}  = \frac{4 !}{ \left [ (4-3) ! 3 !\right ]} \left ( \frac{1}{2}\right )^{3}\left ( \frac{1}{2}\right )^{4-3} = \frac{24}{1 \times 6} \frac{1}{16} = \frac{1}{4}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== A 6 sided die====&lt;br /&gt;
&lt;br /&gt;
A die is a 6 sided cube with dots on each side.  Each side has a unique number of dots with at most 6 dots on any one side.&lt;br /&gt;
&lt;br /&gt;
P=1/6 = probability of landing on any side of the cube.&lt;br /&gt;
&lt;br /&gt;
Expectation value :&lt;br /&gt;
; The expected (average) value for rolling a single die.&lt;br /&gt;
: &amp;lt;math&amp;gt;E({\rm Roll\ With\ 6\ Sided\ Die}) =\sum_i x_i P(x_i) =1 \left ( \frac{1}{6} \right) + 2\left ( \frac{1}{6} \right)+ 3\left ( \frac{1}{6} \right)+ 4\left ( \frac{1}{6} \right)+ 5\left ( \frac{1}{6} \right)+ 6\left ( \frac{1}{6} \right)=\frac{1 + 2 + 3 + 4 + 5 + 6}{6} = 3.5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variance:&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;E({\rm Roll\ With\ 6\ Sided\ Die}) =\sum_i (x_i - \mu)^2 P(x_i)  &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= (1-3.5)^2 \left ( \frac{1}{6} \right) + (2-3.5)^2\left ( \frac{1}{6} \right)+ (3-3.5)^2\left ( \frac{1}{6} \right)+ (4-3.5)^2\left ( \frac{1}{6} \right)+ (5-3.5)^2\left ( \frac{1}{6} \right)+ (6-3.5)^2\left ( \frac{1}{6} \right) =2.92&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i (x_i)^2 P(x_i) - \mu^2 = \left [ 1 \left ( \frac{1}{6} \right) + 4\left ( \frac{1}{6} \right)+ 9\left ( \frac{1}{6} \right)+ 16\left ( \frac{1}{6} \right)+ 25\left ( \frac{1}{6} \right)+ 36\left ( \frac{1}{6} \right) \right ] - (3.5)^3 =2.92&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we roll the die 10 times what is the probability that X dice will show a 6?&lt;br /&gt;
&lt;br /&gt;
A success will be that the die landed with 6 dots face up.&lt;br /&gt;
&lt;br /&gt;
So the probability of this is 1/6 (p=1/6) , we toss it 10 times (n=10) so the binomial distribution function for a success/fail experiment says&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P_B(x)  =  {n\choose x}p^{x}q^{n-x}  = \frac{10 !}{ \left [ (10-x) ! x !\right ]} \left ( \frac{1}{6}\right )^{x}\left ( \frac{5}{6}\right )^{10-x} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So the probability the die will have 6 dots face up in 4/10 rolls is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P_B(x=4)  =  \frac{10 !}{ \left [ (10-4) ! 4 !\right ]} \left ( \frac{1}{6}\right )^{4}\left ( \frac{5}{6}\right )^{10-4} &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; =  \frac{10 !}{ \left [ (6) ! 4 !\right ]} \left ( \frac{1}{6}\right )^{4}\left ( \frac{5}{6}\right )^{6} = \frac{210 \times 5^6}{6^10}=0.054 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mean = np =&amp;lt;math&amp;gt;\mu =  10/6 = 1.67&amp;lt;/math&amp;gt; &lt;br /&gt;
Variance = &amp;lt;math&amp;gt;\sigma^2 = 10 (1/6)(5/6) = 1.38&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Poisson Distribution===&lt;br /&gt;
&lt;br /&gt;
The Poisson distribution is an approximation to the binomial distribution in the event that the probability of a success is quite small &amp;lt;math&amp;gt;(p \ll 1)&amp;lt;/math&amp;gt;.  As the number of repeated observations (n) gets large,  the  binomial distribution becomes more difficult to evaluate because of the leading term&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{n !}{ \left [ (n-x) ! x !\right ]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The poisson distribution overcomes this problem by defining the probability in terms of the average &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x) = \frac{\mu^x e^{-\mu}}{x!}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Poisson as approximation to Binomial====&lt;br /&gt;
&lt;br /&gt;
To drive home the idea that the Poisson distribution approximates a Binomial distribution at small p and large n consider the following derivation&lt;br /&gt;
&lt;br /&gt;
The Binomial Probability Distriubtions is&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_B(x) = \frac{n!}{x!(n-x)!}p^{x}q^{n-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \frac{n!}{(n-x)!} = \frac{(n-x)! (n-x+1) (n-x + 2) \dots (n-1)(n)}{(n-x)!}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= n (n-1)(n-2) \dots (n-x+2) (n-x+1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;IFF &amp;lt;math&amp;gt;x \ll n \Rightarrow&amp;lt;/math&amp;gt; we have x terms above&lt;br /&gt;
:then &amp;lt;math&amp;gt;\frac{n!}{(n-x)!} =n^x&amp;lt;/math&amp;gt;&lt;br /&gt;
:example:&amp;lt;math&amp;gt; \frac{100!}{(100-1)!} = \frac{99! \times 100}{99!} = 100^1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This leave us with &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) = \frac{n^x}{x!}p^{x}q^{n-x}= \frac{(np)^x}{x!}(1-p)^{n-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{(\mu)^x}{x!}(1-p)^{n}(1-p)^{-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;(1-p)^{-x} = \frac{1}{(1-p)^x} = 1+px = 1 : p \ll 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) = \frac{(\mu)^x}{x!}(1-p)^{n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;(1-p)^{n} = \left [(1-p)^{1/p} \right]^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\lim_{p \rightarrow 0} \left [(1-p)^{1/p} \right]^{\mu} = \left ( \frac{1}{e} \right)^{\mu} = e^{- \mu}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
;For  &amp;lt;math&amp;gt;x \ll n&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\lim_{p \rightarrow 0}P_B(x,n,p ) = P_P(x,\mu)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Derivation of Poisson Distribution====&lt;br /&gt;
&lt;br /&gt;
The mean free path of a particle traversing a volume of material is a common problem in nuclear and particle physics.  If you want to shield your apparatus or yourself from radiation you want to know how far the radiation travels through material.  &lt;br /&gt;
&lt;br /&gt;
The mean free path is the average distance a particle travels through a material before interacting with the material. &lt;br /&gt;
;If we let &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; represent the mean free path &lt;br /&gt;
;Then the probability of having an interaction after a distance x is&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{x}{\lambda}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as a result&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;1-\frac{x}{\lambda}= P(0,x, \lambda)&amp;lt;/math&amp;gt; = probability of getting no events after a length dx&lt;br /&gt;
&lt;br /&gt;
When we consider &amp;lt;math&amp;gt;\frac{x}{\lambda} \ll 1&amp;lt;/math&amp;gt; ( we are looking for small distances such that the probability of no interactions is high)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(0,x, \lambda) = e^{\frac{-x}{\lambda}} \approx 1 - \frac{x}{\lambda}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we wish to find the probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; events over a distance &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; given the mean free path.&lt;br /&gt;
&lt;br /&gt;
This is calculated as a joint probability.  If it were the case that we wanted to know the probability of only one interaction over a distance &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.  Then we would want to multiply the probability that an interaction happened after a distance &amp;lt;math&amp;gt;dx&amp;lt;/math&amp;gt; by the probability that no more interactions happen by the time the particle reaches the distance &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
For the case of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; interactions, we have a series of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; interactions happening over N intervals of &amp;lt;math&amp;gt;dx&amp;lt;/math&amp;gt; with the probability &amp;lt;math&amp;gt;dx/\lambda&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
:&amp;lt;math&amp;gt;P(N,x,\lambda)&amp;lt;/math&amp;gt; = probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; events within the length &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{dx_1}{\lambda}\frac{dx_2}{\lambda}\frac{dx_3}{\lambda} \dots \frac{dx_N}{\lambda} e^{\frac{-x}{\lambda}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above expression represents the probability for a particular sequence of events in which an interaction occurs after a distance &amp;lt;math&amp;gt;dx_1&amp;lt;/math&amp;gt; then a interaction after &amp;lt;math&amp;gt;dx_2&amp;lt;/math&amp;gt; , &amp;lt;math&amp;gt;\dots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So in essence the above expression is a &amp;quot;probability element&amp;quot; where another probability element may be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; P(N,x, \lambda)=\frac{dx_2}{\lambda}\frac{dx_1}{\lambda}\frac{dx_3}{\lambda} \dots \frac{dx_N}{\lambda} e^{\frac{-x}{\lambda}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where the first interaction occurs after the distance &amp;lt;math&amp;gt;x_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= \Pi_{i=1}^{N} \left [ \frac{dx_i}{\lambda} \right ] e^{\frac{-x}{\lambda}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So we can write a differential probability element which we need to add up as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;d^NP(N,x, \lambda)=\frac{1}{N!} \Pi_{i=1}^{N} \left [ \frac{dx_i}{\lambda} \right ] e^{\frac{-x}{\lambda}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The N! accounts for the degeneracy in which for every N! permutations there is really only one new combination.  ie we are double counting when we integrate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using the integral formula&lt;br /&gt;
: &amp;lt;math&amp;gt; \Pi_{i=1}^{N} \left [\int_0^x \frac{dx_i}{\lambda} \right ]= \left [ \frac{x}{\lambda}\right]^N&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
we end up with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(N,x, \lambda) = \frac{\left [ \frac{x}{\lambda}\right]^N}{N!} e^{\frac{-x}{\lambda}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Mean of Poisson Dist====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = \sum_{i=1}^{\infty} i P(i,x, \lambda)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_{i=1}^{\infty} i \frac{\left [ \frac{x}{\lambda}\right]^i}{i!} e^{\frac{-x}{\lambda}}&lt;br /&gt;
= \frac{x}{\lambda} \sum_{i=1}^{\infty}  \frac{\left [ \frac{x}{\lambda}\right]^{(i-1)}}{(i-1)!} e^{\frac{-x}{\lambda}} = \frac{x}{\lambda} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x,\mu) = \frac{\mu^x e^{-\mu}}{x!} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Variance of Poisson Dist====&lt;br /&gt;
&lt;br /&gt;
For [http://wiki.iac.isu.edu/index.php/TF_ErrAna_Homework#Poisson_Prob_Dist Homework] you will show, in a manner similar to the above mean calculation, that the variance of the Poisson distribution is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Gaussian===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Gaussian (Normal) distribution is an approximation of the Binomial distribution for the case of a large number of possible different observations.  Poisson approximated the binomial distribution for the case when p&amp;lt;&amp;lt;1 ( the average number of successes is a lot smaller than the number of trials &amp;lt;math&amp;gt;(\mu = np)&amp;lt;/math&amp;gt; ).&lt;br /&gt;
&lt;br /&gt;
The Gaussian distribution is accepted as one of the most likely distributions to describe measurements.&lt;br /&gt;
&lt;br /&gt;
A Gaussian distribution which is normalized such that its integral is unity is refered to as the Normal distribution.  You could mathematically construct a Gaussian distribution which is not normalized to unity (this is often done when fitting experimental data).&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_G(x,\mu, \sigma) = \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{1}{2} \left( \frac{x -\mu}{\sigma} \right) ^2}&amp;lt;/math&amp;gt; = probability of observing &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; from a Gaussian parent distribution with a mean &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; and standard deviation &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Half-Width &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; (a.k.a. Full Width as Half Max)====&lt;br /&gt;
&lt;br /&gt;
The half width &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is used to describe the range of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; through which the distributions amplitude decreases to half of its maximum value.&lt;br /&gt;
&lt;br /&gt;
;ie: &amp;lt;math&amp;gt;P_G(\mu \pm \frac{\Gamma}{2}, \mu, \sigma) = \frac{P_G(\mu,\mu,\sigma)}{2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Side note:the point of steepest descent is located at &amp;lt;math&amp;gt;x \pm \sigma&amp;lt;/math&amp;gt;  such that &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;math&amp;gt;P_G(\mu \pm \sigma, \mu, \sigma) = e^{1/2} P_G(\mu,\mu,\sigma)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Probable Error (P.E.)====&lt;br /&gt;
&lt;br /&gt;
The probable error is the range of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; in which half of the observations (values of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;) are expected to fall.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;math&amp;gt;x= \mu \pm P.E.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Binomial with Large N becomes Gaussian====&lt;br /&gt;
&lt;br /&gt;
Consider the binomial distribution in which a fair coin is tossed a large number of times (N is very large and an EVEN number N=2n)&lt;br /&gt;
&lt;br /&gt;
What is the probability you get exactly &amp;lt;math&amp;gt;\frac{1}{2}N -s&amp;lt;/math&amp;gt; heads and &amp;lt;math&amp;gt;\frac{1}{2}N +s&amp;lt;/math&amp;gt; tails where s is an integer?&lt;br /&gt;
&lt;br /&gt;
The Binomial Probability distribution is given as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_B(x) = {N\choose x}p^{x}q^{N-x}  = \frac{N!}{x!(N-x)!}p^{x}q^{N-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
p = probability of success= 1/2&lt;br /&gt;
&lt;br /&gt;
q= 1-p = 1/2&lt;br /&gt;
&lt;br /&gt;
N = number of trials =2n&lt;br /&gt;
&lt;br /&gt;
x= number of successes=n-s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_B(n-s)   = \frac{2n!}{(n-s)!(2n-n+s)!}p^{n-s}q^{2n-n+s}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{2n!}{(n-s)!(n+s)!}p^{n-s}q^{n+s}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{2n!}{(n-s)!(n+s)!} \left(\frac{1}{2}\right)^{n-s} \left(\frac{1}{2}\right)^{n+s}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{2n!}{(n-s)!(n+s)!} \left(\frac{1}{2}\right)^{2n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now let's cast this probability with respect to the probability that we get an even number of heads and tails by defining the following ratio R such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;R \equiv \frac{P_B(n-s)}{P_B(n)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_B(x=n) = \frac{N!}{n!(N-n)!}p^{n}q^{N-n} = \frac{(2n)!}{n!(n)!}p^{n}q^{n} =  \frac{(2n)!}{(n)!(n)!} \left(\frac{1}{2}\right)^{2n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;R = \frac{\frac{2n!}{(n-s)!(n+s)!} \left(\frac{1}{2}\right)^{2n}}{\frac{(2n)!}{(n)!(n)!} \left(\frac{1}{2}\right)^{2n}} = \frac{n! n!}{(n-s)! (n+s)!}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take the natural logarithm of both sides&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \ln (R) = \ln \left ( \frac{n! n!}{(n-s)! (n+s)!} \right) = \ln(n!)+\ln(n!) - \ln\left[(n-s)!\right ] - \ln \left[(n+s)!\right] = 2 \ln(n!) - \ln\left [ (n-s)! \right ] - \ln \left [ (n+s)! \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stirling's Approximation says&lt;br /&gt;
:&amp;lt;math&amp;gt;n! \sim \left (2 \pi n\right)^{1/2} n^n e^{-n}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow &amp;lt;/math&amp;gt;&lt;br /&gt;
;&amp;lt;math&amp;gt;\ln(n!) \sim  \ln \left [ \left (2 \pi n\right)^{1/2} n^n e^{-n}\right ] = \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ n^{1/2} \right  ] +\ln\left [ n^n \right ] + \ln \left [e^{-n}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ n^{1/2} \right  ] +n\ln\left [ n \right ] + (-n)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ n^{1/2} \right  ] +n(\ln\left [ n \right ] -1 )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
similarly&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\ln\left [(n-s)! \right ] \sim   \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ (n-1)^{1/2} \right  ] + (n-s)(\ln\left [ (n-s) \right ] -1 )&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\ln\left [(n+s)! \right ] \sim   \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ (n+1)^{1/2} \right  ] + (n+s)(\ln\left [ (n+s) \right ] -1 )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \ln (R) = 2 \times  \left (\ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ n^{1/2} \right  ] +n(\ln\left [ n \right ] -1 ) \right ) &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;- \left ( \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ (n-1)^{1/2} \right  ] + (n-s)(\ln\left [ (n-s) \right ] -1 )\right )&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt; -\left ( \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ (n+1)^{1/2} \right  ] + (n+s)(\ln\left [ (n+s) \right ] -1 )\right ) &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2 \ln  \left [ n^{1/2} \right  ] +2 n(\ln\left [ n \right ] -1 )  - \ln  \left [ (n-1)^{1/2} \right  ] - (n-s)(\ln\left [ (n-s) \right ] -1 ) -\ln  \left [ (n+1)^{1/2} \right  ] - (n+s)(\ln\left [ (n+s) \right ] -1 )&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\ln  \left [ n^{1/2} \right  ] = \ln  \left [ (n-1)^{1/2} \right  ]  = \ln  \left [ (n+1)^{1/2} \right  ]&amp;lt;/math&amp;gt; For Large n&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \ln (R) =  2 n(\ln\left [ n \right ] -1 )   - (n-s)(\ln\left [ (n-s) \right ] -1 ) - (n+s)(\ln\left [ (n+s) \right ] -1 )&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; =2 n(\ln\left [ n \right ] -1 )   - (n-s)(\ln\left [ n(1-s/n) \right ] -1 ) - (n+s)(\ln\left [ n(1+s/n) \right ] -1 )&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2n \ln (n) - 2n - (n-s) \left [ \ln (n) + \ln (1-s/n) -1\right ] - (n+s) \left [ \ln (n) + \ln (1+s/n) -1\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  - 2n - (n-s) \left [  \ln (1-s/n) -1\right ] - (n+s) \left [  \ln (1+s/n) -1\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=   - (n-s) \left [  \ln (1-s/n) \right ] - (n+s) \left [  \ln (1+s/n) \right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;-1 &amp;lt; s/n \le 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\ln (1+s/n) = s/n - \frac{s^2}{2n^2} + \frac{s^3}{3 n^3} \dots&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\ln(R) =- (n-s) \left [    -s/n - \frac{s^2}{2n^2} - \frac{s^3}{3 n^3} \right ] - (n+s) \left [   s/n - \frac{s^2}{2n^2} + \frac{s^3}{3 n^3}  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= - \frac{s^2}{n} = - \frac{2s^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;R \sim e^{-2s^2/N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as a result &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(n-s) = R P_B(n)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P_B(x=n)=  \frac{(2n)!}{(n)!(n)!} \left(\frac{1}{2}\right)^{2n} =  \frac{(\left ( \left (2 \pi 2n\right)^{1/2} (2n)^{2n} e^{-2n}\right ) }{\left(\left (2 \pi n\right)^{1/2} n^n e^{-n}\right ) \left ( \left (2 \pi n\right)^{1/2} n^n e^{-n}\right)}  \left(\frac{1}{2}\right)^{2n}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \left(\frac{1}{\pi n} \right )^{1/2} = \left(\frac{2}{\pi N} \right )^{1/2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(n-s) = \left(\frac{2}{\pi N} \right )^{1/2} e^{-2s^2/N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In binomial distributions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma^2 = Npq = \frac{N}{4}&amp;lt;/math&amp;gt; for this problem&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;N = 4 \sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(n-s) = \left(\frac{2}{\pi 4 \sigma^2} \right )^{1/2} e^{-2s^2/N} = \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{2s^2}{4 \sigma^2}}  = \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{1}{2} \left( \frac{s}{\sigma} \right) ^2}&amp;lt;/math&amp;gt; &lt;br /&gt;
= probability of exactly &amp;lt;math&amp;gt;(\frac{N}{2} -s)&amp;lt;/math&amp;gt; heads AND &amp;lt;math&amp;gt;(\frac{N}{2} +s)&amp;lt;/math&amp;gt; tails after flipping the coin N times (N is and even number and s is an integer).&lt;br /&gt;
&lt;br /&gt;
If we let &amp;lt;math&amp;gt;x = n-s&amp;lt;/math&amp;gt;  and realize that  for a binomial distributions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = Np = N/2 = n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(x) = \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{1}{2} \left( \frac{n-x}{\sigma} \right) ^2} = \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{1}{2} \left( \frac{x - \mu}{\sigma} \right) ^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; So when N gets big the Gaussian distribution is a good approximation to the Binomianl&lt;br /&gt;
&lt;br /&gt;
==== Gaussian approximation to Poisson when &amp;lt;math&amp;gt;\mu \gg 1&amp;lt;/math&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(r) = \frac{\mu^r e^{-\mu}}{r!}&amp;lt;/math&amp;gt; = Poisson probability distribution&lt;br /&gt;
&lt;br /&gt;
substitute&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x \equiv r - \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x + \mu) = \frac{\mu^{x + \mu} e^{-\mu}}{(x+\mu)!} = e^{-\mu} \frac{\mu^{\mu} \mu^x}{(\mu + x)!} = e^{-\mu} \mu^{\mu}\frac{\mu^x}{(\mu)! (\mu+1) \dots (\mu+x)}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; =  e^{-\mu} \frac{\mu^{\mu}}{\mu!} \left [ \frac{\mu}{(\mu+1)} \cdot  \frac{\mu}{(\mu+2)}  \dots \frac{\mu}{(\mu+x)}  \right ] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;e^{-\mu} \frac{\mu^{\mu}}{\mu!}  = e^{-\mu} \frac{\mu^{\mu}}{\sqrt{2 \pi \mu} \mu^{\mu}e^{-\mu}}=  \frac{1}{\sqrt{2 \pi \mu}}&amp;lt;/math&amp;gt; '''Stirling's Approximation when &amp;lt;math&amp;gt;\mu \gg 1&amp;lt;/math&amp;gt;''' &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x + \mu) =  \frac{1}{\sqrt{2 \pi \mu}} \left [ \frac{\mu}{(\mu+1)} \cdot  \frac{\mu}{(\mu+2)}  \dots \frac{\mu}{(\mu+x)}  \right ] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left [ \frac{\mu}{(\mu+1)} \cdot\frac{\mu}{(\mu+2)}  \dots \frac{\mu}{(\mu+x)}  \right ]  = \frac{1}{1 + \frac{1}{\mu}} \cdot  \frac{1}{1 + \frac{2}{\mu}} \dots  \frac{1}{1 + \frac{x}{\mu}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;e^{x/\mu} \approx 1 + \frac{x}{\mu}&amp;lt;/math&amp;gt;  : if &amp;lt;math&amp;gt;x/\mu \ll 1&amp;lt;/math&amp;gt;  Note:&amp;lt;math&amp;gt;x \equiv r - \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x + \mu) =  \frac{1}{\sqrt{2 \pi \mu}} \left [  \frac{1}{1 + \frac{1}{\mu}} \cdot  \frac{1}{1 + \frac{2}{\mu}} \dots  \frac{1}{1 + \frac{x}{\mu}} \right ]  = \frac{1}{\sqrt{2 \pi \mu}} \left [  e^{-1/\mu} \times e^{-2/\mu} \cdots e^{-x/\mu}  \right ] = \frac{1}{\sqrt{2 \pi \mu}} e^{-1 \left[ \frac{1}{\mu} +\frac{2}{\mu} \cdots \frac{x}{\mu}  \right ]}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{1}{\sqrt{2 \pi \mu}} e^{\frac{-1}{\mu} \left[ \sum_1^x i \right ]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
another mathematical identity&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_{i=1}^{x} i = \frac{x}{2}(1+x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x + \mu) =  \frac{1}{\sqrt{2 \pi \mu}} e^{\frac{-1}{\mu} \left[ \frac{x}{2}(1+x) \right ]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if&amp;lt;math&amp;gt; x \gg 1&amp;lt;/math&amp;gt; then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{x}{2}(1+x) \approx \frac{x^2}{2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x + \mu) =  \frac{1}{\sqrt{2 \pi \mu}} e^{\frac{-1}{\mu} \left[ \frac{x^2}{2} \right ]} = \frac{1}{\sqrt{2 \pi \mu}} e^{\frac{-x^2}{2\mu} }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the Poisson distribution &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
replacing dummy variable x with r - &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(r) =  \frac{1}{\sqrt{2 \pi \sigma^2}} e^{\frac{-(r - \mu)^2}{2\sigma^2} } =\frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{1}{2} \left( \frac{r -\mu}{\sigma} \right) ^2}&amp;lt;/math&amp;gt; = Gaussian distribution when &amp;lt;math&amp;gt;\mu \gg 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Integral Probability (Cumulative Distribution Function)====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Poisson and Binomial distributions are discrete probability distributions (integers).&lt;br /&gt;
&lt;br /&gt;
The Gaussian distribution is our first continuous distribution as the variables are real numbers.  It is not very meaningful to speak of the probability that the variate (x) assumes a specific value.  &lt;br /&gt;
&lt;br /&gt;
One could consider defining a  probability element &amp;lt;math&amp;gt;A_G&amp;lt;/math&amp;gt; which is really an integral over a finite region &amp;lt;math&amp;gt;\Delta x&amp;lt;/math&amp;gt; such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;A_G(\Delta x, \mu, \sigma) = \frac{1}{\sigma \sqrt{2 \pi}} \int_{\mu - \Delta x}^{\mu + \Delta x} e^{- \frac{1}{2} \left ( \frac{x - \mu}{\sigma}\right )^2} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantage of this definition becomes apparent when you are interesting in quantifying the probability that a measurement would fall outside a range &amp;lt;math&amp;gt;\Delta x&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P_G( x - \Delta x &amp;gt; x &amp;gt; x + \Delta x) = 1 - A_G(\Delta x, \mu, \sigma)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Cumulative Distribution Function (CDF), however, is defined in terms of the integral from the variates min value&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;CDF \equiv \int_{x_{min}}^{x} P_G( x, \mu, \sigma) = \int_{-\infty}^{x} P_G( x, \mu, \sigma) =  P_G(X \le x) =&amp;lt;/math&amp;gt; Probability that you measure a value less than or equal to &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== discrete CDF example =====&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The probability that a student fails this class is 7.3%.&lt;br /&gt;
&lt;br /&gt;
What is the probability more than 5 student will fail in a class of 32 students?&lt;br /&gt;
&lt;br /&gt;
Answ:  &amp;lt;math&amp;gt;P_B(x\ge 5) = \sum_{x=5}^{32} P_B(x) = CDF( x \ge 5) = 1- \sum_{x=0}^4 P_B(x) = 1 - CDF(x&amp;lt;5) &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= 1 - P_B(x=0)- P_B(x=1)- P_B(x=2)- P_B(x=3)- P_B(x=4)&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= 1 - 0.088 - 0.223 - 0.272 - 0.214 - 0.122 = 0.92 \Rightarrow P_B(x \ge 5) = 0.08&amp;lt;/math&amp;gt;= 8%&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is an 8% probability that 5 or more student will fail the class&lt;br /&gt;
&lt;br /&gt;
===== 2 SD rule of thumb for Gaussian PDF =====&lt;br /&gt;
&lt;br /&gt;
In the above example you calculated the probability that more than 5 student will fail a class.  You can extend this principle to calculate the probability of taking a measurement which exceeds the expected mean value.  &lt;br /&gt;
&lt;br /&gt;
One of the more common consistency checks you can make on a sample data set which you expect to be from a Gaussian distribution is to ask how many data points appear more than 2 S.D. (&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;) from the mean value.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CDF for this is&lt;br /&gt;
: &amp;lt;math&amp;gt;P_G(X \le \mu - 2 \sigma, \mu , \sigma ) = \int_{-\infty}^{\mu - 2\sigma} P_G(x, \mu, \sigma) dx&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{1}{\sigma \sqrt{2 \pi}} \int_{-\infty}^{\mu - 2\sigma} e^{- \frac{1}{2} \left ( \frac{x - \mu}{\sigma}\right )^2} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;z = \frac{x-2}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;dz = \frac{dx}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\Rightarrow P_G(X \le \mu - 2 \sigma, \mu , \sigma ) =  \frac{1}{ \sqrt{2 \pi}} \int_{-\infty}^{\mu - 2\sigma} e^{- \frac{z^2}{2} } dz&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above integral can only be done numerically by expanding the exponential in a power series&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;e^x = \sum_{n=0}^{\infty} \frac{x^n}{n!}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow e^{-x} = 1 -x + \frac{x^2}{2!} - \frac{x^3}{3!} \cdots&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow e^{-z^2/2} = 1 -\frac{z^2}{2}+ \frac{z^4}{8} - \frac{z^6}{48} \cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P_G(X \le \mu - 2 \sigma, \mu , \sigma ) =  \frac{1}{ \sqrt{2 \pi}} \int_{-\infty}^{\mu - 2\sigma}  \left ( 1 -\frac{z^2}{2}+ \frac{z^4}{8} - \frac{z^6}{48} \cdots \right)dz&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \left . \frac{1}{ \sqrt{2 \pi}} \left ( z  -\frac{z^3}{6}+ \frac{z^5}{40} - \frac{z^7}{48 \times 7} \cdots   \right ) \right |_{-\infty}^{\mu - 2\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=\left .  \frac{1}{\pi} \sum_{j=0}^{\infty} \frac{(-1)^j \left (\frac{x}{\sqrt{2}} \right)^{2j+1}}{j! (2j+1)} \right |_{x=\mu - 2\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No analytical for the probability but one which you can compute.&lt;br /&gt;
&lt;br /&gt;
Below is a table representing the cumulative probability &amp;lt;math&amp;gt;P_G(x&amp;lt; \mu - \delta \mbox{ and }  x&amp;gt; \mu + \delta , \mu, \sigma)&amp;lt;/math&amp;gt; for events to occur outside and interval of &amp;lt;math&amp;gt;\pm \delta&amp;lt;/math&amp;gt; in a Gaussian distribution&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;  |cellpadding=&amp;quot;20&amp;quot; cellspacing=&amp;quot;0 &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;P_G(x&amp;lt; \mu - \delta \mbox{ and } x&amp;gt; \mu + \delta , \mu, \sigma)&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;3.2 \times 10^{-1}&amp;lt;/math&amp;gt; ||1&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;4.4 \times 10^{-2}&amp;lt;/math&amp;gt; ||2&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;2.7 \times 10^{-3}&amp;lt;/math&amp;gt; ||3&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;6.3 \times 10^{-5}&amp;lt;/math&amp;gt; ||4&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:TF_Error_CDF_Gauss.png| 400 px]]&lt;br /&gt;
&lt;br /&gt;
===Cauchy/Lorentzian/Breit-Wigner Distribution===&lt;br /&gt;
In Mathematics, the Cauchy distribution is written as&lt;br /&gt;
:&amp;lt;math&amp;gt;P_{CL}(x, x_0, \Gamma) = \frac{1}{\pi} \frac{\Gamma/2}{(x -x_0)^2 + (\Gamma/2)^2}&amp;lt;/math&amp;gt; = Cauchy-Lorentian Distribution&lt;br /&gt;
&lt;br /&gt;
:Note; The probability does not fall as rapidly to zero as the Gaussian.  As a result, the Gaussian's central peak contributes more to the area than the Lorentzian's.&lt;br /&gt;
&lt;br /&gt;
This distribution happens to be a solution to physics problems involving forced resonances (spring systems driven by a source, or a nuclear interaction which induces a metastable state).&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_{BW} = \sigma(E)=  \frac{1}{2\pi}\frac{\Gamma}{(E-E_0)^2 + (\Gamma/2)^2}&amp;lt;/math&amp;gt; = Breit-Wigner distribution&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;E_0 =&amp;lt;/math&amp;gt; mass resonance&lt;br /&gt;
:&amp;lt;math&amp;gt;\Gamma = &amp;lt;/math&amp;gt;FWHM&lt;br /&gt;
: &amp;lt;math&amp;gt;\Delta E \Delta t = \Gamma \tau = \frac{h}{2 \pi}&amp;lt;/math&amp;gt; = uncertainty principle&lt;br /&gt;
:&amp;lt;math&amp;gt;\tau=&amp;lt;/math&amp;gt;lifetime of resonance/intermediate state particle&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A Beit-Wigner function fit to cross section measured as a function of energy will allow one to evaluate the rate increases that are produced when the probing energy excites a resonant state that has a mass &amp;lt;math&amp;gt;E_0&amp;lt;/math&amp;gt; and lasts for the time &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; derived from the Half Width &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== mean====&lt;br /&gt;
&lt;br /&gt;
Mean is not defined&lt;br /&gt;
&lt;br /&gt;
Mode = Median = &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;E_0&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==== Variance ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The variance is also not defined but rather the distribution is parameterized in terms of the Half Width &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;z = \frac{x-\mu}{\Gamma/2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \frac{\Gamma^2}{4\pi} \int_{-\infty}^{\infty} \frac{z^2}{1+z^2} dz&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above integral does not converge for large deviations &amp;lt;math&amp;gt;(x -\mu)&amp;lt;/math&amp;gt; .  The width of the distribution is instead characterized by &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; = FWHM&lt;br /&gt;
&lt;br /&gt;
===Landau===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_L(x) = \frac{1}{2 \pi i} \int_{c-i\infty}^{c+i\infty}\! e^{s \log s + x s}\, ds &amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt; is any positive real number.&lt;br /&gt;
&lt;br /&gt;
To simplify computation it is more convenient to use the equivalent expression&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_L(x) = \frac{1}{\pi} \int_0^\infty\! e^{-t \log t - x t} \sin(\pi t)\, dt.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above distribution was derived by Landau (L. Landau, &amp;quot;On the Energy Loss of Fast Particles by Ionization&amp;quot;, J. Phys., vol 8 (1944), pg 201 ) to describe the energy loss by particles traveling through thin material ( materials with a thickness on the order of a few radiation lengths).&lt;br /&gt;
&lt;br /&gt;
Bethe-Bloch derived an expression to determine the AVERAGE amount of energy lost by a particle traversing a given material &amp;lt;math&amp;gt;(\frac{dE}{dx})&amp;lt;/math&amp;gt; assuming several collisions which span the physical limits of the interaction.&lt;br /&gt;
&lt;br /&gt;
For the case a thin absorbers, the number of collisions is so small that the central limit theorem used to average over several collision doesn't apply and there is a finite possibility of observing large energy losses.&lt;br /&gt;
&lt;br /&gt;
As a result one would expect a distribution which is Gaussian like but with a &amp;quot;tail&amp;quot; on the &amp;lt;math&amp;gt;\mu + \sigma&amp;lt;/math&amp;gt; side of the distribution.&lt;br /&gt;
&lt;br /&gt;
===Gamma===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P_{\gamma}(x,k,\theta) = x^{k-1} \frac{e^{-x/\theta}}{\theta^k \, \Gamma(k)}\text{ for } x &amp;gt; 0\text{ and }k, \theta &amp;gt; 0.\,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt; \Gamma(z) = \int_0^\infty  t^{z-1} e^{-t}\,dt\;&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The distribution is used for &amp;quot;waiting time&amp;quot; models.  How long do you need to wait for a rain storm, how long do you need to wait to die,...&lt;br /&gt;
&lt;br /&gt;
Climatologists use this for predicting how rain fluctuates from season to season.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;k =&amp;lt;/math&amp;gt; integer then the above distribution is a sum of &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; independent exponential distributions&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P_{\gamma}(x,k,\theta) = 1 - e^{-x/\theta} \sum_{j=0}^{k-1}\frac{1}{j!}\left ( \frac{x}{\theta}\right)^j &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Mean====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = k \theta&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Variance====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = k \theta^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Properties====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\lim_{X \rightarrow \infty} P_{\gamma}(x,k,\theta) = \left \{  {\infty \;\;\;\; k &amp;lt;1 \atop 0 \;\;\;\; k&amp;gt;1} \right .&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{1}{\theta} \;\; \mbox{if} k=1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Beta===&lt;br /&gt;
:&amp;lt;math&amp;gt; P_{\beta}(x;\alpha,\beta) = \frac{x^{\alpha-1}(1-x)^{\beta-1}}{\int_0^1 u^{\alpha-1} (1-u)^{\beta-1}\, du} \!&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;= \frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)}\, x^{\alpha-1}(1-x)^{\beta-1}\!&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;= \frac{1}{\mathrm{B}(\alpha,\beta)}\, x&lt;br /&gt;
^{\alpha-1}(1-x)^{\beta-1}\!&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Mean====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = \frac{\alpha}{\alpha + \beta}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variance====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \frac{\alpha \beta }{(\alpha + \beta)^2 (\alpha + \beta + 1)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exponential===&lt;br /&gt;
&lt;br /&gt;
The exponential distribution may be used to describe the processes that are in between Binomial and Poisson (exponential decay)&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P_{e}(x,\lambda) = \left \{  {\lambda e^{-\lambda x} \;\;\;\; x \ge 0\atop 0 \;\;\;\; x&amp;lt;0} \right .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; CDF_{e}(x,\lambda) = \left \{  {\lambda 1-e^{-\lambda x} \;\;\;\; x \ge 0\atop 0 \;\;\;\; x&amp;lt;0} \right .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Mean====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = \frac{1}{\lambda}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variance ====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma = \frac{1}{\lambda^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Skewness and Kurtosis==&lt;br /&gt;
&lt;br /&gt;
Distributions may also be characterized by how they look in terms of Skewness and Kurtosis&lt;br /&gt;
&lt;br /&gt;
=== Skewness===&lt;br /&gt;
&lt;br /&gt;
Measures the symmetry of the distribution&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Skewness = &amp;lt;math&amp;gt;\frac{\sum (x_i - \bar{x})^3}{(N-1)s^3} = \frac{\mbox{3rd moment}}{\mbox{2nd moment}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
:&amp;lt;math&amp;gt;s^2 = \frac{\sum (x_i - \bar{x})^2}{N-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;The higher the number the more asymmetric (or skewed) the distribution is.  The closer to zero the more symmetric.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A negative skewness indicates a tail on the left side of the distribution.&lt;br /&gt;
Positive skewness indicates a tail on the right.&lt;br /&gt;
&lt;br /&gt;
===Kurtosis===&lt;br /&gt;
&lt;br /&gt;
Measures the &amp;quot;pointyness&amp;quot; of the distribution&lt;br /&gt;
&lt;br /&gt;
Kurtosis = &amp;lt;math&amp;gt;\frac{\sum (x_i - \bar{x})^4}{(N-1)s^4}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
:&amp;lt;math&amp;gt;s^2 = \frac{\sum (x_i - \bar{x})^2}{N-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
K=3 for Normal Distribution&lt;br /&gt;
&lt;br /&gt;
In ROOT the Kurtosis entry in the statistics box is really the &amp;quot;excess kurtosis&amp;quot; which is the subtraction of the kurtosis by 3&lt;br /&gt;
&lt;br /&gt;
Excess Kurtosis = &amp;lt;math&amp;gt;\frac{\sum (x_i - \bar{x})^4}{(N-1)s^4} - 3&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case a Positive excess Kurtosis will  indicate a peak that is sharper than a gaussian while a negative value will indicate a peak that is flatter than a comparable Gaussian distribution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:ForeErrAna_Gaus-Cauchy_SkeKurt.gif|200 px]][[File:ForeErrAna_Gaus-Landau_SkeKurt.gif|200 px]][[File:ForeErrAna_Gaus-gamma_SkeKurt.gif|200 px]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences] [[Forest_Error_Analysis_for_the_Physical_Sciences]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_PropOfErr&amp;diff=91448</id>
		<title>TF ErrorAna PropOfErr</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_PropOfErr&amp;diff=91448"/>
		<updated>2014-02-28T20:45:09Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Example: Table Area */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Taylor Expansion=&lt;br /&gt;
&lt;br /&gt;
A quantity which is calculated using  quantities with known uncertainties will have an uncertainty based upon the uncertainty of the quantities used in the calculation.&lt;br /&gt;
&lt;br /&gt;
To determine the uncertainty in a quantity which is a function of other quantities, you can consider the dependence of these quantities in terms of a tayler expansion&lt;br /&gt;
&lt;br /&gt;
The Taylor series expansion of a function f(x) about the point a is given as &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x) = f(a) + \left . f^{\prime}(x)\right |_{x=a} \frac{x-a}{1!} + \left . f^{\prime \prime}(x)\right |_{x=a} \frac{(x-a)^2}{2!} + ...&amp;lt;/math&amp;gt;&lt;br /&gt;
;&amp;lt;math&amp;gt;= \left . \sum_{n=0}^{\infty} f^{(n)}(x)\right |_{x=a} \frac{(x-a)^n}{n!}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For small values of x (x &amp;lt;&amp;lt; 1) we can expand the function about 0 such that&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt{1+x} = \left . \sqrt{1-0} \frac{1}{2}(1+x)^{-1/2}\right |_{x=0} \frac{x^1}{1!}+ \left . \frac{1}{2}\frac{-1}{2}(1+x)^{-3/2} \right |_{x=0} \frac{x^2}{2!}&amp;lt;/math&amp;gt;&lt;br /&gt;
;&amp;lt;math&amp;gt;=1 + \frac{x}{2} - \frac{x^2}{8}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The taylor expansion of a function with two variables&amp;lt;math&amp;gt; (x_1 , x_2)&amp;lt;/math&amp;gt; about the average of the two variables&amp;lt;math&amp;gt; (\bar {x_1} , \bar{x_2} )&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x, y)=f(\bar {x}, \bar{x})+(x-\bar {x}) \frac{\partial f}{\partial x}\bigg |_{(x = \bar {x}, y = \bar{y})} +(y-\bar{y}) \frac{\partial f}{\partial y}\bigg |_{(x = \bar {x}, y = \bar{x})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x, y)-f(\bar {x}, \bar{y})=(x-\bar {x}) \frac{\partial f}{\partial x}\bigg |_{(x = \bar {x}, y = \bar{y})} +(y-\bar{y}) \frac{\partial f}{\partial y}\bigg |_{(x = \bar {x}, y = \bar{y})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The average &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f(\bar {x}, \bar{y}) \equiv \frac{\sum f(x,y)_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta f = f(x, y)-f(\bar {x}, \bar{y})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
represents a small fluctuation &amp;lt;math&amp;gt;(\delta f)&amp;lt;/math&amp;gt; of the function &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; from its average &amp;lt;math&amp;gt;f(\bar {x}, \bar{y})&amp;lt;/math&amp;gt; if we ignore higher order terms in the Taylor expansion ( this means the fluctuations are small)then we can write the variance using the definition as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \frac{\sum \left [ f(x,y)_i - f(\bar {x}, \bar{y})\right ]^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\sum \left [(x_i-\bar {x}) \frac{\partial f}{\partial x}+(y_i-\bar{y}) \frac{\partial f}{\partial y}\right ]^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum (x_i-\bar {x})^2 \left ( \frac{\partial f}{\partial x}\right )^2}{N} + \frac{\sum (y_i-\bar {y})^2 \left ( \frac{\partial f}{\partial y}\right )^2}{N} + 2 \frac{\sum (x_i-\bar {x}) \left ( \frac{\partial f}{\partial x} \right ) (y_i-\bar {y}) \left ( \frac{\partial f}{\partial y}\right )}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \sigma_x^2 \left ( \frac{\partial f}{\partial x}\right )^2 + \sigma_y^2\left ( \frac{\partial f}{\partial y}\right )^2 + 2 \sigma_{x,y}^2 \left ( \frac{\partial f}{\partial x} \right )  \left ( \frac{\partial f}{\partial y}\right ) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{x,y}^2 = \frac{\sum (x_i-\bar {x}) (y_i-\bar {y}) }{N} \equiv&amp;lt;/math&amp;gt; Covariance&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above can be reproduced for functions with multiple variables.&lt;br /&gt;
&lt;br /&gt;
=Instrumental and Statistical Uncertainties=&lt;br /&gt;
&lt;br /&gt;
http://www.physics.uoguelph.ca/~reception/2440/StatsErrorsJuly26-06.pdf&lt;br /&gt;
==Counting Experiment Example==&lt;br /&gt;
&lt;br /&gt;
The table below reports 8 measurements of the coincidence rate observed by two scintillators detecting cosmic rays.  The scintillator are place a distance (x) away from each other in order to detect cosmic rays falling on the earth's surface.  The time and observed coincidence counts are reported in separate columns as well as the angle made by the normal to the detector with the earths surface.  &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;5&amp;quot;&lt;br /&gt;
! Date || Time (hrs) ||  &amp;lt;math&amp;gt;\theta&amp;lt;/math&amp;gt; ||Coincidence Counts || Mean Coinc/Hr  || &amp;lt;math&amp;gt;\sigma_{Poisson} = \sqrt{\mbox{Mean Counts/Hr}}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;\left | \sigma \right |&amp;lt;/math&amp;gt; from Mean&lt;br /&gt;
|-&lt;br /&gt;
|9/12/07 || 20.5 || 30|| 2233 || 109 || 10.4 ||1&lt;br /&gt;
|-&lt;br /&gt;
|9/14/07 || 21 || 30 || 1582 || 75 || 8.7||2&lt;br /&gt;
|-&lt;br /&gt;
|10/3/07 || 21 || 30 || 2282 || 100 || 10.4||1&lt;br /&gt;
|-&lt;br /&gt;
|10/4/07 || 21 || 30 || 2029 || 97 ||  9.8|| 0.1&lt;br /&gt;
|-&lt;br /&gt;
|10/15/07 || 21 || 30 || 2180 || 100 ||  10|| 0.6&lt;br /&gt;
|-&lt;br /&gt;
|10/18/07 || 21 ||  30 || 2064 || 99 || 9.9||0.1&lt;br /&gt;
|-&lt;br /&gt;
| 10/23/07 || 21 || 30 || 2003 || 95 || 9.8||0.2&lt;br /&gt;
|-&lt;br /&gt;
| 10/26/07 || 21 || 30 || 1943 || 93 || 9.6 || 0.5&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The average count rate for a given trial is given in the 5th column by diving column 4 by column 2.  &lt;br /&gt;
&lt;br /&gt;
One can expect a Poisson parent distribution because the probability of a cosmic ray interacting with the scintillator is low.  The variance of measurement in each trial is related to the counting rate by &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 = \mu =&amp;lt;/math&amp;gt; average counting rate&lt;br /&gt;
&lt;br /&gt;
as a result of the assumption that the parent distribution is Poisson.  The value of this &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is shown in column 6.&lt;br /&gt;
&lt;br /&gt;
; Is the Poisson distribution the parent distribution in this experiment?&lt;br /&gt;
&lt;br /&gt;
To try and answer the above question lets determine the mean and variance of the data:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{x} =\frac{\sum CPM_i}{8} = 96.44&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;s = \sqrt{\frac{\sum (x_i-\mu)^2}{8-1}} = 10.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you approximate the Poisson distribution by a Gaussian then the probability any one measurement is within 1 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; of the mean is  68% = Probability that  a measurement of a Gaussian variant will lie within 1 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; of the mean.  For the Poisson distribution with a mean of 97 you would have 66% of the data occur within 1 &amp;lt;math&amp;gt;\sigma = \sqrt{97}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root [26] ROOT::Math::poisson_cdf(97-sqrt(97),97)&lt;br /&gt;
(double)1.67580969302001004e-01&lt;br /&gt;
root [30] 1-2*ROOT::Math::poisson_cdf(97-sqrt(97),97)        &lt;br /&gt;
(const double)6.64838061395997992e-01&lt;br /&gt;
&lt;br /&gt;
root [28] ROOT::Math::normal_cdf(97-sqrt(97),sqrt(97),97)&lt;br /&gt;
(double)1.58655253931457185e-01&lt;br /&gt;
root [29] 1-2*ROOT::Math::normal_cdf(97-sqrt(97),sqrt(97),97)&lt;br /&gt;
(const double)6.82689492137085630e-01&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 7th column above identifies how many sigma the mean of that trial is from the average &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= 0.68 * 8 = 5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Looks like we have 7/8  events within 1&amp;lt;math&amp;gt; \sigma&amp;lt;/math&amp;gt; = 87.5%  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
How about the average sigma assuming poisson?&lt;br /&gt;
&lt;br /&gt;
If you take the average of sigma estimate in column 6 you would get&lt;br /&gt;
:&amp;lt;math&amp;gt;\overline{\sigma(Poisson)} = \frac{\sum \sigma_i(Poisson)}{8} = 9.86&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this one can calculate the variance of the variance as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum \left ( \sigma_i(Poisson) - \overline{\sigma(Poisson)}\right)^2}{8-1} = (0.56)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
comparing the &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; from the 8 trials to the &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; from the Poisson estimate you have&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;10.9 = 9.9 \pm 0.56&amp;lt;/math&amp;gt; In agreement within 2 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What is really required however is an estimate of the probability that the assumption of a Poisson distribution is correct (Hypothesis test).  This will be the subject of future sections.&lt;br /&gt;
&lt;br /&gt;
=== Error Propagation===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f = \bar{x} = \frac{\sum x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial f}{\partial x_i} = \frac{1}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\delta f = \frac{\partial f}{\partial x_1}\sigma_{x_1} + \frac{\partial f}{\partial x_2}\sigma_{x_2} + \cdots \frac{\partial f}{\partial x_n}\sigma_{x_n}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} + \frac{\partial f}{\partial x_2}\sigma_{x_2} + \cdots \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} \right )^2 +  \left ( \frac{\partial f}{\partial x_2}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2 +   2 \left ( \frac{\partial^2 f}{\partial x_1\partial x_2} \right) \sigma_{x_1}\sigma_{x_2}  + \cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial^2 f}{\partial x_i\partial x_j} = \frac{\partial }{\partial x_j} \frac{1}{N} = 0 \Rightarrow&amp;lt;/math&amp;gt; no Covariances&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} \right )^2 +  \left ( \frac{\partial f}{\partial x_2}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt; = \left ( \frac{1}{N} \sigma_{x_1} \right )^2 +  \left ( \frac{1}{N}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{1}{N}\sigma_{x_n} \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_i = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{1}{N} \sigma \right )^2 +  \left ( \frac{1}{N}\sigma \right )^2 + \cdots   \left ( \frac{1}{N}\sigma \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=\frac{ \sigma^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Does this mean that we get an infinitely precise measurement if &amp;lt;math&amp;gt;N \rightarrow \infty&amp;lt;/math&amp;gt;?&lt;br /&gt;
: No!  In reality there are systematic errors in every experiment so the best you can do is reduce your statistical precision to a point where the systematic errors dominate.  There is also the observation that in practice it is difficult to find an experiment absent of  &amp;quot;non-statistical fluctuations&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Example: Table Area=&lt;br /&gt;
&lt;br /&gt;
A quantity which is calculated using  quantities with known uncertainties will have an uncertainty based upon the uncertainty of the quantities used in the calculation.&lt;br /&gt;
&lt;br /&gt;
To determine the uncertainty in a quantity which is a function of other quantities, you can consider the dependence of these quantities in terms of a Tayler expansion&lt;br /&gt;
&lt;br /&gt;
Consider a calculation of a Table's Area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A= L \times W&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mean that the Area (A) is a function of the Length (L) and the Width (W) of the table.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A = f(L,W)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can write the variance of the area&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2_A = \frac{\sum_{i=1}^{i=N} (A_i - \bar{A})^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{ \sum_{i=1}^{i=N} \left [ (L-\bar{L})  \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} + (W-\bar W) \frac{\partial A}{\partial W} \bigg |_{\bar L \bar W} \right] ^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L})  \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} \right ] ^2}{N} + \frac{\sum_{i=1}^{i=N} \left [ (W-\bar W) \frac{\partial A}{\partial W} \bigg |_{\bar L \bar W} \right] ^2  }{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;+2  \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L}) (W-\bar W) \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} \frac{\partial A}{\partial W} \bigg |_{\bar L \bar W} \right]^2}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sigma^2_L \left ( \frac{\partial A}{\partial L} \right )^2 +\sigma^2_W \left ( \frac{\partial A}{\partial W} \right )^2 + 2 \sigma^2_{LW} \frac{\partial A}{\partial L}  \frac{\partial A}{\partial W} &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma^2_{LW} = \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L}) (W-\bar W) \right ]^2}{N}&amp;lt;/math&amp;gt; is defined as the '''Covariance''' between &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;W&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Weighted Mean and variance =&lt;br /&gt;
&lt;br /&gt;
The variance &amp;lt;math&amp;gt;(\sigma)&amp;lt;/math&amp;gt; in the above examples was assumed to be the same for all measurement from the parent distribution.&lt;br /&gt;
&lt;br /&gt;
What happens when you wish to combine measurements with unequal variances (different experiments measuring the same quantity)?&lt;br /&gt;
&lt;br /&gt;
== Weighted Mean==&lt;br /&gt;
&lt;br /&gt;
Let's assume we have a measured quantity having a mean &amp;lt;math&amp;gt; X&amp;lt;/math&amp;gt;   from a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you attempt to measure X with several different experiments you will likely have a series of results which vary in their precision.&lt;br /&gt;
&lt;br /&gt;
Lets assume you have 2 experiments which obtained the averages &amp;lt;math&amp;gt;X_A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;X_B&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we assume that each measurement is governed by a Gaussian distribution,&lt;br /&gt;
&lt;br /&gt;
Then the probability of one experiment observing the value X_A is given by&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_A) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_A-X}{\sigma_A}\right )^2}}{\sigma_A}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
similarly the probability of the other experiment observing the average X_B is &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_B) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_B-X}{\sigma_B}\right )^2}}{\sigma_B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the combined probability that the first experiment measures the average &amp;lt;math&amp;gt;X_A&amp;lt;/math&amp;gt; and the second &amp;lt;math&amp;gt;X_B&amp;lt;/math&amp;gt; is given as the product of the two probabilities suth that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_A,X_B) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_A-X}{\sigma_A}\right )^2}}{\sigma_A} \frac{e^{-\frac{1}{2} \left ( \frac{X_B-X}{\sigma_B}\right )^2}}{\sigma_B} = \frac{e^{-\frac{1}{2}\left [  \left ( \frac{X_A-x}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2\right ]}}{\sigma_A \sigma_B}\equiv \frac{e^{-\frac{1}{2}\left [  \chi^2\right ]}}{\sigma_A \sigma_B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \chi^2 \equiv \left ( \frac{X_A-X}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;The principle of maximum likelihood (to be the cornerstone of hypothesis testing) may be written as&lt;br /&gt;
:The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observing is a maximum.&lt;br /&gt;
&lt;br /&gt;
Applying this principle to the two experiments means that the best estimate of &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; is made when &amp;lt;math&amp;gt;P(x=X_A,X_B)&amp;lt;/math&amp;gt; is a maximum which occurs when &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \chi^2 \equiv \left ( \frac{X_A-X}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2 = &amp;lt;/math&amp;gt;Minimum&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial X} =2 \left ( \frac{X_A-X}{\sigma_A^2}\right )(-1)+2 \left ( \frac{X_B-X}{\sigma_B^2}\right )(-1)= 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow X = \frac{\frac{X_A}{\sigma_A^2} + \frac{X_B}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If each observable (&amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;)  is accompanied by an estimate of the uncertainty in that observable (&amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt;) then the weighted mean is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{x} = \frac{ \sum_{i=1}^{i=n} \frac{x_i}{\sigma_i^2}}{\sum_{i=1}^{i=n} \frac{1}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Weighted Variance==&lt;br /&gt;
&lt;br /&gt;
To determine the variance of the measurements you should follow the Taylor series based prescription denoted above in that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \sum \sigma_i^2 \left ( \frac{\partial X}{\partial X_i}\right)^2 = \sigma_A^2\left ( \frac{\partial X}{\partial X_A}\right)^2 + \sigma_B^2\left ( \frac{\partial X}{\partial X_B}\right)^2&amp;lt;/math&amp;gt; : Assuming no covariance&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial X}{\partial X_A} = \frac{\partial}{\partial X_A}  \frac{\frac{X_A}{\sigma_A^2} + \frac{X_B}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} = \frac{\frac{1}{\sigma_A^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 =\sigma_A^2 \left ( \frac{\frac{1}{\sigma_A^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} \right)^2 + \sigma_B^2 \left ( \frac{\frac{1}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} \right)^2&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\frac{1}{\sigma_A^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}  + \frac{\frac{1}{\sigma_B^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{1}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variance of the distribution is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{1}{\sigma^2} = \sum_{i=1}^{i=n} \frac{1}{\sigma_i^2}&amp;lt;/math&amp;gt; = weighted variance&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences] [[Forest_Error_Analysis_for_the_Physical_Sciences]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_PropOfErr&amp;diff=91447</id>
		<title>TF ErrorAna PropOfErr</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_PropOfErr&amp;diff=91447"/>
		<updated>2014-02-28T20:44:25Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Example: Table Area */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Taylor Expansion=&lt;br /&gt;
&lt;br /&gt;
A quantity which is calculated using  quantities with known uncertainties will have an uncertainty based upon the uncertainty of the quantities used in the calculation.&lt;br /&gt;
&lt;br /&gt;
To determine the uncertainty in a quantity which is a function of other quantities, you can consider the dependence of these quantities in terms of a tayler expansion&lt;br /&gt;
&lt;br /&gt;
The Taylor series expansion of a function f(x) about the point a is given as &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x) = f(a) + \left . f^{\prime}(x)\right |_{x=a} \frac{x-a}{1!} + \left . f^{\prime \prime}(x)\right |_{x=a} \frac{(x-a)^2}{2!} + ...&amp;lt;/math&amp;gt;&lt;br /&gt;
;&amp;lt;math&amp;gt;= \left . \sum_{n=0}^{\infty} f^{(n)}(x)\right |_{x=a} \frac{(x-a)^n}{n!}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For small values of x (x &amp;lt;&amp;lt; 1) we can expand the function about 0 such that&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt{1+x} = \left . \sqrt{1-0} \frac{1}{2}(1+x)^{-1/2}\right |_{x=0} \frac{x^1}{1!}+ \left . \frac{1}{2}\frac{-1}{2}(1+x)^{-3/2} \right |_{x=0} \frac{x^2}{2!}&amp;lt;/math&amp;gt;&lt;br /&gt;
;&amp;lt;math&amp;gt;=1 + \frac{x}{2} - \frac{x^2}{8}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The taylor expansion of a function with two variables&amp;lt;math&amp;gt; (x_1 , x_2)&amp;lt;/math&amp;gt; about the average of the two variables&amp;lt;math&amp;gt; (\bar {x_1} , \bar{x_2} )&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x, y)=f(\bar {x}, \bar{x})+(x-\bar {x}) \frac{\partial f}{\partial x}\bigg |_{(x = \bar {x}, y = \bar{y})} +(y-\bar{y}) \frac{\partial f}{\partial y}\bigg |_{(x = \bar {x}, y = \bar{x})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x, y)-f(\bar {x}, \bar{y})=(x-\bar {x}) \frac{\partial f}{\partial x}\bigg |_{(x = \bar {x}, y = \bar{y})} +(y-\bar{y}) \frac{\partial f}{\partial y}\bigg |_{(x = \bar {x}, y = \bar{y})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The average &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f(\bar {x}, \bar{y}) \equiv \frac{\sum f(x,y)_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta f = f(x, y)-f(\bar {x}, \bar{y})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
represents a small fluctuation &amp;lt;math&amp;gt;(\delta f)&amp;lt;/math&amp;gt; of the function &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; from its average &amp;lt;math&amp;gt;f(\bar {x}, \bar{y})&amp;lt;/math&amp;gt; if we ignore higher order terms in the Taylor expansion ( this means the fluctuations are small)then we can write the variance using the definition as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \frac{\sum \left [ f(x,y)_i - f(\bar {x}, \bar{y})\right ]^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\sum \left [(x_i-\bar {x}) \frac{\partial f}{\partial x}+(y_i-\bar{y}) \frac{\partial f}{\partial y}\right ]^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum (x_i-\bar {x})^2 \left ( \frac{\partial f}{\partial x}\right )^2}{N} + \frac{\sum (y_i-\bar {y})^2 \left ( \frac{\partial f}{\partial y}\right )^2}{N} + 2 \frac{\sum (x_i-\bar {x}) \left ( \frac{\partial f}{\partial x} \right ) (y_i-\bar {y}) \left ( \frac{\partial f}{\partial y}\right )}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \sigma_x^2 \left ( \frac{\partial f}{\partial x}\right )^2 + \sigma_y^2\left ( \frac{\partial f}{\partial y}\right )^2 + 2 \sigma_{x,y}^2 \left ( \frac{\partial f}{\partial x} \right )  \left ( \frac{\partial f}{\partial y}\right ) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{x,y}^2 = \frac{\sum (x_i-\bar {x}) (y_i-\bar {y}) }{N} \equiv&amp;lt;/math&amp;gt; Covariance&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above can be reproduced for functions with multiple variables.&lt;br /&gt;
&lt;br /&gt;
=Instrumental and Statistical Uncertainties=&lt;br /&gt;
&lt;br /&gt;
http://www.physics.uoguelph.ca/~reception/2440/StatsErrorsJuly26-06.pdf&lt;br /&gt;
==Counting Experiment Example==&lt;br /&gt;
&lt;br /&gt;
The table below reports 8 measurements of the coincidence rate observed by two scintillators detecting cosmic rays.  The scintillator are place a distance (x) away from each other in order to detect cosmic rays falling on the earth's surface.  The time and observed coincidence counts are reported in separate columns as well as the angle made by the normal to the detector with the earths surface.  &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;5&amp;quot;&lt;br /&gt;
! Date || Time (hrs) ||  &amp;lt;math&amp;gt;\theta&amp;lt;/math&amp;gt; ||Coincidence Counts || Mean Coinc/Hr  || &amp;lt;math&amp;gt;\sigma_{Poisson} = \sqrt{\mbox{Mean Counts/Hr}}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;\left | \sigma \right |&amp;lt;/math&amp;gt; from Mean&lt;br /&gt;
|-&lt;br /&gt;
|9/12/07 || 20.5 || 30|| 2233 || 109 || 10.4 ||1&lt;br /&gt;
|-&lt;br /&gt;
|9/14/07 || 21 || 30 || 1582 || 75 || 8.7||2&lt;br /&gt;
|-&lt;br /&gt;
|10/3/07 || 21 || 30 || 2282 || 100 || 10.4||1&lt;br /&gt;
|-&lt;br /&gt;
|10/4/07 || 21 || 30 || 2029 || 97 ||  9.8|| 0.1&lt;br /&gt;
|-&lt;br /&gt;
|10/15/07 || 21 || 30 || 2180 || 100 ||  10|| 0.6&lt;br /&gt;
|-&lt;br /&gt;
|10/18/07 || 21 ||  30 || 2064 || 99 || 9.9||0.1&lt;br /&gt;
|-&lt;br /&gt;
| 10/23/07 || 21 || 30 || 2003 || 95 || 9.8||0.2&lt;br /&gt;
|-&lt;br /&gt;
| 10/26/07 || 21 || 30 || 1943 || 93 || 9.6 || 0.5&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The average count rate for a given trial is given in the 5th column by diving column 4 by column 2.  &lt;br /&gt;
&lt;br /&gt;
One can expect a Poisson parent distribution because the probability of a cosmic ray interacting with the scintillator is low.  The variance of measurement in each trial is related to the counting rate by &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 = \mu =&amp;lt;/math&amp;gt; average counting rate&lt;br /&gt;
&lt;br /&gt;
as a result of the assumption that the parent distribution is Poisson.  The value of this &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is shown in column 6.&lt;br /&gt;
&lt;br /&gt;
; Is the Poisson distribution the parent distribution in this experiment?&lt;br /&gt;
&lt;br /&gt;
To try and answer the above question lets determine the mean and variance of the data:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{x} =\frac{\sum CPM_i}{8} = 96.44&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;s = \sqrt{\frac{\sum (x_i-\mu)^2}{8-1}} = 10.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you approximate the Poisson distribution by a Gaussian then the probability any one measurement is within 1 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; of the mean is  68% = Probability that  a measurement of a Gaussian variant will lie within 1 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; of the mean.  For the Poisson distribution with a mean of 97 you would have 66% of the data occur within 1 &amp;lt;math&amp;gt;\sigma = \sqrt{97}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root [26] ROOT::Math::poisson_cdf(97-sqrt(97),97)&lt;br /&gt;
(double)1.67580969302001004e-01&lt;br /&gt;
root [30] 1-2*ROOT::Math::poisson_cdf(97-sqrt(97),97)        &lt;br /&gt;
(const double)6.64838061395997992e-01&lt;br /&gt;
&lt;br /&gt;
root [28] ROOT::Math::normal_cdf(97-sqrt(97),sqrt(97),97)&lt;br /&gt;
(double)1.58655253931457185e-01&lt;br /&gt;
root [29] 1-2*ROOT::Math::normal_cdf(97-sqrt(97),sqrt(97),97)&lt;br /&gt;
(const double)6.82689492137085630e-01&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 7th column above identifies how many sigma the mean of that trial is from the average &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= 0.68 * 8 = 5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Looks like we have 7/8  events within 1&amp;lt;math&amp;gt; \sigma&amp;lt;/math&amp;gt; = 87.5%  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
How about the average sigma assuming poisson?&lt;br /&gt;
&lt;br /&gt;
If you take the average of sigma estimate in column 6 you would get&lt;br /&gt;
:&amp;lt;math&amp;gt;\overline{\sigma(Poisson)} = \frac{\sum \sigma_i(Poisson)}{8} = 9.86&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this one can calculate the variance of the variance as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum \left ( \sigma_i(Poisson) - \overline{\sigma(Poisson)}\right)^2}{8-1} = (0.56)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
comparing the &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; from the 8 trials to the &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; from the Poisson estimate you have&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;10.9 = 9.9 \pm 0.56&amp;lt;/math&amp;gt; In agreement within 2 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What is really required however is an estimate of the probability that the assumption of a Poisson distribution is correct (Hypothesis test).  This will be the subject of future sections.&lt;br /&gt;
&lt;br /&gt;
=== Error Propagation===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f = \bar{x} = \frac{\sum x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial f}{\partial x_i} = \frac{1}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\delta f = \frac{\partial f}{\partial x_1}\sigma_{x_1} + \frac{\partial f}{\partial x_2}\sigma_{x_2} + \cdots \frac{\partial f}{\partial x_n}\sigma_{x_n}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} + \frac{\partial f}{\partial x_2}\sigma_{x_2} + \cdots \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} \right )^2 +  \left ( \frac{\partial f}{\partial x_2}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2 +   2 \left ( \frac{\partial^2 f}{\partial x_1\partial x_2} \right) \sigma_{x_1}\sigma_{x_2}  + \cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial^2 f}{\partial x_i\partial x_j} = \frac{\partial }{\partial x_j} \frac{1}{N} = 0 \Rightarrow&amp;lt;/math&amp;gt; no Covariances&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} \right )^2 +  \left ( \frac{\partial f}{\partial x_2}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt; = \left ( \frac{1}{N} \sigma_{x_1} \right )^2 +  \left ( \frac{1}{N}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{1}{N}\sigma_{x_n} \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_i = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{1}{N} \sigma \right )^2 +  \left ( \frac{1}{N}\sigma \right )^2 + \cdots   \left ( \frac{1}{N}\sigma \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=\frac{ \sigma^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Does this mean that we get an infinitely precise measurement if &amp;lt;math&amp;gt;N \rightarrow \infty&amp;lt;/math&amp;gt;?&lt;br /&gt;
: No!  In reality there are systematic errors in every experiment so the best you can do is reduce your statistical precision to a point where the systematic errors dominate.  There is also the observation that in practice it is difficult to find an experiment absent of  &amp;quot;non-statistical fluctuations&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Example: Table Area=&lt;br /&gt;
&lt;br /&gt;
A quantity which is calculated using  quantities with known uncertainties will have an uncertainty based upon the uncertainty of the quantities used in the calculation.&lt;br /&gt;
&lt;br /&gt;
To determine the uncertainty in a quantity which is a function of other quantities, you can consider the dependence of these quantities in terms of a Tayler expansion&lt;br /&gt;
&lt;br /&gt;
Consider a calculation of a Table's Area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A= L \times W&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mean that the Area (A) is a function of the Length (L) and the Width (W) of the table.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A = f(L,W)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can write the variance of the area&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2_A = \frac{\sum_{i=1}^{i=N} (A_i - \bar{A})^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_{i=1}^{i=N}\frac{ \left [ (L-\bar{L})  \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} + (W-\bar W) \frac{\partial A}{\partial W} \bigg |_{\bar L \bar W} \right] ^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L})  \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} \right ] ^2}{N} + \frac{\sum_{i=1}^{i=N} \left [ (W-\bar W) \frac{\partial A}{\partial W} \bigg |_{\bar L \bar W} \right] ^2  }{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;+2  \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L}) (W-\bar W) \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} \frac{\partial A}{\partial W} \bigg |_{\bar L \bar W} \right]^2}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sigma^2_L \left ( \frac{\partial A}{\partial L} \right )^2 +\sigma^2_W \left ( \frac{\partial A}{\partial W} \right )^2 + 2 \sigma^2_{LW} \frac{\partial A}{\partial L}  \frac{\partial A}{\partial W} &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma^2_{LW} = \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L}) (W-\bar W) \right ]^2}{N}&amp;lt;/math&amp;gt; is defined as the '''Covariance''' between &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;W&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Weighted Mean and variance =&lt;br /&gt;
&lt;br /&gt;
The variance &amp;lt;math&amp;gt;(\sigma)&amp;lt;/math&amp;gt; in the above examples was assumed to be the same for all measurement from the parent distribution.&lt;br /&gt;
&lt;br /&gt;
What happens when you wish to combine measurements with unequal variances (different experiments measuring the same quantity)?&lt;br /&gt;
&lt;br /&gt;
== Weighted Mean==&lt;br /&gt;
&lt;br /&gt;
Let's assume we have a measured quantity having a mean &amp;lt;math&amp;gt; X&amp;lt;/math&amp;gt;   from a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you attempt to measure X with several different experiments you will likely have a series of results which vary in their precision.&lt;br /&gt;
&lt;br /&gt;
Lets assume you have 2 experiments which obtained the averages &amp;lt;math&amp;gt;X_A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;X_B&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we assume that each measurement is governed by a Gaussian distribution,&lt;br /&gt;
&lt;br /&gt;
Then the probability of one experiment observing the value X_A is given by&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_A) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_A-X}{\sigma_A}\right )^2}}{\sigma_A}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
similarly the probability of the other experiment observing the average X_B is &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_B) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_B-X}{\sigma_B}\right )^2}}{\sigma_B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the combined probability that the first experiment measures the average &amp;lt;math&amp;gt;X_A&amp;lt;/math&amp;gt; and the second &amp;lt;math&amp;gt;X_B&amp;lt;/math&amp;gt; is given as the product of the two probabilities suth that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_A,X_B) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_A-X}{\sigma_A}\right )^2}}{\sigma_A} \frac{e^{-\frac{1}{2} \left ( \frac{X_B-X}{\sigma_B}\right )^2}}{\sigma_B} = \frac{e^{-\frac{1}{2}\left [  \left ( \frac{X_A-x}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2\right ]}}{\sigma_A \sigma_B}\equiv \frac{e^{-\frac{1}{2}\left [  \chi^2\right ]}}{\sigma_A \sigma_B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \chi^2 \equiv \left ( \frac{X_A-X}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;The principle of maximum likelihood (to be the cornerstone of hypothesis testing) may be written as&lt;br /&gt;
:The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observing is a maximum.&lt;br /&gt;
&lt;br /&gt;
Applying this principle to the two experiments means that the best estimate of &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; is made when &amp;lt;math&amp;gt;P(x=X_A,X_B)&amp;lt;/math&amp;gt; is a maximum which occurs when &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \chi^2 \equiv \left ( \frac{X_A-X}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2 = &amp;lt;/math&amp;gt;Minimum&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial X} =2 \left ( \frac{X_A-X}{\sigma_A^2}\right )(-1)+2 \left ( \frac{X_B-X}{\sigma_B^2}\right )(-1)= 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow X = \frac{\frac{X_A}{\sigma_A^2} + \frac{X_B}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If each observable (&amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;)  is accompanied by an estimate of the uncertainty in that observable (&amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt;) then the weighted mean is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{x} = \frac{ \sum_{i=1}^{i=n} \frac{x_i}{\sigma_i^2}}{\sum_{i=1}^{i=n} \frac{1}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Weighted Variance==&lt;br /&gt;
&lt;br /&gt;
To determine the variance of the measurements you should follow the Taylor series based prescription denoted above in that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \sum \sigma_i^2 \left ( \frac{\partial X}{\partial X_i}\right)^2 = \sigma_A^2\left ( \frac{\partial X}{\partial X_A}\right)^2 + \sigma_B^2\left ( \frac{\partial X}{\partial X_B}\right)^2&amp;lt;/math&amp;gt; : Assuming no covariance&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial X}{\partial X_A} = \frac{\partial}{\partial X_A}  \frac{\frac{X_A}{\sigma_A^2} + \frac{X_B}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} = \frac{\frac{1}{\sigma_A^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 =\sigma_A^2 \left ( \frac{\frac{1}{\sigma_A^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} \right)^2 + \sigma_B^2 \left ( \frac{\frac{1}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} \right)^2&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\frac{1}{\sigma_A^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}  + \frac{\frac{1}{\sigma_B^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{1}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variance of the distribution is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{1}{\sigma^2} = \sum_{i=1}^{i=n} \frac{1}{\sigma_i^2}&amp;lt;/math&amp;gt; = weighted variance&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences] [[Forest_Error_Analysis_for_the_Physical_Sciences]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_PropOfErr&amp;diff=91446</id>
		<title>TF ErrorAna PropOfErr</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_PropOfErr&amp;diff=91446"/>
		<updated>2014-02-28T20:43:52Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Example: Table Area */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Taylor Expansion=&lt;br /&gt;
&lt;br /&gt;
A quantity which is calculated using  quantities with known uncertainties will have an uncertainty based upon the uncertainty of the quantities used in the calculation.&lt;br /&gt;
&lt;br /&gt;
To determine the uncertainty in a quantity which is a function of other quantities, you can consider the dependence of these quantities in terms of a tayler expansion&lt;br /&gt;
&lt;br /&gt;
The Taylor series expansion of a function f(x) about the point a is given as &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x) = f(a) + \left . f^{\prime}(x)\right |_{x=a} \frac{x-a}{1!} + \left . f^{\prime \prime}(x)\right |_{x=a} \frac{(x-a)^2}{2!} + ...&amp;lt;/math&amp;gt;&lt;br /&gt;
;&amp;lt;math&amp;gt;= \left . \sum_{n=0}^{\infty} f^{(n)}(x)\right |_{x=a} \frac{(x-a)^n}{n!}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For small values of x (x &amp;lt;&amp;lt; 1) we can expand the function about 0 such that&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt{1+x} = \left . \sqrt{1-0} \frac{1}{2}(1+x)^{-1/2}\right |_{x=0} \frac{x^1}{1!}+ \left . \frac{1}{2}\frac{-1}{2}(1+x)^{-3/2} \right |_{x=0} \frac{x^2}{2!}&amp;lt;/math&amp;gt;&lt;br /&gt;
;&amp;lt;math&amp;gt;=1 + \frac{x}{2} - \frac{x^2}{8}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The taylor expansion of a function with two variables&amp;lt;math&amp;gt; (x_1 , x_2)&amp;lt;/math&amp;gt; about the average of the two variables&amp;lt;math&amp;gt; (\bar {x_1} , \bar{x_2} )&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x, y)=f(\bar {x}, \bar{x})+(x-\bar {x}) \frac{\partial f}{\partial x}\bigg |_{(x = \bar {x}, y = \bar{y})} +(y-\bar{y}) \frac{\partial f}{\partial y}\bigg |_{(x = \bar {x}, y = \bar{x})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x, y)-f(\bar {x}, \bar{y})=(x-\bar {x}) \frac{\partial f}{\partial x}\bigg |_{(x = \bar {x}, y = \bar{y})} +(y-\bar{y}) \frac{\partial f}{\partial y}\bigg |_{(x = \bar {x}, y = \bar{y})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The average &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f(\bar {x}, \bar{y}) \equiv \frac{\sum f(x,y)_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta f = f(x, y)-f(\bar {x}, \bar{y})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
represents a small fluctuation &amp;lt;math&amp;gt;(\delta f)&amp;lt;/math&amp;gt; of the function &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; from its average &amp;lt;math&amp;gt;f(\bar {x}, \bar{y})&amp;lt;/math&amp;gt; if we ignore higher order terms in the Taylor expansion ( this means the fluctuations are small)then we can write the variance using the definition as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \frac{\sum \left [ f(x,y)_i - f(\bar {x}, \bar{y})\right ]^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\sum \left [(x_i-\bar {x}) \frac{\partial f}{\partial x}+(y_i-\bar{y}) \frac{\partial f}{\partial y}\right ]^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum (x_i-\bar {x})^2 \left ( \frac{\partial f}{\partial x}\right )^2}{N} + \frac{\sum (y_i-\bar {y})^2 \left ( \frac{\partial f}{\partial y}\right )^2}{N} + 2 \frac{\sum (x_i-\bar {x}) \left ( \frac{\partial f}{\partial x} \right ) (y_i-\bar {y}) \left ( \frac{\partial f}{\partial y}\right )}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \sigma_x^2 \left ( \frac{\partial f}{\partial x}\right )^2 + \sigma_y^2\left ( \frac{\partial f}{\partial y}\right )^2 + 2 \sigma_{x,y}^2 \left ( \frac{\partial f}{\partial x} \right )  \left ( \frac{\partial f}{\partial y}\right ) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{x,y}^2 = \frac{\sum (x_i-\bar {x}) (y_i-\bar {y}) }{N} \equiv&amp;lt;/math&amp;gt; Covariance&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above can be reproduced for functions with multiple variables.&lt;br /&gt;
&lt;br /&gt;
=Instrumental and Statistical Uncertainties=&lt;br /&gt;
&lt;br /&gt;
http://www.physics.uoguelph.ca/~reception/2440/StatsErrorsJuly26-06.pdf&lt;br /&gt;
==Counting Experiment Example==&lt;br /&gt;
&lt;br /&gt;
The table below reports 8 measurements of the coincidence rate observed by two scintillators detecting cosmic rays.  The scintillator are place a distance (x) away from each other in order to detect cosmic rays falling on the earth's surface.  The time and observed coincidence counts are reported in separate columns as well as the angle made by the normal to the detector with the earths surface.  &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;5&amp;quot;&lt;br /&gt;
! Date || Time (hrs) ||  &amp;lt;math&amp;gt;\theta&amp;lt;/math&amp;gt; ||Coincidence Counts || Mean Coinc/Hr  || &amp;lt;math&amp;gt;\sigma_{Poisson} = \sqrt{\mbox{Mean Counts/Hr}}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;\left | \sigma \right |&amp;lt;/math&amp;gt; from Mean&lt;br /&gt;
|-&lt;br /&gt;
|9/12/07 || 20.5 || 30|| 2233 || 109 || 10.4 ||1&lt;br /&gt;
|-&lt;br /&gt;
|9/14/07 || 21 || 30 || 1582 || 75 || 8.7||2&lt;br /&gt;
|-&lt;br /&gt;
|10/3/07 || 21 || 30 || 2282 || 100 || 10.4||1&lt;br /&gt;
|-&lt;br /&gt;
|10/4/07 || 21 || 30 || 2029 || 97 ||  9.8|| 0.1&lt;br /&gt;
|-&lt;br /&gt;
|10/15/07 || 21 || 30 || 2180 || 100 ||  10|| 0.6&lt;br /&gt;
|-&lt;br /&gt;
|10/18/07 || 21 ||  30 || 2064 || 99 || 9.9||0.1&lt;br /&gt;
|-&lt;br /&gt;
| 10/23/07 || 21 || 30 || 2003 || 95 || 9.8||0.2&lt;br /&gt;
|-&lt;br /&gt;
| 10/26/07 || 21 || 30 || 1943 || 93 || 9.6 || 0.5&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The average count rate for a given trial is given in the 5th column by diving column 4 by column 2.  &lt;br /&gt;
&lt;br /&gt;
One can expect a Poisson parent distribution because the probability of a cosmic ray interacting with the scintillator is low.  The variance of measurement in each trial is related to the counting rate by &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 = \mu =&amp;lt;/math&amp;gt; average counting rate&lt;br /&gt;
&lt;br /&gt;
as a result of the assumption that the parent distribution is Poisson.  The value of this &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is shown in column 6.&lt;br /&gt;
&lt;br /&gt;
; Is the Poisson distribution the parent distribution in this experiment?&lt;br /&gt;
&lt;br /&gt;
To try and answer the above question lets determine the mean and variance of the data:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{x} =\frac{\sum CPM_i}{8} = 96.44&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;s = \sqrt{\frac{\sum (x_i-\mu)^2}{8-1}} = 10.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you approximate the Poisson distribution by a Gaussian then the probability any one measurement is within 1 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; of the mean is  68% = Probability that  a measurement of a Gaussian variant will lie within 1 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; of the mean.  For the Poisson distribution with a mean of 97 you would have 66% of the data occur within 1 &amp;lt;math&amp;gt;\sigma = \sqrt{97}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root [26] ROOT::Math::poisson_cdf(97-sqrt(97),97)&lt;br /&gt;
(double)1.67580969302001004e-01&lt;br /&gt;
root [30] 1-2*ROOT::Math::poisson_cdf(97-sqrt(97),97)        &lt;br /&gt;
(const double)6.64838061395997992e-01&lt;br /&gt;
&lt;br /&gt;
root [28] ROOT::Math::normal_cdf(97-sqrt(97),sqrt(97),97)&lt;br /&gt;
(double)1.58655253931457185e-01&lt;br /&gt;
root [29] 1-2*ROOT::Math::normal_cdf(97-sqrt(97),sqrt(97),97)&lt;br /&gt;
(const double)6.82689492137085630e-01&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 7th column above identifies how many sigma the mean of that trial is from the average &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= 0.68 * 8 = 5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Looks like we have 7/8  events within 1&amp;lt;math&amp;gt; \sigma&amp;lt;/math&amp;gt; = 87.5%  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
How about the average sigma assuming poisson?&lt;br /&gt;
&lt;br /&gt;
If you take the average of sigma estimate in column 6 you would get&lt;br /&gt;
:&amp;lt;math&amp;gt;\overline{\sigma(Poisson)} = \frac{\sum \sigma_i(Poisson)}{8} = 9.86&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this one can calculate the variance of the variance as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum \left ( \sigma_i(Poisson) - \overline{\sigma(Poisson)}\right)^2}{8-1} = (0.56)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
comparing the &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; from the 8 trials to the &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; from the Poisson estimate you have&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;10.9 = 9.9 \pm 0.56&amp;lt;/math&amp;gt; In agreement within 2 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What is really required however is an estimate of the probability that the assumption of a Poisson distribution is correct (Hypothesis test).  This will be the subject of future sections.&lt;br /&gt;
&lt;br /&gt;
=== Error Propagation===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f = \bar{x} = \frac{\sum x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial f}{\partial x_i} = \frac{1}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\delta f = \frac{\partial f}{\partial x_1}\sigma_{x_1} + \frac{\partial f}{\partial x_2}\sigma_{x_2} + \cdots \frac{\partial f}{\partial x_n}\sigma_{x_n}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} + \frac{\partial f}{\partial x_2}\sigma_{x_2} + \cdots \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} \right )^2 +  \left ( \frac{\partial f}{\partial x_2}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2 +   2 \left ( \frac{\partial^2 f}{\partial x_1\partial x_2} \right) \sigma_{x_1}\sigma_{x_2}  + \cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial^2 f}{\partial x_i\partial x_j} = \frac{\partial }{\partial x_j} \frac{1}{N} = 0 \Rightarrow&amp;lt;/math&amp;gt; no Covariances&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} \right )^2 +  \left ( \frac{\partial f}{\partial x_2}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt; = \left ( \frac{1}{N} \sigma_{x_1} \right )^2 +  \left ( \frac{1}{N}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{1}{N}\sigma_{x_n} \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_i = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{1}{N} \sigma \right )^2 +  \left ( \frac{1}{N}\sigma \right )^2 + \cdots   \left ( \frac{1}{N}\sigma \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=\frac{ \sigma^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Does this mean that we get an infinitely precise measurement if &amp;lt;math&amp;gt;N \rightarrow \infty&amp;lt;/math&amp;gt;?&lt;br /&gt;
: No!  In reality there are systematic errors in every experiment so the best you can do is reduce your statistical precision to a point where the systematic errors dominate.  There is also the observation that in practice it is difficult to find an experiment absent of  &amp;quot;non-statistical fluctuations&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Example: Table Area=&lt;br /&gt;
&lt;br /&gt;
A quantity which is calculated using  quantities with known uncertainties will have an uncertainty based upon the uncertainty of the quantities used in the calculation.&lt;br /&gt;
&lt;br /&gt;
To determine the uncertainty in a quantity which is a function of other quantities, you can consider the dependence of these quantities in terms of a tayler expansion&lt;br /&gt;
&lt;br /&gt;
Consider a calculation of a Table's Area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A= L \times W&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mean that the Area (A) is a function of the Length (L) and the Width (W) of the table.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A = f(L,W)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can write the variance of the area&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2_A = \frac{\sum_{i=1}^{i=N} (A_i - \bar{A})^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sum_{i=1}^{i=N}\frac{ \left [ (L-\bar{L})  \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} + (W-\bar W) \frac{\partial A}{\partial W} \bigg |_{\bar L \bar W} \right] ^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L})  \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} \right ] ^2}{N} + \frac{\sum_{i=1}^{i=N} \left [ (W-\bar W) \frac{\partial A}{\partial W} \bigg |_{\bar L \bar W} \right] ^2  }{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;+2  \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L}) (W-\bar W) \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} \frac{\partial A}{\partial W} \bigg |_{\bar L \bar W} \right]^2}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sigma^2_L \left ( \frac{\partial A}{\partial L} \right )^2 +\sigma^2_W \left ( \frac{\partial A}{\partial W} \right )^2 + 2 \sigma^2_{LW} \frac{\partial A}{\partial L}  \frac{\partial A}{\partial W} &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma^2_{LW} = \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L}) (W-\bar W) \right ]^2}{N}&amp;lt;/math&amp;gt; is defined as the '''Covariance''' between &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;W&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Weighted Mean and variance =&lt;br /&gt;
&lt;br /&gt;
The variance &amp;lt;math&amp;gt;(\sigma)&amp;lt;/math&amp;gt; in the above examples was assumed to be the same for all measurement from the parent distribution.&lt;br /&gt;
&lt;br /&gt;
What happens when you wish to combine measurements with unequal variances (different experiments measuring the same quantity)?&lt;br /&gt;
&lt;br /&gt;
== Weighted Mean==&lt;br /&gt;
&lt;br /&gt;
Let's assume we have a measured quantity having a mean &amp;lt;math&amp;gt; X&amp;lt;/math&amp;gt;   from a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you attempt to measure X with several different experiments you will likely have a series of results which vary in their precision.&lt;br /&gt;
&lt;br /&gt;
Lets assume you have 2 experiments which obtained the averages &amp;lt;math&amp;gt;X_A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;X_B&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we assume that each measurement is governed by a Gaussian distribution,&lt;br /&gt;
&lt;br /&gt;
Then the probability of one experiment observing the value X_A is given by&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_A) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_A-X}{\sigma_A}\right )^2}}{\sigma_A}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
similarly the probability of the other experiment observing the average X_B is &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_B) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_B-X}{\sigma_B}\right )^2}}{\sigma_B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the combined probability that the first experiment measures the average &amp;lt;math&amp;gt;X_A&amp;lt;/math&amp;gt; and the second &amp;lt;math&amp;gt;X_B&amp;lt;/math&amp;gt; is given as the product of the two probabilities suth that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_A,X_B) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_A-X}{\sigma_A}\right )^2}}{\sigma_A} \frac{e^{-\frac{1}{2} \left ( \frac{X_B-X}{\sigma_B}\right )^2}}{\sigma_B} = \frac{e^{-\frac{1}{2}\left [  \left ( \frac{X_A-x}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2\right ]}}{\sigma_A \sigma_B}\equiv \frac{e^{-\frac{1}{2}\left [  \chi^2\right ]}}{\sigma_A \sigma_B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \chi^2 \equiv \left ( \frac{X_A-X}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;The principle of maximum likelihood (to be the cornerstone of hypothesis testing) may be written as&lt;br /&gt;
:The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observing is a maximum.&lt;br /&gt;
&lt;br /&gt;
Applying this principle to the two experiments means that the best estimate of &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; is made when &amp;lt;math&amp;gt;P(x=X_A,X_B)&amp;lt;/math&amp;gt; is a maximum which occurs when &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \chi^2 \equiv \left ( \frac{X_A-X}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2 = &amp;lt;/math&amp;gt;Minimum&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial X} =2 \left ( \frac{X_A-X}{\sigma_A^2}\right )(-1)+2 \left ( \frac{X_B-X}{\sigma_B^2}\right )(-1)= 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow X = \frac{\frac{X_A}{\sigma_A^2} + \frac{X_B}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If each observable (&amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;)  is accompanied by an estimate of the uncertainty in that observable (&amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt;) then the weighted mean is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{x} = \frac{ \sum_{i=1}^{i=n} \frac{x_i}{\sigma_i^2}}{\sum_{i=1}^{i=n} \frac{1}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Weighted Variance==&lt;br /&gt;
&lt;br /&gt;
To determine the variance of the measurements you should follow the Taylor series based prescription denoted above in that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \sum \sigma_i^2 \left ( \frac{\partial X}{\partial X_i}\right)^2 = \sigma_A^2\left ( \frac{\partial X}{\partial X_A}\right)^2 + \sigma_B^2\left ( \frac{\partial X}{\partial X_B}\right)^2&amp;lt;/math&amp;gt; : Assuming no covariance&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial X}{\partial X_A} = \frac{\partial}{\partial X_A}  \frac{\frac{X_A}{\sigma_A^2} + \frac{X_B}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} = \frac{\frac{1}{\sigma_A^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 =\sigma_A^2 \left ( \frac{\frac{1}{\sigma_A^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} \right)^2 + \sigma_B^2 \left ( \frac{\frac{1}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} \right)^2&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\frac{1}{\sigma_A^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}  + \frac{\frac{1}{\sigma_B^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{1}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variance of the distribution is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{1}{\sigma^2} = \sum_{i=1}^{i=n} \frac{1}{\sigma_i^2}&amp;lt;/math&amp;gt; = weighted variance&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences] [[Forest_Error_Analysis_for_the_Physical_Sciences]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_PropOfErr&amp;diff=91445</id>
		<title>TF ErrorAna PropOfErr</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_PropOfErr&amp;diff=91445"/>
		<updated>2014-02-28T20:15:42Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Taylor Expansion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Taylor Expansion=&lt;br /&gt;
&lt;br /&gt;
A quantity which is calculated using  quantities with known uncertainties will have an uncertainty based upon the uncertainty of the quantities used in the calculation.&lt;br /&gt;
&lt;br /&gt;
To determine the uncertainty in a quantity which is a function of other quantities, you can consider the dependence of these quantities in terms of a tayler expansion&lt;br /&gt;
&lt;br /&gt;
The Taylor series expansion of a function f(x) about the point a is given as &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x) = f(a) + \left . f^{\prime}(x)\right |_{x=a} \frac{x-a}{1!} + \left . f^{\prime \prime}(x)\right |_{x=a} \frac{(x-a)^2}{2!} + ...&amp;lt;/math&amp;gt;&lt;br /&gt;
;&amp;lt;math&amp;gt;= \left . \sum_{n=0}^{\infty} f^{(n)}(x)\right |_{x=a} \frac{(x-a)^n}{n!}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For small values of x (x &amp;lt;&amp;lt; 1) we can expand the function about 0 such that&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt{1+x} = \left . \sqrt{1-0} \frac{1}{2}(1+x)^{-1/2}\right |_{x=0} \frac{x^1}{1!}+ \left . \frac{1}{2}\frac{-1}{2}(1+x)^{-3/2} \right |_{x=0} \frac{x^2}{2!}&amp;lt;/math&amp;gt;&lt;br /&gt;
;&amp;lt;math&amp;gt;=1 + \frac{x}{2} - \frac{x^2}{8}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The taylor expansion of a function with two variables&amp;lt;math&amp;gt; (x_1 , x_2)&amp;lt;/math&amp;gt; about the average of the two variables&amp;lt;math&amp;gt; (\bar {x_1} , \bar{x_2} )&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x, y)=f(\bar {x}, \bar{x})+(x-\bar {x}) \frac{\partial f}{\partial x}\bigg |_{(x = \bar {x}, y = \bar{y})} +(y-\bar{y}) \frac{\partial f}{\partial y}\bigg |_{(x = \bar {x}, y = \bar{x})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x, y)-f(\bar {x}, \bar{y})=(x-\bar {x}) \frac{\partial f}{\partial x}\bigg |_{(x = \bar {x}, y = \bar{y})} +(y-\bar{y}) \frac{\partial f}{\partial y}\bigg |_{(x = \bar {x}, y = \bar{y})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The average &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f(\bar {x}, \bar{y}) \equiv \frac{\sum f(x,y)_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta f = f(x, y)-f(\bar {x}, \bar{y})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
represents a small fluctuation &amp;lt;math&amp;gt;(\delta f)&amp;lt;/math&amp;gt; of the function &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; from its average &amp;lt;math&amp;gt;f(\bar {x}, \bar{y})&amp;lt;/math&amp;gt; if we ignore higher order terms in the Taylor expansion ( this means the fluctuations are small)then we can write the variance using the definition as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \frac{\sum \left [ f(x,y)_i - f(\bar {x}, \bar{y})\right ]^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\sum \left [(x_i-\bar {x}) \frac{\partial f}{\partial x}+(y_i-\bar{y}) \frac{\partial f}{\partial y}\right ]^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum (x_i-\bar {x})^2 \left ( \frac{\partial f}{\partial x}\right )^2}{N} + \frac{\sum (y_i-\bar {y})^2 \left ( \frac{\partial f}{\partial y}\right )^2}{N} + 2 \frac{\sum (x_i-\bar {x}) \left ( \frac{\partial f}{\partial x} \right ) (y_i-\bar {y}) \left ( \frac{\partial f}{\partial y}\right )}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \sigma_x^2 \left ( \frac{\partial f}{\partial x}\right )^2 + \sigma_y^2\left ( \frac{\partial f}{\partial y}\right )^2 + 2 \sigma_{x,y}^2 \left ( \frac{\partial f}{\partial x} \right )  \left ( \frac{\partial f}{\partial y}\right ) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{x,y}^2 = \frac{\sum (x_i-\bar {x}) (y_i-\bar {y}) }{N} \equiv&amp;lt;/math&amp;gt; Covariance&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above can be reproduced for functions with multiple variables.&lt;br /&gt;
&lt;br /&gt;
=Instrumental and Statistical Uncertainties=&lt;br /&gt;
&lt;br /&gt;
http://www.physics.uoguelph.ca/~reception/2440/StatsErrorsJuly26-06.pdf&lt;br /&gt;
==Counting Experiment Example==&lt;br /&gt;
&lt;br /&gt;
The table below reports 8 measurements of the coincidence rate observed by two scintillators detecting cosmic rays.  The scintillator are place a distance (x) away from each other in order to detect cosmic rays falling on the earth's surface.  The time and observed coincidence counts are reported in separate columns as well as the angle made by the normal to the detector with the earths surface.  &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;5&amp;quot;&lt;br /&gt;
! Date || Time (hrs) ||  &amp;lt;math&amp;gt;\theta&amp;lt;/math&amp;gt; ||Coincidence Counts || Mean Coinc/Hr  || &amp;lt;math&amp;gt;\sigma_{Poisson} = \sqrt{\mbox{Mean Counts/Hr}}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;\left | \sigma \right |&amp;lt;/math&amp;gt; from Mean&lt;br /&gt;
|-&lt;br /&gt;
|9/12/07 || 20.5 || 30|| 2233 || 109 || 10.4 ||1&lt;br /&gt;
|-&lt;br /&gt;
|9/14/07 || 21 || 30 || 1582 || 75 || 8.7||2&lt;br /&gt;
|-&lt;br /&gt;
|10/3/07 || 21 || 30 || 2282 || 100 || 10.4||1&lt;br /&gt;
|-&lt;br /&gt;
|10/4/07 || 21 || 30 || 2029 || 97 ||  9.8|| 0.1&lt;br /&gt;
|-&lt;br /&gt;
|10/15/07 || 21 || 30 || 2180 || 100 ||  10|| 0.6&lt;br /&gt;
|-&lt;br /&gt;
|10/18/07 || 21 ||  30 || 2064 || 99 || 9.9||0.1&lt;br /&gt;
|-&lt;br /&gt;
| 10/23/07 || 21 || 30 || 2003 || 95 || 9.8||0.2&lt;br /&gt;
|-&lt;br /&gt;
| 10/26/07 || 21 || 30 || 1943 || 93 || 9.6 || 0.5&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The average count rate for a given trial is given in the 5th column by diving column 4 by column 2.  &lt;br /&gt;
&lt;br /&gt;
One can expect a Poisson parent distribution because the probability of a cosmic ray interacting with the scintillator is low.  The variance of measurement in each trial is related to the counting rate by &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 = \mu =&amp;lt;/math&amp;gt; average counting rate&lt;br /&gt;
&lt;br /&gt;
as a result of the assumption that the parent distribution is Poisson.  The value of this &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is shown in column 6.&lt;br /&gt;
&lt;br /&gt;
; Is the Poisson distribution the parent distribution in this experiment?&lt;br /&gt;
&lt;br /&gt;
To try and answer the above question lets determine the mean and variance of the data:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{x} =\frac{\sum CPM_i}{8} = 96.44&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;s = \sqrt{\frac{\sum (x_i-\mu)^2}{8-1}} = 10.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you approximate the Poisson distribution by a Gaussian then the probability any one measurement is within 1 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; of the mean is  68% = Probability that  a measurement of a Gaussian variant will lie within 1 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; of the mean.  For the Poisson distribution with a mean of 97 you would have 66% of the data occur within 1 &amp;lt;math&amp;gt;\sigma = \sqrt{97}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root [26] ROOT::Math::poisson_cdf(97-sqrt(97),97)&lt;br /&gt;
(double)1.67580969302001004e-01&lt;br /&gt;
root [30] 1-2*ROOT::Math::poisson_cdf(97-sqrt(97),97)        &lt;br /&gt;
(const double)6.64838061395997992e-01&lt;br /&gt;
&lt;br /&gt;
root [28] ROOT::Math::normal_cdf(97-sqrt(97),sqrt(97),97)&lt;br /&gt;
(double)1.58655253931457185e-01&lt;br /&gt;
root [29] 1-2*ROOT::Math::normal_cdf(97-sqrt(97),sqrt(97),97)&lt;br /&gt;
(const double)6.82689492137085630e-01&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 7th column above identifies how many sigma the mean of that trial is from the average &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= 0.68 * 8 = 5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Looks like we have 7/8  events within 1&amp;lt;math&amp;gt; \sigma&amp;lt;/math&amp;gt; = 87.5%  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
How about the average sigma assuming poisson?&lt;br /&gt;
&lt;br /&gt;
If you take the average of sigma estimate in column 6 you would get&lt;br /&gt;
:&amp;lt;math&amp;gt;\overline{\sigma(Poisson)} = \frac{\sum \sigma_i(Poisson)}{8} = 9.86&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this one can calculate the variance of the variance as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum \left ( \sigma_i(Poisson) - \overline{\sigma(Poisson)}\right)^2}{8-1} = (0.56)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
comparing the &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; from the 8 trials to the &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; from the Poisson estimate you have&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;10.9 = 9.9 \pm 0.56&amp;lt;/math&amp;gt; In agreement within 2 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What is really required however is an estimate of the probability that the assumption of a Poisson distribution is correct (Hypothesis test).  This will be the subject of future sections.&lt;br /&gt;
&lt;br /&gt;
=== Error Propagation===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f = \bar{x} = \frac{\sum x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial f}{\partial x_i} = \frac{1}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\delta f = \frac{\partial f}{\partial x_1}\sigma_{x_1} + \frac{\partial f}{\partial x_2}\sigma_{x_2} + \cdots \frac{\partial f}{\partial x_n}\sigma_{x_n}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} + \frac{\partial f}{\partial x_2}\sigma_{x_2} + \cdots \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} \right )^2 +  \left ( \frac{\partial f}{\partial x_2}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2 +   2 \left ( \frac{\partial^2 f}{\partial x_1\partial x_2} \right) \sigma_{x_1}\sigma_{x_2}  + \cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial^2 f}{\partial x_i\partial x_j} = \frac{\partial }{\partial x_j} \frac{1}{N} = 0 \Rightarrow&amp;lt;/math&amp;gt; no Covariances&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} \right )^2 +  \left ( \frac{\partial f}{\partial x_2}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt; = \left ( \frac{1}{N} \sigma_{x_1} \right )^2 +  \left ( \frac{1}{N}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{1}{N}\sigma_{x_n} \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_i = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{1}{N} \sigma \right )^2 +  \left ( \frac{1}{N}\sigma \right )^2 + \cdots   \left ( \frac{1}{N}\sigma \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=\frac{ \sigma^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Does this mean that we get an infinitely precise measurement if &amp;lt;math&amp;gt;N \rightarrow \infty&amp;lt;/math&amp;gt;?&lt;br /&gt;
: No!  In reality there are systematic errors in every experiment so the best you can do is reduce your statistical precision to a point where the systematic errors dominate.  There is also the observation that in practice it is difficult to find an experiment absent of  &amp;quot;non-statistical fluctuations&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Example: Table Area=&lt;br /&gt;
&lt;br /&gt;
A quantity which is calculated using  quantities with known uncertainties will have an uncertainty based upon the uncertainty of the quantities used in the calculation.&lt;br /&gt;
&lt;br /&gt;
To determine the uncertainty in a quantity which is a function of other quantities, you can consider the dependence of these quantities in terms of a tayler expansion&lt;br /&gt;
&lt;br /&gt;
Consider a calculation of a Table's Area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A= L \times W&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mean that the Area (A) is a function of the Length (L) and the Width (W) of the table.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A = f(L,W)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can write the variance of the area&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2_A = \frac{\sum_{i=1}^{i=N} (A_i - \bar{A})^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L})  \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} + (W-\bar W) \frac{\partial A}{\partial W} \bigg |_{\bar L \bar WW} \right] ^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L})  \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} \right ] ^2}{N} + \frac{\sum_{i=1}^{i=N} \left [ (W-\bar W) \frac{\partial A}{\partial W} \bigg |_{\bar L \bar W} \right] ^2  }{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;+2  \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L}) (W-\bar W) \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} \frac{\partial A}{\partial W} \bigg |_{\bar L \bar W} \right]^2}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sigma^2_L \left ( \frac{\partial A}{\partial L} \right )^2 +\sigma^2_W \left ( \frac{\partial A}{\partial W} \right )^2 + 2 \sigma^2_{LW} \frac{\partial A}{\partial L}  \frac{\partial A}{\partial W} &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma^2_{LW} = \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L}) (W-\bar W) \right ]^2}{N}&amp;lt;/math&amp;gt; is defined as the '''Covariance''' between &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;W&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Weighted Mean and variance =&lt;br /&gt;
&lt;br /&gt;
The variance &amp;lt;math&amp;gt;(\sigma)&amp;lt;/math&amp;gt; in the above examples was assumed to be the same for all measurement from the parent distribution.&lt;br /&gt;
&lt;br /&gt;
What happens when you wish to combine measurements with unequal variances (different experiments measuring the same quantity)?&lt;br /&gt;
&lt;br /&gt;
== Weighted Mean==&lt;br /&gt;
&lt;br /&gt;
Let's assume we have a measured quantity having a mean &amp;lt;math&amp;gt; X&amp;lt;/math&amp;gt;   from a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you attempt to measure X with several different experiments you will likely have a series of results which vary in their precision.&lt;br /&gt;
&lt;br /&gt;
Lets assume you have 2 experiments which obtained the averages &amp;lt;math&amp;gt;X_A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;X_B&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we assume that each measurement is governed by a Gaussian distribution,&lt;br /&gt;
&lt;br /&gt;
Then the probability of one experiment observing the value X_A is given by&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_A) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_A-X}{\sigma_A}\right )^2}}{\sigma_A}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
similarly the probability of the other experiment observing the average X_B is &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_B) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_B-X}{\sigma_B}\right )^2}}{\sigma_B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the combined probability that the first experiment measures the average &amp;lt;math&amp;gt;X_A&amp;lt;/math&amp;gt; and the second &amp;lt;math&amp;gt;X_B&amp;lt;/math&amp;gt; is given as the product of the two probabilities suth that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_A,X_B) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_A-X}{\sigma_A}\right )^2}}{\sigma_A} \frac{e^{-\frac{1}{2} \left ( \frac{X_B-X}{\sigma_B}\right )^2}}{\sigma_B} = \frac{e^{-\frac{1}{2}\left [  \left ( \frac{X_A-x}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2\right ]}}{\sigma_A \sigma_B}\equiv \frac{e^{-\frac{1}{2}\left [  \chi^2\right ]}}{\sigma_A \sigma_B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \chi^2 \equiv \left ( \frac{X_A-X}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;The principle of maximum likelihood (to be the cornerstone of hypothesis testing) may be written as&lt;br /&gt;
:The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observing is a maximum.&lt;br /&gt;
&lt;br /&gt;
Applying this principle to the two experiments means that the best estimate of &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; is made when &amp;lt;math&amp;gt;P(x=X_A,X_B)&amp;lt;/math&amp;gt; is a maximum which occurs when &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \chi^2 \equiv \left ( \frac{X_A-X}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2 = &amp;lt;/math&amp;gt;Minimum&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial X} =2 \left ( \frac{X_A-X}{\sigma_A^2}\right )(-1)+2 \left ( \frac{X_B-X}{\sigma_B^2}\right )(-1)= 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow X = \frac{\frac{X_A}{\sigma_A^2} + \frac{X_B}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If each observable (&amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;)  is accompanied by an estimate of the uncertainty in that observable (&amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt;) then the weighted mean is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{x} = \frac{ \sum_{i=1}^{i=n} \frac{x_i}{\sigma_i^2}}{\sum_{i=1}^{i=n} \frac{1}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Weighted Variance==&lt;br /&gt;
&lt;br /&gt;
To determine the variance of the measurements you should follow the Taylor series based prescription denoted above in that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \sum \sigma_i^2 \left ( \frac{\partial X}{\partial X_i}\right)^2 = \sigma_A^2\left ( \frac{\partial X}{\partial X_A}\right)^2 + \sigma_B^2\left ( \frac{\partial X}{\partial X_B}\right)^2&amp;lt;/math&amp;gt; : Assuming no covariance&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial X}{\partial X_A} = \frac{\partial}{\partial X_A}  \frac{\frac{X_A}{\sigma_A^2} + \frac{X_B}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} = \frac{\frac{1}{\sigma_A^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 =\sigma_A^2 \left ( \frac{\frac{1}{\sigma_A^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} \right)^2 + \sigma_B^2 \left ( \frac{\frac{1}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} \right)^2&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\frac{1}{\sigma_A^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}  + \frac{\frac{1}{\sigma_B^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{1}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variance of the distribution is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{1}{\sigma^2} = \sum_{i=1}^{i=n} \frac{1}{\sigma_i^2}&amp;lt;/math&amp;gt; = weighted variance&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences] [[Forest_Error_Analysis_for_the_Physical_Sciences]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_PropOfErr&amp;diff=91444</id>
		<title>TF ErrorAna PropOfErr</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_PropOfErr&amp;diff=91444"/>
		<updated>2014-02-28T20:15:19Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Taylor Expansion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Taylor Expansion=&lt;br /&gt;
&lt;br /&gt;
A quantity which is calculated using  quantities with known uncertainties will have an uncertainty based upon the uncertainty of the quantities used in the calculation.&lt;br /&gt;
&lt;br /&gt;
To determine the uncertainty in a quantity which is a function of other quantities, you can consider the dependence of these quantities in terms of a tayler expansion&lt;br /&gt;
&lt;br /&gt;
The Taylor series expansion of a function f(x) about the point a is given as &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x) = f(a) + \left . f^{\prime}(x)\right |_{x=a} \frac{x-a}{1!} + \left . f^{\prime \prime}(x)\right |_{x=a} \frac{(x-a)^2}{2!} + ...&amp;lt;/math&amp;gt;&lt;br /&gt;
;&amp;lt;math&amp;gt;= \left . \sum_{n=0}^{\infty} f^{(n)}(x)\right |_{x=a} \frac{x^n}{n!}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For small values of x (x &amp;lt;&amp;lt; 1) we can expand the function about 0 such that&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt{1+x} = \left . \sqrt{1-0} \frac{1}{2}(1+x)^{-1/2}\right |_{x=0} \frac{x^1}{1!}+ \left . \frac{1}{2}\frac{-1}{2}(1+x)^{-3/2} \right |_{x=0} \frac{x^2}{2!}&amp;lt;/math&amp;gt;&lt;br /&gt;
;&amp;lt;math&amp;gt;=1 + \frac{x}{2} - \frac{x^2}{8}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The taylor expansion of a function with two variables&amp;lt;math&amp;gt; (x_1 , x_2)&amp;lt;/math&amp;gt; about the average of the two variables&amp;lt;math&amp;gt; (\bar {x_1} , \bar{x_2} )&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x, y)=f(\bar {x}, \bar{x})+(x-\bar {x}) \frac{\partial f}{\partial x}\bigg |_{(x = \bar {x}, y = \bar{y})} +(y-\bar{y}) \frac{\partial f}{\partial y}\bigg |_{(x = \bar {x}, y = \bar{x})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x, y)-f(\bar {x}, \bar{y})=(x-\bar {x}) \frac{\partial f}{\partial x}\bigg |_{(x = \bar {x}, y = \bar{y})} +(y-\bar{y}) \frac{\partial f}{\partial y}\bigg |_{(x = \bar {x}, y = \bar{y})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The average &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f(\bar {x}, \bar{y}) \equiv \frac{\sum f(x,y)_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta f = f(x, y)-f(\bar {x}, \bar{y})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
represents a small fluctuation &amp;lt;math&amp;gt;(\delta f)&amp;lt;/math&amp;gt; of the function &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; from its average &amp;lt;math&amp;gt;f(\bar {x}, \bar{y})&amp;lt;/math&amp;gt; if we ignore higher order terms in the Taylor expansion ( this means the fluctuations are small)then we can write the variance using the definition as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \frac{\sum \left [ f(x,y)_i - f(\bar {x}, \bar{y})\right ]^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\sum \left [(x_i-\bar {x}) \frac{\partial f}{\partial x}+(y_i-\bar{y}) \frac{\partial f}{\partial y}\right ]^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum (x_i-\bar {x})^2 \left ( \frac{\partial f}{\partial x}\right )^2}{N} + \frac{\sum (y_i-\bar {y})^2 \left ( \frac{\partial f}{\partial y}\right )^2}{N} + 2 \frac{\sum (x_i-\bar {x}) \left ( \frac{\partial f}{\partial x} \right ) (y_i-\bar {y}) \left ( \frac{\partial f}{\partial y}\right )}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \sigma_x^2 \left ( \frac{\partial f}{\partial x}\right )^2 + \sigma_y^2\left ( \frac{\partial f}{\partial y}\right )^2 + 2 \sigma_{x,y}^2 \left ( \frac{\partial f}{\partial x} \right )  \left ( \frac{\partial f}{\partial y}\right ) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{x,y}^2 = \frac{\sum (x_i-\bar {x}) (y_i-\bar {y}) }{N} \equiv&amp;lt;/math&amp;gt; Covariance&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above can be reproduced for functions with multiple variables.&lt;br /&gt;
&lt;br /&gt;
=Instrumental and Statistical Uncertainties=&lt;br /&gt;
&lt;br /&gt;
http://www.physics.uoguelph.ca/~reception/2440/StatsErrorsJuly26-06.pdf&lt;br /&gt;
==Counting Experiment Example==&lt;br /&gt;
&lt;br /&gt;
The table below reports 8 measurements of the coincidence rate observed by two scintillators detecting cosmic rays.  The scintillator are place a distance (x) away from each other in order to detect cosmic rays falling on the earth's surface.  The time and observed coincidence counts are reported in separate columns as well as the angle made by the normal to the detector with the earths surface.  &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;5&amp;quot;&lt;br /&gt;
! Date || Time (hrs) ||  &amp;lt;math&amp;gt;\theta&amp;lt;/math&amp;gt; ||Coincidence Counts || Mean Coinc/Hr  || &amp;lt;math&amp;gt;\sigma_{Poisson} = \sqrt{\mbox{Mean Counts/Hr}}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;\left | \sigma \right |&amp;lt;/math&amp;gt; from Mean&lt;br /&gt;
|-&lt;br /&gt;
|9/12/07 || 20.5 || 30|| 2233 || 109 || 10.4 ||1&lt;br /&gt;
|-&lt;br /&gt;
|9/14/07 || 21 || 30 || 1582 || 75 || 8.7||2&lt;br /&gt;
|-&lt;br /&gt;
|10/3/07 || 21 || 30 || 2282 || 100 || 10.4||1&lt;br /&gt;
|-&lt;br /&gt;
|10/4/07 || 21 || 30 || 2029 || 97 ||  9.8|| 0.1&lt;br /&gt;
|-&lt;br /&gt;
|10/15/07 || 21 || 30 || 2180 || 100 ||  10|| 0.6&lt;br /&gt;
|-&lt;br /&gt;
|10/18/07 || 21 ||  30 || 2064 || 99 || 9.9||0.1&lt;br /&gt;
|-&lt;br /&gt;
| 10/23/07 || 21 || 30 || 2003 || 95 || 9.8||0.2&lt;br /&gt;
|-&lt;br /&gt;
| 10/26/07 || 21 || 30 || 1943 || 93 || 9.6 || 0.5&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The average count rate for a given trial is given in the 5th column by diving column 4 by column 2.  &lt;br /&gt;
&lt;br /&gt;
One can expect a Poisson parent distribution because the probability of a cosmic ray interacting with the scintillator is low.  The variance of measurement in each trial is related to the counting rate by &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 = \mu =&amp;lt;/math&amp;gt; average counting rate&lt;br /&gt;
&lt;br /&gt;
as a result of the assumption that the parent distribution is Poisson.  The value of this &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is shown in column 6.&lt;br /&gt;
&lt;br /&gt;
; Is the Poisson distribution the parent distribution in this experiment?&lt;br /&gt;
&lt;br /&gt;
To try and answer the above question lets determine the mean and variance of the data:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{x} =\frac{\sum CPM_i}{8} = 96.44&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;s = \sqrt{\frac{\sum (x_i-\mu)^2}{8-1}} = 10.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you approximate the Poisson distribution by a Gaussian then the probability any one measurement is within 1 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; of the mean is  68% = Probability that  a measurement of a Gaussian variant will lie within 1 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; of the mean.  For the Poisson distribution with a mean of 97 you would have 66% of the data occur within 1 &amp;lt;math&amp;gt;\sigma = \sqrt{97}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root [26] ROOT::Math::poisson_cdf(97-sqrt(97),97)&lt;br /&gt;
(double)1.67580969302001004e-01&lt;br /&gt;
root [30] 1-2*ROOT::Math::poisson_cdf(97-sqrt(97),97)        &lt;br /&gt;
(const double)6.64838061395997992e-01&lt;br /&gt;
&lt;br /&gt;
root [28] ROOT::Math::normal_cdf(97-sqrt(97),sqrt(97),97)&lt;br /&gt;
(double)1.58655253931457185e-01&lt;br /&gt;
root [29] 1-2*ROOT::Math::normal_cdf(97-sqrt(97),sqrt(97),97)&lt;br /&gt;
(const double)6.82689492137085630e-01&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 7th column above identifies how many sigma the mean of that trial is from the average &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= 0.68 * 8 = 5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Looks like we have 7/8  events within 1&amp;lt;math&amp;gt; \sigma&amp;lt;/math&amp;gt; = 87.5%  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
How about the average sigma assuming poisson?&lt;br /&gt;
&lt;br /&gt;
If you take the average of sigma estimate in column 6 you would get&lt;br /&gt;
:&amp;lt;math&amp;gt;\overline{\sigma(Poisson)} = \frac{\sum \sigma_i(Poisson)}{8} = 9.86&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this one can calculate the variance of the variance as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum \left ( \sigma_i(Poisson) - \overline{\sigma(Poisson)}\right)^2}{8-1} = (0.56)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
comparing the &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; from the 8 trials to the &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; from the Poisson estimate you have&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;10.9 = 9.9 \pm 0.56&amp;lt;/math&amp;gt; In agreement within 2 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What is really required however is an estimate of the probability that the assumption of a Poisson distribution is correct (Hypothesis test).  This will be the subject of future sections.&lt;br /&gt;
&lt;br /&gt;
=== Error Propagation===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f = \bar{x} = \frac{\sum x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial f}{\partial x_i} = \frac{1}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\delta f = \frac{\partial f}{\partial x_1}\sigma_{x_1} + \frac{\partial f}{\partial x_2}\sigma_{x_2} + \cdots \frac{\partial f}{\partial x_n}\sigma_{x_n}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} + \frac{\partial f}{\partial x_2}\sigma_{x_2} + \cdots \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} \right )^2 +  \left ( \frac{\partial f}{\partial x_2}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2 +   2 \left ( \frac{\partial^2 f}{\partial x_1\partial x_2} \right) \sigma_{x_1}\sigma_{x_2}  + \cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial^2 f}{\partial x_i\partial x_j} = \frac{\partial }{\partial x_j} \frac{1}{N} = 0 \Rightarrow&amp;lt;/math&amp;gt; no Covariances&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} \right )^2 +  \left ( \frac{\partial f}{\partial x_2}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt; = \left ( \frac{1}{N} \sigma_{x_1} \right )^2 +  \left ( \frac{1}{N}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{1}{N}\sigma_{x_n} \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_i = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{1}{N} \sigma \right )^2 +  \left ( \frac{1}{N}\sigma \right )^2 + \cdots   \left ( \frac{1}{N}\sigma \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=\frac{ \sigma^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Does this mean that we get an infinitely precise measurement if &amp;lt;math&amp;gt;N \rightarrow \infty&amp;lt;/math&amp;gt;?&lt;br /&gt;
: No!  In reality there are systematic errors in every experiment so the best you can do is reduce your statistical precision to a point where the systematic errors dominate.  There is also the observation that in practice it is difficult to find an experiment absent of  &amp;quot;non-statistical fluctuations&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Example: Table Area=&lt;br /&gt;
&lt;br /&gt;
A quantity which is calculated using  quantities with known uncertainties will have an uncertainty based upon the uncertainty of the quantities used in the calculation.&lt;br /&gt;
&lt;br /&gt;
To determine the uncertainty in a quantity which is a function of other quantities, you can consider the dependence of these quantities in terms of a tayler expansion&lt;br /&gt;
&lt;br /&gt;
Consider a calculation of a Table's Area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A= L \times W&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mean that the Area (A) is a function of the Length (L) and the Width (W) of the table.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A = f(L,W)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can write the variance of the area&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2_A = \frac{\sum_{i=1}^{i=N} (A_i - \bar{A})^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L})  \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} + (W-\bar W) \frac{\partial A}{\partial W} \bigg |_{\bar L \bar WW} \right] ^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L})  \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} \right ] ^2}{N} + \frac{\sum_{i=1}^{i=N} \left [ (W-\bar W) \frac{\partial A}{\partial W} \bigg |_{\bar L \bar W} \right] ^2  }{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;+2  \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L}) (W-\bar W) \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} \frac{\partial A}{\partial W} \bigg |_{\bar L \bar W} \right]^2}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sigma^2_L \left ( \frac{\partial A}{\partial L} \right )^2 +\sigma^2_W \left ( \frac{\partial A}{\partial W} \right )^2 + 2 \sigma^2_{LW} \frac{\partial A}{\partial L}  \frac{\partial A}{\partial W} &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma^2_{LW} = \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L}) (W-\bar W) \right ]^2}{N}&amp;lt;/math&amp;gt; is defined as the '''Covariance''' between &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;W&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Weighted Mean and variance =&lt;br /&gt;
&lt;br /&gt;
The variance &amp;lt;math&amp;gt;(\sigma)&amp;lt;/math&amp;gt; in the above examples was assumed to be the same for all measurement from the parent distribution.&lt;br /&gt;
&lt;br /&gt;
What happens when you wish to combine measurements with unequal variances (different experiments measuring the same quantity)?&lt;br /&gt;
&lt;br /&gt;
== Weighted Mean==&lt;br /&gt;
&lt;br /&gt;
Let's assume we have a measured quantity having a mean &amp;lt;math&amp;gt; X&amp;lt;/math&amp;gt;   from a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you attempt to measure X with several different experiments you will likely have a series of results which vary in their precision.&lt;br /&gt;
&lt;br /&gt;
Lets assume you have 2 experiments which obtained the averages &amp;lt;math&amp;gt;X_A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;X_B&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we assume that each measurement is governed by a Gaussian distribution,&lt;br /&gt;
&lt;br /&gt;
Then the probability of one experiment observing the value X_A is given by&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_A) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_A-X}{\sigma_A}\right )^2}}{\sigma_A}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
similarly the probability of the other experiment observing the average X_B is &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_B) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_B-X}{\sigma_B}\right )^2}}{\sigma_B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the combined probability that the first experiment measures the average &amp;lt;math&amp;gt;X_A&amp;lt;/math&amp;gt; and the second &amp;lt;math&amp;gt;X_B&amp;lt;/math&amp;gt; is given as the product of the two probabilities suth that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_A,X_B) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_A-X}{\sigma_A}\right )^2}}{\sigma_A} \frac{e^{-\frac{1}{2} \left ( \frac{X_B-X}{\sigma_B}\right )^2}}{\sigma_B} = \frac{e^{-\frac{1}{2}\left [  \left ( \frac{X_A-x}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2\right ]}}{\sigma_A \sigma_B}\equiv \frac{e^{-\frac{1}{2}\left [  \chi^2\right ]}}{\sigma_A \sigma_B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \chi^2 \equiv \left ( \frac{X_A-X}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;The principle of maximum likelihood (to be the cornerstone of hypothesis testing) may be written as&lt;br /&gt;
:The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observing is a maximum.&lt;br /&gt;
&lt;br /&gt;
Applying this principle to the two experiments means that the best estimate of &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; is made when &amp;lt;math&amp;gt;P(x=X_A,X_B)&amp;lt;/math&amp;gt; is a maximum which occurs when &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \chi^2 \equiv \left ( \frac{X_A-X}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2 = &amp;lt;/math&amp;gt;Minimum&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial X} =2 \left ( \frac{X_A-X}{\sigma_A^2}\right )(-1)+2 \left ( \frac{X_B-X}{\sigma_B^2}\right )(-1)= 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow X = \frac{\frac{X_A}{\sigma_A^2} + \frac{X_B}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If each observable (&amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;)  is accompanied by an estimate of the uncertainty in that observable (&amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt;) then the weighted mean is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{x} = \frac{ \sum_{i=1}^{i=n} \frac{x_i}{\sigma_i^2}}{\sum_{i=1}^{i=n} \frac{1}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Weighted Variance==&lt;br /&gt;
&lt;br /&gt;
To determine the variance of the measurements you should follow the Taylor series based prescription denoted above in that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \sum \sigma_i^2 \left ( \frac{\partial X}{\partial X_i}\right)^2 = \sigma_A^2\left ( \frac{\partial X}{\partial X_A}\right)^2 + \sigma_B^2\left ( \frac{\partial X}{\partial X_B}\right)^2&amp;lt;/math&amp;gt; : Assuming no covariance&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial X}{\partial X_A} = \frac{\partial}{\partial X_A}  \frac{\frac{X_A}{\sigma_A^2} + \frac{X_B}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} = \frac{\frac{1}{\sigma_A^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 =\sigma_A^2 \left ( \frac{\frac{1}{\sigma_A^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} \right)^2 + \sigma_B^2 \left ( \frac{\frac{1}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} \right)^2&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\frac{1}{\sigma_A^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}  + \frac{\frac{1}{\sigma_B^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{1}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variance of the distribution is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{1}{\sigma^2} = \sum_{i=1}^{i=n} \frac{1}{\sigma_i^2}&amp;lt;/math&amp;gt; = weighted variance&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences] [[Forest_Error_Analysis_for_the_Physical_Sciences]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_PropOfErr&amp;diff=91443</id>
		<title>TF ErrorAna PropOfErr</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_PropOfErr&amp;diff=91443"/>
		<updated>2014-02-28T20:14:33Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Taylor Expansion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Taylor Expansion=&lt;br /&gt;
&lt;br /&gt;
A quantity which is calculated using  quantities with known uncertainties will have an uncertainty based upon the uncertainty of the quantities used in the calculation.&lt;br /&gt;
&lt;br /&gt;
To determine the uncertainty in a quantity which is a function of other quantities, you can consider the dependence of these quantities in terms of a tayler expansion&lt;br /&gt;
&lt;br /&gt;
The Taylor series expansion of a function f(x) about the point a is given as &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x) = f(a) + \left . f^{\prime}(x)\right |_{x=a} \frac{x}{1!} + \left . f^{\prime \prime}(x)\right |_{x=a} \frac{x^2}{2!} + ...&amp;lt;/math&amp;gt;&lt;br /&gt;
;&amp;lt;math&amp;gt;= \left . \sum_{n=0}^{\infty} f^{(n)}(x)\right |_{x=a} \frac{x^n}{n!}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For small values of x (x &amp;lt;&amp;lt; 1) we can expand the function about 0 such that&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt{1+x} = \left . \sqrt{1-0} \frac{1}{2}(1+x)^{-1/2}\right |_{x=0} \frac{x^1}{1!}+ \left . \frac{1}{2}\frac{-1}{2}(1+x)^{-3/2} \right |_{x=0} \frac{x^2}{2!}&amp;lt;/math&amp;gt;&lt;br /&gt;
;&amp;lt;math&amp;gt;=1 + \frac{x}{2} - \frac{x^2}{8}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The taylor expansion of a function with two variables&amp;lt;math&amp;gt; (x_1 , x_2)&amp;lt;/math&amp;gt; about the average of the two variables&amp;lt;math&amp;gt; (\bar {x_1} , \bar{x_2} )&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x, y)=f(\bar {x}, \bar{x})+(x-\bar {x}) \frac{\partial f}{\partial x}\bigg |_{(x = \bar {x}, y = \bar{y})} +(y-\bar{y}) \frac{\partial f}{\partial y}\bigg |_{(x = \bar {x}, y = \bar{x})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x, y)-f(\bar {x}, \bar{y})=(x-\bar {x}) \frac{\partial f}{\partial x}\bigg |_{(x = \bar {x}, y = \bar{y})} +(y-\bar{y}) \frac{\partial f}{\partial y}\bigg |_{(x = \bar {x}, y = \bar{y})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The average &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f(\bar {x}, \bar{y}) \equiv \frac{\sum f(x,y)_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta f = f(x, y)-f(\bar {x}, \bar{y})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
represents a small fluctuation &amp;lt;math&amp;gt;(\delta f)&amp;lt;/math&amp;gt; of the function &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; from its average &amp;lt;math&amp;gt;f(\bar {x}, \bar{y})&amp;lt;/math&amp;gt; if we ignore higher order terms in the Taylor expansion ( this means the fluctuations are small)then we can write the variance using the definition as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \frac{\sum \left [ f(x,y)_i - f(\bar {x}, \bar{y})\right ]^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\sum \left [(x_i-\bar {x}) \frac{\partial f}{\partial x}+(y_i-\bar{y}) \frac{\partial f}{\partial y}\right ]^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum (x_i-\bar {x})^2 \left ( \frac{\partial f}{\partial x}\right )^2}{N} + \frac{\sum (y_i-\bar {y})^2 \left ( \frac{\partial f}{\partial y}\right )^2}{N} + 2 \frac{\sum (x_i-\bar {x}) \left ( \frac{\partial f}{\partial x} \right ) (y_i-\bar {y}) \left ( \frac{\partial f}{\partial y}\right )}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \sigma_x^2 \left ( \frac{\partial f}{\partial x}\right )^2 + \sigma_y^2\left ( \frac{\partial f}{\partial y}\right )^2 + 2 \sigma_{x,y}^2 \left ( \frac{\partial f}{\partial x} \right )  \left ( \frac{\partial f}{\partial y}\right ) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{x,y}^2 = \frac{\sum (x_i-\bar {x}) (y_i-\bar {y}) }{N} \equiv&amp;lt;/math&amp;gt; Covariance&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above can be reproduced for functions with multiple variables.&lt;br /&gt;
&lt;br /&gt;
=Instrumental and Statistical Uncertainties=&lt;br /&gt;
&lt;br /&gt;
http://www.physics.uoguelph.ca/~reception/2440/StatsErrorsJuly26-06.pdf&lt;br /&gt;
==Counting Experiment Example==&lt;br /&gt;
&lt;br /&gt;
The table below reports 8 measurements of the coincidence rate observed by two scintillators detecting cosmic rays.  The scintillator are place a distance (x) away from each other in order to detect cosmic rays falling on the earth's surface.  The time and observed coincidence counts are reported in separate columns as well as the angle made by the normal to the detector with the earths surface.  &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;5&amp;quot;&lt;br /&gt;
! Date || Time (hrs) ||  &amp;lt;math&amp;gt;\theta&amp;lt;/math&amp;gt; ||Coincidence Counts || Mean Coinc/Hr  || &amp;lt;math&amp;gt;\sigma_{Poisson} = \sqrt{\mbox{Mean Counts/Hr}}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;\left | \sigma \right |&amp;lt;/math&amp;gt; from Mean&lt;br /&gt;
|-&lt;br /&gt;
|9/12/07 || 20.5 || 30|| 2233 || 109 || 10.4 ||1&lt;br /&gt;
|-&lt;br /&gt;
|9/14/07 || 21 || 30 || 1582 || 75 || 8.7||2&lt;br /&gt;
|-&lt;br /&gt;
|10/3/07 || 21 || 30 || 2282 || 100 || 10.4||1&lt;br /&gt;
|-&lt;br /&gt;
|10/4/07 || 21 || 30 || 2029 || 97 ||  9.8|| 0.1&lt;br /&gt;
|-&lt;br /&gt;
|10/15/07 || 21 || 30 || 2180 || 100 ||  10|| 0.6&lt;br /&gt;
|-&lt;br /&gt;
|10/18/07 || 21 ||  30 || 2064 || 99 || 9.9||0.1&lt;br /&gt;
|-&lt;br /&gt;
| 10/23/07 || 21 || 30 || 2003 || 95 || 9.8||0.2&lt;br /&gt;
|-&lt;br /&gt;
| 10/26/07 || 21 || 30 || 1943 || 93 || 9.6 || 0.5&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The average count rate for a given trial is given in the 5th column by diving column 4 by column 2.  &lt;br /&gt;
&lt;br /&gt;
One can expect a Poisson parent distribution because the probability of a cosmic ray interacting with the scintillator is low.  The variance of measurement in each trial is related to the counting rate by &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 = \mu =&amp;lt;/math&amp;gt; average counting rate&lt;br /&gt;
&lt;br /&gt;
as a result of the assumption that the parent distribution is Poisson.  The value of this &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is shown in column 6.&lt;br /&gt;
&lt;br /&gt;
; Is the Poisson distribution the parent distribution in this experiment?&lt;br /&gt;
&lt;br /&gt;
To try and answer the above question lets determine the mean and variance of the data:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{x} =\frac{\sum CPM_i}{8} = 96.44&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;s = \sqrt{\frac{\sum (x_i-\mu)^2}{8-1}} = 10.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you approximate the Poisson distribution by a Gaussian then the probability any one measurement is within 1 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; of the mean is  68% = Probability that  a measurement of a Gaussian variant will lie within 1 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; of the mean.  For the Poisson distribution with a mean of 97 you would have 66% of the data occur within 1 &amp;lt;math&amp;gt;\sigma = \sqrt{97}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root [26] ROOT::Math::poisson_cdf(97-sqrt(97),97)&lt;br /&gt;
(double)1.67580969302001004e-01&lt;br /&gt;
root [30] 1-2*ROOT::Math::poisson_cdf(97-sqrt(97),97)        &lt;br /&gt;
(const double)6.64838061395997992e-01&lt;br /&gt;
&lt;br /&gt;
root [28] ROOT::Math::normal_cdf(97-sqrt(97),sqrt(97),97)&lt;br /&gt;
(double)1.58655253931457185e-01&lt;br /&gt;
root [29] 1-2*ROOT::Math::normal_cdf(97-sqrt(97),sqrt(97),97)&lt;br /&gt;
(const double)6.82689492137085630e-01&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 7th column above identifies how many sigma the mean of that trial is from the average &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= 0.68 * 8 = 5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Looks like we have 7/8  events within 1&amp;lt;math&amp;gt; \sigma&amp;lt;/math&amp;gt; = 87.5%  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
How about the average sigma assuming poisson?&lt;br /&gt;
&lt;br /&gt;
If you take the average of sigma estimate in column 6 you would get&lt;br /&gt;
:&amp;lt;math&amp;gt;\overline{\sigma(Poisson)} = \frac{\sum \sigma_i(Poisson)}{8} = 9.86&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this one can calculate the variance of the variance as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum \left ( \sigma_i(Poisson) - \overline{\sigma(Poisson)}\right)^2}{8-1} = (0.56)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
comparing the &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; from the 8 trials to the &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; from the Poisson estimate you have&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;10.9 = 9.9 \pm 0.56&amp;lt;/math&amp;gt; In agreement within 2 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What is really required however is an estimate of the probability that the assumption of a Poisson distribution is correct (Hypothesis test).  This will be the subject of future sections.&lt;br /&gt;
&lt;br /&gt;
=== Error Propagation===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f = \bar{x} = \frac{\sum x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial f}{\partial x_i} = \frac{1}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\delta f = \frac{\partial f}{\partial x_1}\sigma_{x_1} + \frac{\partial f}{\partial x_2}\sigma_{x_2} + \cdots \frac{\partial f}{\partial x_n}\sigma_{x_n}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} + \frac{\partial f}{\partial x_2}\sigma_{x_2} + \cdots \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} \right )^2 +  \left ( \frac{\partial f}{\partial x_2}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2 +   2 \left ( \frac{\partial^2 f}{\partial x_1\partial x_2} \right) \sigma_{x_1}\sigma_{x_2}  + \cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial^2 f}{\partial x_i\partial x_j} = \frac{\partial }{\partial x_j} \frac{1}{N} = 0 \Rightarrow&amp;lt;/math&amp;gt; no Covariances&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} \right )^2 +  \left ( \frac{\partial f}{\partial x_2}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt; = \left ( \frac{1}{N} \sigma_{x_1} \right )^2 +  \left ( \frac{1}{N}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{1}{N}\sigma_{x_n} \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_i = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{1}{N} \sigma \right )^2 +  \left ( \frac{1}{N}\sigma \right )^2 + \cdots   \left ( \frac{1}{N}\sigma \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=\frac{ \sigma^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Does this mean that we get an infinitely precise measurement if &amp;lt;math&amp;gt;N \rightarrow \infty&amp;lt;/math&amp;gt;?&lt;br /&gt;
: No!  In reality there are systematic errors in every experiment so the best you can do is reduce your statistical precision to a point where the systematic errors dominate.  There is also the observation that in practice it is difficult to find an experiment absent of  &amp;quot;non-statistical fluctuations&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Example: Table Area=&lt;br /&gt;
&lt;br /&gt;
A quantity which is calculated using  quantities with known uncertainties will have an uncertainty based upon the uncertainty of the quantities used in the calculation.&lt;br /&gt;
&lt;br /&gt;
To determine the uncertainty in a quantity which is a function of other quantities, you can consider the dependence of these quantities in terms of a tayler expansion&lt;br /&gt;
&lt;br /&gt;
Consider a calculation of a Table's Area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A= L \times W&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mean that the Area (A) is a function of the Length (L) and the Width (W) of the table.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A = f(L,W)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can write the variance of the area&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2_A = \frac{\sum_{i=1}^{i=N} (A_i - \bar{A})^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L})  \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} + (W-\bar W) \frac{\partial A}{\partial W} \bigg |_{\bar L \bar WW} \right] ^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L})  \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} \right ] ^2}{N} + \frac{\sum_{i=1}^{i=N} \left [ (W-\bar W) \frac{\partial A}{\partial W} \bigg |_{\bar L \bar W} \right] ^2  }{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;+2  \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L}) (W-\bar W) \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} \frac{\partial A}{\partial W} \bigg |_{\bar L \bar W} \right]^2}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sigma^2_L \left ( \frac{\partial A}{\partial L} \right )^2 +\sigma^2_W \left ( \frac{\partial A}{\partial W} \right )^2 + 2 \sigma^2_{LW} \frac{\partial A}{\partial L}  \frac{\partial A}{\partial W} &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma^2_{LW} = \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L}) (W-\bar W) \right ]^2}{N}&amp;lt;/math&amp;gt; is defined as the '''Covariance''' between &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;W&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Weighted Mean and variance =&lt;br /&gt;
&lt;br /&gt;
The variance &amp;lt;math&amp;gt;(\sigma)&amp;lt;/math&amp;gt; in the above examples was assumed to be the same for all measurement from the parent distribution.&lt;br /&gt;
&lt;br /&gt;
What happens when you wish to combine measurements with unequal variances (different experiments measuring the same quantity)?&lt;br /&gt;
&lt;br /&gt;
== Weighted Mean==&lt;br /&gt;
&lt;br /&gt;
Let's assume we have a measured quantity having a mean &amp;lt;math&amp;gt; X&amp;lt;/math&amp;gt;   from a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you attempt to measure X with several different experiments you will likely have a series of results which vary in their precision.&lt;br /&gt;
&lt;br /&gt;
Lets assume you have 2 experiments which obtained the averages &amp;lt;math&amp;gt;X_A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;X_B&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we assume that each measurement is governed by a Gaussian distribution,&lt;br /&gt;
&lt;br /&gt;
Then the probability of one experiment observing the value X_A is given by&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_A) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_A-X}{\sigma_A}\right )^2}}{\sigma_A}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
similarly the probability of the other experiment observing the average X_B is &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_B) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_B-X}{\sigma_B}\right )^2}}{\sigma_B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the combined probability that the first experiment measures the average &amp;lt;math&amp;gt;X_A&amp;lt;/math&amp;gt; and the second &amp;lt;math&amp;gt;X_B&amp;lt;/math&amp;gt; is given as the product of the two probabilities suth that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_A,X_B) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_A-X}{\sigma_A}\right )^2}}{\sigma_A} \frac{e^{-\frac{1}{2} \left ( \frac{X_B-X}{\sigma_B}\right )^2}}{\sigma_B} = \frac{e^{-\frac{1}{2}\left [  \left ( \frac{X_A-x}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2\right ]}}{\sigma_A \sigma_B}\equiv \frac{e^{-\frac{1}{2}\left [  \chi^2\right ]}}{\sigma_A \sigma_B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \chi^2 \equiv \left ( \frac{X_A-X}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;The principle of maximum likelihood (to be the cornerstone of hypothesis testing) may be written as&lt;br /&gt;
:The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observing is a maximum.&lt;br /&gt;
&lt;br /&gt;
Applying this principle to the two experiments means that the best estimate of &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; is made when &amp;lt;math&amp;gt;P(x=X_A,X_B)&amp;lt;/math&amp;gt; is a maximum which occurs when &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \chi^2 \equiv \left ( \frac{X_A-X}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2 = &amp;lt;/math&amp;gt;Minimum&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial X} =2 \left ( \frac{X_A-X}{\sigma_A^2}\right )(-1)+2 \left ( \frac{X_B-X}{\sigma_B^2}\right )(-1)= 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow X = \frac{\frac{X_A}{\sigma_A^2} + \frac{X_B}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If each observable (&amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;)  is accompanied by an estimate of the uncertainty in that observable (&amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt;) then the weighted mean is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{x} = \frac{ \sum_{i=1}^{i=n} \frac{x_i}{\sigma_i^2}}{\sum_{i=1}^{i=n} \frac{1}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Weighted Variance==&lt;br /&gt;
&lt;br /&gt;
To determine the variance of the measurements you should follow the Taylor series based prescription denoted above in that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \sum \sigma_i^2 \left ( \frac{\partial X}{\partial X_i}\right)^2 = \sigma_A^2\left ( \frac{\partial X}{\partial X_A}\right)^2 + \sigma_B^2\left ( \frac{\partial X}{\partial X_B}\right)^2&amp;lt;/math&amp;gt; : Assuming no covariance&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial X}{\partial X_A} = \frac{\partial}{\partial X_A}  \frac{\frac{X_A}{\sigma_A^2} + \frac{X_B}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} = \frac{\frac{1}{\sigma_A^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 =\sigma_A^2 \left ( \frac{\frac{1}{\sigma_A^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} \right)^2 + \sigma_B^2 \left ( \frac{\frac{1}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} \right)^2&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\frac{1}{\sigma_A^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}  + \frac{\frac{1}{\sigma_B^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{1}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variance of the distribution is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{1}{\sigma^2} = \sum_{i=1}^{i=n} \frac{1}{\sigma_i^2}&amp;lt;/math&amp;gt; = weighted variance&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences] [[Forest_Error_Analysis_for_the_Physical_Sciences]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_PropOfErr&amp;diff=91442</id>
		<title>TF ErrorAna PropOfErr</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=TF_ErrorAna_PropOfErr&amp;diff=91442"/>
		<updated>2014-02-28T20:13:53Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Taylor Expansion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Taylor Expansion=&lt;br /&gt;
&lt;br /&gt;
A quantity which is calculated using  quantities with known uncertainties will have an uncertainty based upon the uncertainty of the quantities used in the calculation.&lt;br /&gt;
&lt;br /&gt;
To determine the uncertainty in a quantity which is a function of other quantities, you can consider the dependence of these quantities in terms of a tayler expansion&lt;br /&gt;
&lt;br /&gt;
The Taylor series expansion of a function f(x) about the point a=0 is given as &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x) = f(a) + \left . f^{\prime}(x)\right |_{x=a} \frac{x}{1!} + \left . f^{\prime \prime}(x)\right |_{x=a} \frac{x^2}{2!} + ...&amp;lt;/math&amp;gt;&lt;br /&gt;
;&amp;lt;math&amp;gt;= \left . \sum_{n=0}^{\infty} f^{(n)}(x)\right |_{x=a} \frac{x^n}{n!}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For small values of x (x &amp;lt;&amp;lt; 1) we can expand the function about 0 such that&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt{1+x} = \left . \sqrt{1-0} \frac{1}{2}(1+x)^{-1/2}\right |_{x=0} \frac{x^1}{1!}+ \left . \frac{1}{2}\frac{-1}{2}(1+x)^{-3/2} \right |_{x=0} \frac{x^2}{2!}&amp;lt;/math&amp;gt;&lt;br /&gt;
;&amp;lt;math&amp;gt;=1 + \frac{x}{2} - \frac{x^2}{8}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The taylor expansion of a function with two variables&amp;lt;math&amp;gt; (x_1 , x_2)&amp;lt;/math&amp;gt; about the average of the two variables&amp;lt;math&amp;gt; (\bar {x_1} , \bar{x_2} )&amp;lt;/math&amp;gt; is given by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x, y)=f(\bar {x}, \bar{x})+(x-\bar {x}) \frac{\partial f}{\partial x}\bigg |_{(x = \bar {x}, y = \bar{y})} +(y-\bar{y}) \frac{\partial f}{\partial y}\bigg |_{(x = \bar {x}, y = \bar{x})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f(x, y)-f(\bar {x}, \bar{y})=(x-\bar {x}) \frac{\partial f}{\partial x}\bigg |_{(x = \bar {x}, y = \bar{y})} +(y-\bar{y}) \frac{\partial f}{\partial y}\bigg |_{(x = \bar {x}, y = \bar{y})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The average &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f(\bar {x}, \bar{y}) \equiv \frac{\sum f(x,y)_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta f = f(x, y)-f(\bar {x}, \bar{y})&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
represents a small fluctuation &amp;lt;math&amp;gt;(\delta f)&amp;lt;/math&amp;gt; of the function &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; from its average &amp;lt;math&amp;gt;f(\bar {x}, \bar{y})&amp;lt;/math&amp;gt; if we ignore higher order terms in the Taylor expansion ( this means the fluctuations are small)then we can write the variance using the definition as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \frac{\sum \left [ f(x,y)_i - f(\bar {x}, \bar{y})\right ]^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\sum \left [(x_i-\bar {x}) \frac{\partial f}{\partial x}+(y_i-\bar{y}) \frac{\partial f}{\partial y}\right ]^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum (x_i-\bar {x})^2 \left ( \frac{\partial f}{\partial x}\right )^2}{N} + \frac{\sum (y_i-\bar {y})^2 \left ( \frac{\partial f}{\partial y}\right )^2}{N} + 2 \frac{\sum (x_i-\bar {x}) \left ( \frac{\partial f}{\partial x} \right ) (y_i-\bar {y}) \left ( \frac{\partial f}{\partial y}\right )}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \sigma_x^2 \left ( \frac{\partial f}{\partial x}\right )^2 + \sigma_y^2\left ( \frac{\partial f}{\partial y}\right )^2 + 2 \sigma_{x,y}^2 \left ( \frac{\partial f}{\partial x} \right )  \left ( \frac{\partial f}{\partial y}\right ) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma_{x,y}^2 = \frac{\sum (x_i-\bar {x}) (y_i-\bar {y}) }{N} \equiv&amp;lt;/math&amp;gt; Covariance&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above can be reproduced for functions with multiple variables.&lt;br /&gt;
&lt;br /&gt;
=Instrumental and Statistical Uncertainties=&lt;br /&gt;
&lt;br /&gt;
http://www.physics.uoguelph.ca/~reception/2440/StatsErrorsJuly26-06.pdf&lt;br /&gt;
==Counting Experiment Example==&lt;br /&gt;
&lt;br /&gt;
The table below reports 8 measurements of the coincidence rate observed by two scintillators detecting cosmic rays.  The scintillator are place a distance (x) away from each other in order to detect cosmic rays falling on the earth's surface.  The time and observed coincidence counts are reported in separate columns as well as the angle made by the normal to the detector with the earths surface.  &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;5&amp;quot;&lt;br /&gt;
! Date || Time (hrs) ||  &amp;lt;math&amp;gt;\theta&amp;lt;/math&amp;gt; ||Coincidence Counts || Mean Coinc/Hr  || &amp;lt;math&amp;gt;\sigma_{Poisson} = \sqrt{\mbox{Mean Counts/Hr}}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;\left | \sigma \right |&amp;lt;/math&amp;gt; from Mean&lt;br /&gt;
|-&lt;br /&gt;
|9/12/07 || 20.5 || 30|| 2233 || 109 || 10.4 ||1&lt;br /&gt;
|-&lt;br /&gt;
|9/14/07 || 21 || 30 || 1582 || 75 || 8.7||2&lt;br /&gt;
|-&lt;br /&gt;
|10/3/07 || 21 || 30 || 2282 || 100 || 10.4||1&lt;br /&gt;
|-&lt;br /&gt;
|10/4/07 || 21 || 30 || 2029 || 97 ||  9.8|| 0.1&lt;br /&gt;
|-&lt;br /&gt;
|10/15/07 || 21 || 30 || 2180 || 100 ||  10|| 0.6&lt;br /&gt;
|-&lt;br /&gt;
|10/18/07 || 21 ||  30 || 2064 || 99 || 9.9||0.1&lt;br /&gt;
|-&lt;br /&gt;
| 10/23/07 || 21 || 30 || 2003 || 95 || 9.8||0.2&lt;br /&gt;
|-&lt;br /&gt;
| 10/26/07 || 21 || 30 || 1943 || 93 || 9.6 || 0.5&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The average count rate for a given trial is given in the 5th column by diving column 4 by column 2.  &lt;br /&gt;
&lt;br /&gt;
One can expect a Poisson parent distribution because the probability of a cosmic ray interacting with the scintillator is low.  The variance of measurement in each trial is related to the counting rate by &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 = \mu =&amp;lt;/math&amp;gt; average counting rate&lt;br /&gt;
&lt;br /&gt;
as a result of the assumption that the parent distribution is Poisson.  The value of this &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is shown in column 6.&lt;br /&gt;
&lt;br /&gt;
; Is the Poisson distribution the parent distribution in this experiment?&lt;br /&gt;
&lt;br /&gt;
To try and answer the above question lets determine the mean and variance of the data:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{x} =\frac{\sum CPM_i}{8} = 96.44&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;s = \sqrt{\frac{\sum (x_i-\mu)^2}{8-1}} = 10.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you approximate the Poisson distribution by a Gaussian then the probability any one measurement is within 1 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; of the mean is  68% = Probability that  a measurement of a Gaussian variant will lie within 1 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; of the mean.  For the Poisson distribution with a mean of 97 you would have 66% of the data occur within 1 &amp;lt;math&amp;gt;\sigma = \sqrt{97}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root [26] ROOT::Math::poisson_cdf(97-sqrt(97),97)&lt;br /&gt;
(double)1.67580969302001004e-01&lt;br /&gt;
root [30] 1-2*ROOT::Math::poisson_cdf(97-sqrt(97),97)        &lt;br /&gt;
(const double)6.64838061395997992e-01&lt;br /&gt;
&lt;br /&gt;
root [28] ROOT::Math::normal_cdf(97-sqrt(97),sqrt(97),97)&lt;br /&gt;
(double)1.58655253931457185e-01&lt;br /&gt;
root [29] 1-2*ROOT::Math::normal_cdf(97-sqrt(97),sqrt(97),97)&lt;br /&gt;
(const double)6.82689492137085630e-01&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The 7th column above identifies how many sigma the mean of that trial is from the average &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= 0.68 * 8 = 5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Looks like we have 7/8  events within 1&amp;lt;math&amp;gt; \sigma&amp;lt;/math&amp;gt; = 87.5%  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
How about the average sigma assuming poisson?&lt;br /&gt;
&lt;br /&gt;
If you take the average of sigma estimate in column 6 you would get&lt;br /&gt;
:&amp;lt;math&amp;gt;\overline{\sigma(Poisson)} = \frac{\sum \sigma_i(Poisson)}{8} = 9.86&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using this one can calculate the variance of the variance as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum \left ( \sigma_i(Poisson) - \overline{\sigma(Poisson)}\right)^2}{8-1} = (0.56)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
comparing the &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; from the 8 trials to the &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; from the Poisson estimate you have&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;10.9 = 9.9 \pm 0.56&amp;lt;/math&amp;gt; In agreement within 2 &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What is really required however is an estimate of the probability that the assumption of a Poisson distribution is correct (Hypothesis test).  This will be the subject of future sections.&lt;br /&gt;
&lt;br /&gt;
=== Error Propagation===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;f = \bar{x} = \frac{\sum x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial f}{\partial x_i} = \frac{1}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\delta f = \frac{\partial f}{\partial x_1}\sigma_{x_1} + \frac{\partial f}{\partial x_2}\sigma_{x_2} + \cdots \frac{\partial f}{\partial x_n}\sigma_{x_n}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} + \frac{\partial f}{\partial x_2}\sigma_{x_2} + \cdots \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} \right )^2 +  \left ( \frac{\partial f}{\partial x_2}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2 +   2 \left ( \frac{\partial^2 f}{\partial x_1\partial x_2} \right) \sigma_{x_1}\sigma_{x_2}  + \cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial^2 f}{\partial x_i\partial x_j} = \frac{\partial }{\partial x_j} \frac{1}{N} = 0 \Rightarrow&amp;lt;/math&amp;gt; no Covariances&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{\partial f}{\partial x_1}\sigma_{x_1} \right )^2 +  \left ( \frac{\partial f}{\partial x_2}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{\partial f}{\partial x_n}\sigma_{x_n} \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt; = \left ( \frac{1}{N} \sigma_{x_1} \right )^2 +  \left ( \frac{1}{N}\sigma_{x_2} \right )^2 + \cdots   \left ( \frac{1}{N}\sigma_{x_n} \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If&lt;br /&gt;
:&amp;lt;math&amp;gt; \sigma_i = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\left ( \delta f \right)^2 = \left ( \frac{1}{N} \sigma \right )^2 +  \left ( \frac{1}{N}\sigma \right )^2 + \cdots   \left ( \frac{1}{N}\sigma \right )^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=\frac{ \sigma^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Does this mean that we get an infinitely precise measurement if &amp;lt;math&amp;gt;N \rightarrow \infty&amp;lt;/math&amp;gt;?&lt;br /&gt;
: No!  In reality there are systematic errors in every experiment so the best you can do is reduce your statistical precision to a point where the systematic errors dominate.  There is also the observation that in practice it is difficult to find an experiment absent of  &amp;quot;non-statistical fluctuations&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Example: Table Area=&lt;br /&gt;
&lt;br /&gt;
A quantity which is calculated using  quantities with known uncertainties will have an uncertainty based upon the uncertainty of the quantities used in the calculation.&lt;br /&gt;
&lt;br /&gt;
To determine the uncertainty in a quantity which is a function of other quantities, you can consider the dependence of these quantities in terms of a tayler expansion&lt;br /&gt;
&lt;br /&gt;
Consider a calculation of a Table's Area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A= L \times W&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mean that the Area (A) is a function of the Length (L) and the Width (W) of the table.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A = f(L,W)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can write the variance of the area&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2_A = \frac{\sum_{i=1}^{i=N} (A_i - \bar{A})^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L})  \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} + (W-\bar W) \frac{\partial A}{\partial W} \bigg |_{\bar L \bar WW} \right] ^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L})  \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} \right ] ^2}{N} + \frac{\sum_{i=1}^{i=N} \left [ (W-\bar W) \frac{\partial A}{\partial W} \bigg |_{\bar L \bar W} \right] ^2  }{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;+2  \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L}) (W-\bar W) \frac{\partial A}{\partial L} \bigg |_{\bar L \bar W} \frac{\partial A}{\partial W} \bigg |_{\bar L \bar W} \right]^2}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sigma^2_L \left ( \frac{\partial A}{\partial L} \right )^2 +\sigma^2_W \left ( \frac{\partial A}{\partial W} \right )^2 + 2 \sigma^2_{LW} \frac{\partial A}{\partial L}  \frac{\partial A}{\partial W} &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma^2_{LW} = \frac{\sum_{i=1}^{i=N} \left [ (L-\bar{L}) (W-\bar W) \right ]^2}{N}&amp;lt;/math&amp;gt; is defined as the '''Covariance''' between &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;W&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
= Weighted Mean and variance =&lt;br /&gt;
&lt;br /&gt;
The variance &amp;lt;math&amp;gt;(\sigma)&amp;lt;/math&amp;gt; in the above examples was assumed to be the same for all measurement from the parent distribution.&lt;br /&gt;
&lt;br /&gt;
What happens when you wish to combine measurements with unequal variances (different experiments measuring the same quantity)?&lt;br /&gt;
&lt;br /&gt;
== Weighted Mean==&lt;br /&gt;
&lt;br /&gt;
Let's assume we have a measured quantity having a mean &amp;lt;math&amp;gt; X&amp;lt;/math&amp;gt;   from a Gaussian parent distribution.&lt;br /&gt;
&lt;br /&gt;
If you attempt to measure X with several different experiments you will likely have a series of results which vary in their precision.&lt;br /&gt;
&lt;br /&gt;
Lets assume you have 2 experiments which obtained the averages &amp;lt;math&amp;gt;X_A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;X_B&amp;lt;/math&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we assume that each measurement is governed by a Gaussian distribution,&lt;br /&gt;
&lt;br /&gt;
Then the probability of one experiment observing the value X_A is given by&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_A) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_A-X}{\sigma_A}\right )^2}}{\sigma_A}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
similarly the probability of the other experiment observing the average X_B is &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_B) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_B-X}{\sigma_B}\right )^2}}{\sigma_B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the combined probability that the first experiment measures the average &amp;lt;math&amp;gt;X_A&amp;lt;/math&amp;gt; and the second &amp;lt;math&amp;gt;X_B&amp;lt;/math&amp;gt; is given as the product of the two probabilities suth that &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x=X_A,X_B) \propto \frac{e^{-\frac{1}{2} \left ( \frac{X_A-X}{\sigma_A}\right )^2}}{\sigma_A} \frac{e^{-\frac{1}{2} \left ( \frac{X_B-X}{\sigma_B}\right )^2}}{\sigma_B} = \frac{e^{-\frac{1}{2}\left [  \left ( \frac{X_A-x}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2\right ]}}{\sigma_A \sigma_B}\equiv \frac{e^{-\frac{1}{2}\left [  \chi^2\right ]}}{\sigma_A \sigma_B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \chi^2 \equiv \left ( \frac{X_A-X}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;The principle of maximum likelihood (to be the cornerstone of hypothesis testing) may be written as&lt;br /&gt;
:The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observing is a maximum.&lt;br /&gt;
&lt;br /&gt;
Applying this principle to the two experiments means that the best estimate of &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; is made when &amp;lt;math&amp;gt;P(x=X_A,X_B)&amp;lt;/math&amp;gt; is a maximum which occurs when &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \chi^2 \equiv \left ( \frac{X_A-X}{\sigma_A}\right )^2+\left ( \frac{X_B-X}{\sigma_B}\right )^2 = &amp;lt;/math&amp;gt;Minimum&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\partial \chi^2}{\partial X} =2 \left ( \frac{X_A-X}{\sigma_A^2}\right )(-1)+2 \left ( \frac{X_B-X}{\sigma_B^2}\right )(-1)= 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow X = \frac{\frac{X_A}{\sigma_A^2} + \frac{X_B}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If each observable (&amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt;)  is accompanied by an estimate of the uncertainty in that observable (&amp;lt;math&amp;gt;\sigma_i&amp;lt;/math&amp;gt;) then the weighted mean is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{x} = \frac{ \sum_{i=1}^{i=n} \frac{x_i}{\sigma_i^2}}{\sum_{i=1}^{i=n} \frac{1}{\sigma_i^2}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Weighted Variance==&lt;br /&gt;
&lt;br /&gt;
To determine the variance of the measurements you should follow the Taylor series based prescription denoted above in that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \sum \sigma_i^2 \left ( \frac{\partial X}{\partial X_i}\right)^2 = \sigma_A^2\left ( \frac{\partial X}{\partial X_A}\right)^2 + \sigma_B^2\left ( \frac{\partial X}{\partial X_B}\right)^2&amp;lt;/math&amp;gt; : Assuming no covariance&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\partial X}{\partial X_A} = \frac{\partial}{\partial X_A}  \frac{\frac{X_A}{\sigma_A^2} + \frac{X_B}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} = \frac{\frac{1}{\sigma_A^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 =\sigma_A^2 \left ( \frac{\frac{1}{\sigma_A^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} \right)^2 + \sigma_B^2 \left ( \frac{\frac{1}{\sigma_B^2}}{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}} \right)^2&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\frac{1}{\sigma_A^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}  + \frac{\frac{1}{\sigma_B^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2}}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{1}{(\frac{1}{\sigma_A^2} + \frac{1}{\sigma_B^2})}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variance of the distribution is defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{1}{\sigma^2} = \sum_{i=1}^{i=n} \frac{1}{\sigma_i^2}&amp;lt;/math&amp;gt; = weighted variance&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences] [[Forest_Error_Analysis_for_the_Physical_Sciences]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=Forest_ErrAna_StatDist&amp;diff=91110</id>
		<title>Forest ErrAna StatDist</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=Forest_ErrAna_StatDist&amp;diff=91110"/>
		<updated>2014-01-31T20:32:03Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Arithmetic Mean and variance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Parent Distribution==&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; represent our ith attempt to measurement the quantity &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Due to the random errors present in any experiment we should not expect &amp;lt;math&amp;gt;x_i = x&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we neglect systematic errors, then we should expect &amp;lt;math&amp;gt; x_i&amp;lt;/math&amp;gt; to, on average, follow some probability distribution around the correct value &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This probability distribution can be referred to as the &amp;quot;parent population&amp;quot;.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Average and Variance ==&lt;br /&gt;
===Average===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The word &amp;quot;average&amp;quot; is used to describe a property of a &amp;quot;parent&amp;quot; probability distribution or a set of observations/measurements made in an experiment which gives an indication of a likely outcome of an experiment.&lt;br /&gt;
&lt;br /&gt;
The symbol&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is usually used to represent the &amp;quot;mean&amp;quot; of a known probability (parent) distribution (parent mean) while the &amp;quot;average&amp;quot; of a set of observations/measurements is denoted as &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and is commonly referred to as the &amp;quot;sample&amp;quot; average or &amp;quot;sample mean&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Definition of the mean&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu \equiv \lim_{N\rightarrow \infty} \frac{\sum x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here the above average of a parent distribution is defined in terms of an infinite sum of observations (x_i) of an observable x divided by the number of observations.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; is a calculation of the mean using a finite number of observations&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \bar{x} \equiv  \frac{\sum x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This definition uses the assumption that the result of an experiment, measuring a sample average of &amp;lt;math&amp;gt;(\bar{x})&amp;lt;/math&amp;gt;, asymptotically approaches the &amp;quot;true&amp;quot; average of the parent distribution &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
===Variance===&lt;br /&gt;
&lt;br /&gt;
The word &amp;quot;variance&amp;quot; is used to describe a property of a probability distribution or a set of observations/measurements made in an experiment which gives an indication how much an observation will deviate from and average value.&lt;br /&gt;
&lt;br /&gt;
A deviation &amp;lt;math&amp;gt;(d_i)&amp;lt;/math&amp;gt; of any measurement &amp;lt;math&amp;gt;(x_i)&amp;lt;/math&amp;gt; from a parent distribution with a mean &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; can be defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;d_i\equiv x_i - \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the deviations should average to ZERO for an infinite number of observations by definition of the mean.&lt;br /&gt;
&lt;br /&gt;
Definition of the average&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu \equiv \lim_{N\rightarrow \infty} \frac{\sum x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\lim_{N\rightarrow \infty} \frac{\sum (x_i - \mu)}{N}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \left ( \lim_{N\rightarrow \infty} \frac{\sum (x_i }{N}\right ) - \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \left ( \lim_{N\rightarrow \infty} \frac{\sum (x_i }{N}\right ) - \lim_{N\rightarrow \infty} \frac{\sum x_i}{N} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But the AVERAGE DEVIATION &amp;lt;math&amp;gt;(\bar{d})&amp;lt;/math&amp;gt; is given by an average of the magnitude of the deviations given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{d} = \lim_{N\rightarrow \infty} \frac{\sum \left | (x_i - \mu)\right |}{N}&amp;lt;/math&amp;gt; = a measure of the dispersion of the expected observations about the mean&lt;br /&gt;
&lt;br /&gt;
Taking the absolute value though is cumbersome when performing a statistical analysis so one may express this dispersion in terms of the variance&lt;br /&gt;
&lt;br /&gt;
A typical variable used to denote the variance is&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and is defined as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \lim_{N\rightarrow \infty}\left [ \frac{\sum (x_i-\mu)^2 }{N}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Standard Deviation====&lt;br /&gt;
&lt;br /&gt;
The standard deviation is defined as the square root of the variance&lt;br /&gt;
&lt;br /&gt;
:S.D. = &amp;lt;math&amp;gt;\sqrt{\sigma^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The mean should be thought of as a parameter which characterizes the observations we are making in an experiment.  In general the mean specifies the probability distribution that is representative of the observable we are trying to measure through experimentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The variance characterizes the uncertainty associated with our experimental attempts to determine the &amp;quot;true&amp;quot; value.  Although the mean and true value may not be equal, their difference should be less than the uncertainty given by the governing probability distribution.&lt;br /&gt;
&lt;br /&gt;
==== Another Expression for Variance====&lt;br /&gt;
&lt;br /&gt;
Using the definition of variance (omitting the limit as &amp;lt;math&amp;gt;n \rightarrow \infty&amp;lt;/math&amp;gt;) &lt;br /&gt;
;Evaluating the definition of variance: &amp;lt;math&amp;gt;\sigma^2 \equiv \frac{\sum(x_i-\mu)^2}{N} = \frac{\sum (x_i^2 -2x_i \mu + \mu^2)}{N} = \frac{\sum x_i^2}{N} - 2 \mu \frac{\sum x_i}{N} + \frac{N \mu^2}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \frac{\sum x_i^2}{N} -2 \mu^2 + \mu^2 =\frac{\sum x_i^2}{N} - \mu^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum(x_i-\mu)^2}{N}  =\frac{\sum x_i^2}{N} - \mu^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can recast the above in terms of expectation value where &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E[x] \equiv \sum x_i P_x(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \sigma^2 = E[(x-\mu)^2] = \sum_{x=0}^n (x_i - \mu)^2 P(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= E[x^2] - \left ( E[x]\right )^2 = \sum_{x=0}^n x_i^2 P(x_i) - \left ( \sum_{x=0}^n x_i P(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Average for an unknown probability distribution (parent population)==&lt;br /&gt;
&lt;br /&gt;
If the &amp;quot;Parent Population&amp;quot; is not known, you are just given a list of numbers with no indication of the probability distribution that they were drawn from, then the average and variance may be calculate as shown below.&lt;br /&gt;
&lt;br /&gt;
===Arithmetic Mean and variance===&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; observables are mode in an experiment then the arithmetic mean of those observables is defined as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{x} = \frac{\sum_{i=1}^{i=N} x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;unbiased&amp;quot; variance of the above sample is defined as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;s^2 = \frac{\sum_{i=1}^{i=N} (x_i - \bar{x})^2}{N-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;If you were told that the average is &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; then you can calculate the &lt;br /&gt;
&amp;quot;true&amp;quot;  variance of the above sample as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \frac{\sum_{i=1}^{i=N} (x_i - \bar{x})^2}{N}&amp;lt;/math&amp;gt; = RMS Error= Root Mean Squared Error&lt;br /&gt;
&lt;br /&gt;
;Note:RMS = Root Mean Square = &amp;lt;math&amp;gt;\frac{\sum_i^n x_i^2}{N}&amp;lt;/math&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
==== Statistical Variance decreases with  N====&lt;br /&gt;
&lt;br /&gt;
The repetition of an experiment can decrease the STATISTICAL error of the experiment&lt;br /&gt;
&lt;br /&gt;
Consider the following:&lt;br /&gt;
&lt;br /&gt;
The average value of the mean of a sample of n observations drawn from the parent population is the same as the average value of each observation.  (The average of the averages  is the same as one of the averages)&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\bar{x} = \frac{\sum x_i}{N} =&amp;lt;/math&amp;gt; sample mean&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\overline{\left ( \bar{x} \right ) } = \frac{\sum{\bar{x}_i}}{N} =\frac{1}{N} N \bar{x_i} = \bar{x}&amp;lt;/math&amp;gt; if all means are the same&lt;br /&gt;
&lt;br /&gt;
This is the reason why the sample mean is a measure of the population average ( &amp;lt;math&amp;gt;\bar{x} \sim \mu&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Now consider the variance of the average of the averages (this is not the variance of the individual measurements but the variance of their means)&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2_{\bar{x}} = \frac{\sum \left (\bar{x} -\overline{\left ( \bar{x} \right ) }  \right )^2}{N} =\frac{\sum \bar{x_i}^2}{N}  -\left( \overline{\left ( \bar{x} \right ) }  \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{\sum \bar{x_i}^2}{N}  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{\sum \left( \sum \frac{x_i}{N}\right)^2}{N}  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2}\frac{\sum \left( \sum x_i\right)^2}{N}  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2}\frac{\sum \left (\sum x_i^2 + \sum_{i \ne j} x_ix_j \right )}{N}  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2} \left [ \frac{\sum \left(\sum x_i^2 \right)}{N}  + \frac{ \sum \left (\sum_{i \ne j} x_ix_j \right )}{N} \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;If the measurements are all independent&lt;br /&gt;
:Then &amp;lt;math&amp;gt; \frac{\sum_{i \ne j} x_i x_j}{N} = \frac{\sum x_i}{N} \frac{ \sum x_j}{N}&amp;lt;/math&amp;gt; : if &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; is independent of &amp;lt;math&amp;gt;x_j&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;i \ne j&amp;lt;/math&amp;gt;)&lt;br /&gt;
:&amp;lt;math&amp;gt;= \left ( \frac{\sum x_i}{N} \right)^2 = \bar{x}^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
example:&lt;br /&gt;
:(x_1x_2 + x_1x_3 + x_2x_1+x_2x_3+x_3x_1+x_3x_2+ ...) = (x_1+x_2+x_3)&lt;br /&gt;
 The above part of the proof needs work&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2_{\bar{x}}=\frac{1}{N^2} \left [ \frac{\sum \left(\sum x_i^2 \right)}{N}  + \sum_{i \ne j} \bar{x}^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I use the expression &amp;lt;math&amp;gt;\sigma^2 = E[x^2] - \left ( E[x] \right)^2&amp;lt;/math&amp;gt;  again, except for&amp;lt;math&amp;gt; x_i&amp;lt;/math&amp;gt; and not &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; and turn it around so&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\left(\sum x_i^2 \right)}{N} = \sigma^2 + \left ( \frac{\sum x_i}{N}\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now I have&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2_{\bar{x}}=\frac{1}{N^2} \left [ \sum \left (\sigma^2 +  \left ( \frac{\sum x_i}{N} \right )^2 \right )+ \sum_{i \ne j} \bar{x}^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2} \left [ N\sigma^2 +  N\left ( \frac{\sum x_i}{N} \right )^2 + \sum_{i \ne j} \bar{x}^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2} \left [ N\sigma^2 +  N\left ( \frac{\sum x_i}{N} \right )^2 + N(N-1) \bar{x}^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt; Number of cross terms is N*(N-1)&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2} \left [ N\sigma^2 +  N\left ( \frac{\sum x_i}{N} \right )^2 + (N^2 -N) \left ( \frac{\sum x_i}{N} \right )^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt; Number of cross terms is N*(N-1)&lt;br /&gt;
:&amp;lt;math&amp;gt;= \left [ \frac{\sigma^2}{N} +  \left ( \frac{\sum x_i}{N} \right )^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;= \left [ \frac{\sigma^2}{N} +  \left (  \bar{x}\right )^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sigma^2}{N} &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above is the essence of counting statistics.&lt;br /&gt;
&lt;br /&gt;
It says that the STATISTICAL error in an experiment decreases as a function of &amp;lt;math&amp;gt;\frac{1}{\sqrt N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Biased and Unbiased variance====&lt;br /&gt;
&lt;br /&gt;
Where does this idea of an unbiased variance come from?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using the same procedure as the previous section let's look at the average variance of the variances.&lt;br /&gt;
&lt;br /&gt;
A sample variance of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; measurements of &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; is&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_n^2 = \frac{\sum(x_i-\bar{x})^2}{n} = E[x^2] - \left ( E[x] \right)^2 = \frac{\sum x_i^2}{n} -\left ( \bar{x} \right)^2&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To determine the &amp;quot;true&amp;quot; variance consider taking average of several sample variances (this is the same argument used above which let to &amp;lt;math&amp;gt;\overline{(\bar{x})} = \bar{x}&amp;lt;/math&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum \sigma_i^2}{N} = E[\sigma^2] - \left ( E[\sigma] \right)^2 = \frac{ \sum_j \left [ \frac{\sum_i x_i^2}{n} -\left ( \bar{x} \right)^2 \right ]_j}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{1}{n}\sum_i \left ( \frac{\sum_j x_j^2}{N} \right )_i - \frac {\sum_j \left ( \bar{x} \right)^2 }{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{1}{n}\sum_i \left ( \frac{\sum_j x_j^2}{N} \right )_i - \left [ \left ( \frac {\sum_j \bar{x}}{N} \right)^2  + \sigma_{\bar{x}}^2\right ]&amp;lt;/math&amp;gt;  :  as shown previously      &amp;lt;math&amp;gt;E[\bar{x}^2] = \left ( E[\bar{x}] \right )^2 + \sigma_{\bar{x}}^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{1}{n}\sum_i \left ( \left [ \left (\frac{\sum_j x_j}{N}\right)^2 + \sigma^2 \right ]\right )_i - \left [ \left ( \frac {\sum_j x_j}{N} \right)^2  + \frac{\sigma^2}{n}\right ]&amp;lt;/math&amp;gt; : also shown previously&amp;lt;math&amp;gt;\overline{\left ( \bar{x} \right ) } =  \bar{x}&amp;lt;/math&amp;gt;  the universe average is the same as the sample average&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{1}{n} \left ( n\left [ \left (\frac{\sum_j x_j}{N}\right)^2 + n\sigma^2 \right ]\right )_i - \left [ \left ( \frac {\sum_j x_j}{N} \right)^2  + \frac{\sigma^2}{n}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 - \frac{\sigma^2}{n}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{n-1}{n}\sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \sigma^2 = \frac{n}{n-1}\frac{\sum \sigma_i^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 =&amp;lt;/math&amp;gt; the sample variance&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum \sigma_i^2}{N} =&amp;lt;/math&amp;gt; an average of all possible sample variance which should be equivalent to the &amp;quot;true&amp;quot; population variance.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \frac{\sum \sigma_i^2}{N} \sim \sum \frac{x_i-\bar{x}}{n}&amp;lt;/math&amp;gt; : if all the variances are the same this would be equivalent&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 = \frac{n}{n-1}\frac{\sum(x_i-\bar{x})}{n}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\sum(x_i-\bar{x})}{n-1} =&amp;lt;/math&amp;gt; unbiased sample variance&lt;br /&gt;
&lt;br /&gt;
==Probability Distributions==&lt;br /&gt;
&lt;br /&gt;
=== Mean(Expectation value) and variance===&lt;br /&gt;
====Mean of Discrete Probability Distribution====&lt;br /&gt;
&lt;br /&gt;
In the case that you know the probability distribution you can calculate the mean&amp;lt;math&amp;gt; (\mu)&amp;lt;/math&amp;gt; or expectation value E(x) and standard deviation as&lt;br /&gt;
&lt;br /&gt;
For a Discrete probability distribution&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = E[x]=\lim_{N \rightarrow \infty} \frac{\sum_{i=1}^n x_i N P(x_i)}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;N=&amp;lt;/math&amp;gt; number of observations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;n=&amp;lt;/math&amp;gt; number of different possible observable variables&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x_i =&amp;lt;/math&amp;gt; ith observable quantity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(x_i) =&amp;lt;/math&amp;gt; probability of observing &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; = Probability Mass Distribution for a discrete probability distribution&lt;br /&gt;
&lt;br /&gt;
====Mean of a continuous probability distibution====&lt;br /&gt;
The average (mean) of a sample drawn from any probability distribution is defined in terms of the expectation value E(x) such that&lt;br /&gt;
&lt;br /&gt;
The expectation value for a  continuous probability distribution  is calculated as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\mu = E(x) = \int_{-\infty}^{\infty} x P(x)dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variance===&lt;br /&gt;
&lt;br /&gt;
==== Variance of a discrete PDF====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma^2 = \sum_{i=1}^n \left [ (x_i - \mu)^2 P(x_i)\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variance of a Continuous PDF ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma^2 = \int_{-\infty}^{\infty} \left [ (x - \mu)^2 P(x)\right ]dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Expectation of Arbitrary function====&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;f(x)&amp;lt;/math&amp;gt; is an arbitrary function of a variable &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; governed by a probability distribution &amp;lt;math&amp;gt;P(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then the expectation value of &amp;lt;math&amp;gt;f(x)&amp;lt;/math&amp;gt; is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E[f(x)] = \sum_{i=1}^N f(x_i) P(x_i) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
or if a continuous distribtion&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E[f(x)] = \int_{-\infty}^{\infty} f(x) P(x)dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Uniform===&lt;br /&gt;
&lt;br /&gt;
The Uniform probability distribution function is a continuous probability function over a specified interval in which any value within the interval has the same probability of occurring.&lt;br /&gt;
&lt;br /&gt;
Mathematically the uniform distribution over an interval from a to b is given by&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_U(x) =\left \{  {\frac{1}{b-a} \;\;\;\; x &amp;gt;a \mbox{ and } x &amp;lt;b \atop 0 \;\;\;\; x&amp;gt;b \mbox{ or } x &amp;lt; a} \right .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Mean of Uniform PDF====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = \int_{-\infty}^{\infty} xP_U(x)dx = \int_{a}^{b} \frac{x}{b-a} dx = \left . \frac{x^2}{2(b-a)} \right |_a^b = \frac{1}{2}\frac{b^2 - a^2}{b-a} = \frac{1}{2}(b+a)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Variance of Uniform PDF====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \int_{-\infty}^{\infty} (x-\mu)^2 P_U(x)dx = \int_{a}^{b} \frac{\left (x-\frac{b+a}{2}\right )^2}{b-a} dx = \left . \frac{(x -\frac{b+a}{2})^3}{3(b-a)} \right |_a^b &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{3(b-a)}\left [ \left (b -\frac{b+a}{2} \right )^3 - \left (a -\frac{b+a}{2} \right)^3\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{3(b-a)}\left [ \left (\frac{b-a}{2} \right )^3 - \left (\frac{a-b}{2} \right)^3\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{24(b-a)}\left [ (b-a)^3 - (-1)^3 (b-a)^3\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{12}(b-a)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now use ROOT to generate uniform distributions.&lt;br /&gt;
http://wiki.iac.isu.edu/index.php/TF_ErrAna_InClassLab#Day_3&lt;br /&gt;
&lt;br /&gt;
===Binomial Distribution===&lt;br /&gt;
&lt;br /&gt;
Binomial random variable describes experiments in which the outcome has only 2 possibilities.   The two possible outcomes can be labeled as &amp;quot;success&amp;quot; or &amp;quot;failure&amp;quot;. The probabilities may be defined as &lt;br /&gt;
&lt;br /&gt;
;p&lt;br /&gt;
: the probability of a success&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
;q&lt;br /&gt;
:the probability of a failure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we let &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; represent the number of successes after repeating the experiment &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; times&lt;br /&gt;
&lt;br /&gt;
Experiments with &amp;lt;math&amp;gt;n=1&amp;lt;/math&amp;gt; are also known as Bernoulli trails.&lt;br /&gt;
&lt;br /&gt;
Then &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; is the Binomial random variable with parameters &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The number of ways in which the &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; successful outcomes can be organized in &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; repeated  trials is&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{n !}{ \left [ (n-x) ! x !\right ]}&amp;lt;/math&amp;gt;  where the &amp;lt;math&amp;gt; !&amp;lt;/math&amp;gt; denotes a factorial such that &amp;lt;math&amp;gt;5! = 5\times4\times3\times2\times1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The expression is known as the binomial coefficient and is represented as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;{n\choose x}=\frac{n!}{x!(n-x)!}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of any one ordering of the success and failures is given by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P( \mbox{experimental ordering}) = p^{x}q^{n-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This means the probability of getting exactly k successes after n trials is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_B(x) = {n\choose x}p^{x}q^{n-x} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Mean====&lt;br /&gt;
&lt;br /&gt;
It can be shown that the Expectation Value of the distribution is&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = n p&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = \sum_{x=0}^n x P_B(x) = \sum_{x=0}^n x \frac{n!}{x!(n-x)!} p^{x}q^{n-x}&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt; =  \sum_{x=1}^n  \frac{n!}{(x-1)!(n-x)!} p^{x}q^{n-x}&amp;lt;/math&amp;gt;  :summation starts from x=1 and not x=0 now&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np \sum_{x=1}^n  \frac{(n-1)!}{(x-1)!(n-x)!} p^{x-1}q^{n-x}&amp;lt;/math&amp;gt;  :factor out &amp;lt;math&amp;gt;np&amp;lt;/math&amp;gt; : replace n-1 with m everywhere and it looks like binomial distribution&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np \sum_{y=0}^{n-1}  \frac{(n-1)!}{(y)!(n-y-1)!} p^{y}q^{n-y-1}&amp;lt;/math&amp;gt; :change summation index so y=x-1, now n become n-1&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np \sum_{y=0}^{n-1}  \frac{(n-1)!}{(y)!(n-1-y)!} p^{y}q^{n-1-y}&amp;lt;/math&amp;gt; :&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np (q+p)^{n-1}&amp;lt;/math&amp;gt;  :definition of binomial expansion&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np 1^{n-1}&amp;lt;/math&amp;gt;  :q+p =1&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====variance ====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = npq&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Remember: &amp;lt;math&amp;gt;\frac{\sum(x_i-\mu)^2}{N} = \frac{\sum (x_i^2 -2x_i \mu + \mu^2)}{N} = \frac{\sum x_i^2}{N} - 2 \mu \frac{\sum x_i}{N} + \frac{N \mu^2}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \frac{\sum x_i^2}{N} -2 \mu^2 + \mu^2 =\frac{\sum x_i^2}{N} - \mu^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum(x_i-\mu)^2}{N}  =\frac{\sum x_i^2}{N} - \mu^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \sigma^2 = E[(x-\mu)^2] = \sum_{x=0}^n (x_i - \mu)^2 P_B(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= E[x^2] - \left ( E[x]\right )^2 = \sum_{x=0}^n x_i^2 P_B(x_i) - \left ( \sum_{x=0}^n x_i P_B(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To calculate the variance of the Binomial distribution I will just calculate &amp;lt;math&amp;gt;E[x^2]&amp;lt;/math&amp;gt; and then subtract off &amp;lt;math&amp;gt;\left ( E[x]\right )^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;E[x^2] = \sum_{x=0}^n x^2 P_B(x)&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_{x=1}^n x^2 P_B(x)&amp;lt;/math&amp;gt;   : x=0 term is zero so no contribution&lt;br /&gt;
:&amp;lt;math&amp;gt;=\sum_{x=1}^n x^2 \frac{n!}{x!(n-x)!} p^{x}q^{n-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \sum_{x=1}^n x \frac{(n-1)!}{(x-1)!(n-x)!} p^{x-1}q^{n-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let m=n-1 and y=x-1&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \sum_{y=0}^n (y+1) \frac{m!}{(y)!(m-1-y+1)!} p^{y}q^{m-1-y+1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \sum_{y=0}^n (y+1) P(y)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \left ( \sum_{y=0}^n y P(y) + \sum_{y=0}^n (1) P(y) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \left ( mp + 1 \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \left ( (n-1)p + 1 \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = E[x^2] - \left ( E[x] \right)^2 = np \left ( (n-1)p + 1 \right) - (np)^2 = np(1-p) = npq&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examples===&lt;br /&gt;
&lt;br /&gt;
==== The number of times a coin toss is heads.====&lt;br /&gt;
&lt;br /&gt;
The probability of a coin landing with the head of the coin facing up is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P = \frac{\mbox{number of desired outcomes}}{\mbox{number of possible outcomes}} = \frac{1}{2}&amp;lt;/math&amp;gt; = Uniform distribution with a=0 (tails) b=1 (heads).&lt;br /&gt;
&lt;br /&gt;
Suppose you toss a coin 4 times.  Here are the possible outcomes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;  |cellpadding=&amp;quot;20&amp;quot; cellspacing=&amp;quot;0 &lt;br /&gt;
|order Number&lt;br /&gt;
|colspan= &amp;quot;4&amp;quot; | Trial #&lt;br /&gt;
| # of Heads&lt;br /&gt;
|-&lt;br /&gt;
| || 1|| 2 || 3|| 4 ||&lt;br /&gt;
|-&lt;br /&gt;
|1 ||t || t || t|| t ||0&lt;br /&gt;
|-&lt;br /&gt;
|2||h || t || t|| t ||1&lt;br /&gt;
|-&lt;br /&gt;
|3||t || h || t|| t ||1&lt;br /&gt;
|-&lt;br /&gt;
|4||t || t || h|| t ||1&lt;br /&gt;
|-&lt;br /&gt;
|5||t || t || t|| h ||1&lt;br /&gt;
|-&lt;br /&gt;
|6||h || h || t|| t ||2&lt;br /&gt;
|-&lt;br /&gt;
|7||h || t || h|| t ||2&lt;br /&gt;
|-&lt;br /&gt;
|8||h || t || t|| h||2&lt;br /&gt;
|-&lt;br /&gt;
|9||t || h || h|| t ||2&lt;br /&gt;
|-&lt;br /&gt;
|10||t || h || t|| h ||2&lt;br /&gt;
|-&lt;br /&gt;
|11||t || t || h|| h ||2&lt;br /&gt;
|-&lt;br /&gt;
|12||t|| h || h|| h||3&lt;br /&gt;
|-&lt;br /&gt;
|13||h|| t || h|| h||3&lt;br /&gt;
|-&lt;br /&gt;
|14||h|| h || t|| h||3&lt;br /&gt;
|-&lt;br /&gt;
|15||h|| h || h|| t||3&lt;br /&gt;
|-&lt;br /&gt;
|16||h|| h || h|| h||4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of order #1 happening is&lt;br /&gt;
&lt;br /&gt;
P( order #1) = &amp;lt;math&amp;gt;\left ( \frac{1}{2} \right )^0\left ( \frac{1}{2} \right )^4 = \frac{1}{16}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
P( order #2) = &amp;lt;math&amp;gt;\left ( \frac{1}{2} \right )^1\left ( \frac{1}{2} \right )^3 = \frac{1}{16}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The probability of observing the coin land on heads 3 times out of 4 trials is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(x=3) = \frac{4}{16} = \frac{1}{4} =  {n\choose x}p^{x}q^{n-x}  = \frac{4 !}{ \left [ (4-3) ! 3 !\right ]} \left ( \frac{1}{2}\right )^{3}\left ( \frac{1}{2}\right )^{4-3} = \frac{24}{1 \times 6} \frac{1}{16} = \frac{1}{4}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== A 6 sided die====&lt;br /&gt;
&lt;br /&gt;
A die is a 6 sided cube with dots on each side.  Each side has a unique number of dots with at most 6 dots on any one side.&lt;br /&gt;
&lt;br /&gt;
P=1/6 = probability of landing on any side of the cube.&lt;br /&gt;
&lt;br /&gt;
Expectation value :&lt;br /&gt;
; The expected (average) value for rolling a single die.&lt;br /&gt;
: &amp;lt;math&amp;gt;E({\rm Roll\ With\ 6\ Sided\ Die}) =\sum_i x_i P(x_i) =1 \left ( \frac{1}{6} \right) + 2\left ( \frac{1}{6} \right)+ 3\left ( \frac{1}{6} \right)+ 4\left ( \frac{1}{6} \right)+ 5\left ( \frac{1}{6} \right)+ 6\left ( \frac{1}{6} \right)=\frac{1 + 2 + 3 + 4 + 5 + 6}{6} = 3.5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variance:&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;E({\rm Roll\ With\ 6\ Sided\ Die}) =\sum_i (x_i - \mu)^2 P(x_i)  &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= (1-3.5)^2 \left ( \frac{1}{6} \right) + (2-3.5)^2\left ( \frac{1}{6} \right)+ (3-3.5)^2\left ( \frac{1}{6} \right)+ (4-3.5)^2\left ( \frac{1}{6} \right)+ (5-3.5)^2\left ( \frac{1}{6} \right)+ (6-3.5)^2\left ( \frac{1}{6} \right) =2.92&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i (x_i)^2 P(x_i) - \mu^2 = \left [ 1 \left ( \frac{1}{6} \right) + 4\left ( \frac{1}{6} \right)+ 9\left ( \frac{1}{6} \right)+ 16\left ( \frac{1}{6} \right)+ 25\left ( \frac{1}{6} \right)+ 36\left ( \frac{1}{6} \right) \right ] - (3.5)^3 =2.92&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we roll the die 10 times what is the probability that X dice will show a 6?&lt;br /&gt;
&lt;br /&gt;
A success will be that the die landed with 6 dots face up.&lt;br /&gt;
&lt;br /&gt;
So the probability of this is 1/6 (p=1/6) , we toss it 10 times (n=10) so the binomial distribution function for a success/fail experiment says&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P_B(x)  =  {n\choose x}p^{x}q^{n-x}  = \frac{10 !}{ \left [ (10-x) ! x !\right ]} \left ( \frac{1}{6}\right )^{x}\left ( \frac{5}{6}\right )^{10-x} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So the probability the die will have 6 dots face up in 4/10 rolls is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P_B(x=4)  =  \frac{10 !}{ \left [ (10-4) ! 4 !\right ]} \left ( \frac{1}{6}\right )^{4}\left ( \frac{5}{6}\right )^{10-4} &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; =  \frac{10 !}{ \left [ (6) ! 4 !\right ]} \left ( \frac{1}{6}\right )^{4}\left ( \frac{5}{6}\right )^{6} = \frac{210 \times 5^6}{6^10}=0.054 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mean = np =&amp;lt;math&amp;gt;\mu =  10/6 = 1.67&amp;lt;/math&amp;gt; &lt;br /&gt;
Variance = &amp;lt;math&amp;gt;\sigma^2 = 10 (1/6)(5/6) = 1.38&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Poisson Distribution===&lt;br /&gt;
&lt;br /&gt;
The Poisson distribution is an approximation to the binomial distribution in the event that the probability of a success is quite small &amp;lt;math&amp;gt;(p \ll 1)&amp;lt;/math&amp;gt;.  As the number of repeated observations (n) gets large,  the  binomial distribution becomes more difficult to evaluate because of the leading term&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{n !}{ \left [ (n-x) ! x !\right ]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The poisson distribution overcomes this problem by defining the probability in terms of the average &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x) = \frac{\mu^x e^{-\mu}}{x!}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Poisson as approximation to Binomial====&lt;br /&gt;
&lt;br /&gt;
To drive home the idea that the Poisson distribution approximates a Binomial distribution at small p and large n consider the following derivation&lt;br /&gt;
&lt;br /&gt;
The Binomial Probability Distriubtions is&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_B(x) = \frac{n!}{x!(n-x)!}p^{x}q^{n-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \frac{n!}{(n-x)!} = \frac{(n-x)! (n-x+1) (n-x + 2) \dots (n-1)(n)}{(n-x)!}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= n (n-1)(n-2) \dots (n-x+2) (n-x+1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;IFF &amp;lt;math&amp;gt;x \ll n \Rightarrow&amp;lt;/math&amp;gt; we have x terms above&lt;br /&gt;
:then &amp;lt;math&amp;gt;\frac{n!}{(n-x)!} =n^x&amp;lt;/math&amp;gt;&lt;br /&gt;
:example:&amp;lt;math&amp;gt; \frac{100!}{(100-1)!} = \frac{99! \times 100}{99!} = 100^1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This leave us with &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) = \frac{n^x}{x!}p^{x}q^{n-x}= \frac{(np)^x}{x!}(1-p)^{n-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{(\mu)^x}{x!}(1-p)^{n}(1-p)^{-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;(1-p)^{-x} = \frac{1}{(1-p)^x} = 1+px = 1 : p \ll 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) = \frac{(\mu)^x}{x!}(1-p)^{n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;(1-p)^{n} = \left [(1-p)^{1/p} \right]^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\lim_{p \rightarrow 0} \left [(1-p)^{1/p} \right]^{\mu} = \left ( \frac{1}{e} \right)^{\mu} = e^{- \mu}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
;For  &amp;lt;math&amp;gt;x \ll n&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\lim_{p \rightarrow 0}P_B(x,n,p ) = P_P(x,\mu)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Derivation of Poisson Distribution====&lt;br /&gt;
&lt;br /&gt;
The mean free path of a particle traversing a volume of material is a common problem in nuclear and particle physics.  If you want to shield your apparatus or yourself from radiation you want to know how far the radiation travels through material.  &lt;br /&gt;
&lt;br /&gt;
The mean free path is the average distance a particle travels through a material before interacting with the material. &lt;br /&gt;
;If we let &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; represent the mean free path &lt;br /&gt;
;Then the probability of having an interaction after a distance x is&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{x}{\lambda}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as a result&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;1-\frac{x}{\lambda}= P(0,x, \lambda)&amp;lt;/math&amp;gt; = probability of getting no events after a length dx&lt;br /&gt;
&lt;br /&gt;
When we consider &amp;lt;math&amp;gt;\frac{x}{\lambda} \ll 1&amp;lt;/math&amp;gt; ( we are looking for small distances such that the probability of no interactions is high)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(0,x, \lambda) = e^{\frac{-x}{\lambda}} \approx 1 - \frac{x}{\lambda}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we wish to find the probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; events over a distance &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; given the mean free path.&lt;br /&gt;
&lt;br /&gt;
This is calculated as a joint probability.  If it were the case that we wanted to know the probability of only one interaction over a distance &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.  Then we would want to multiply the probability that an interaction happened after a distance &amp;lt;math&amp;gt;dx&amp;lt;/math&amp;gt; by the probability that no more interactions happen by the time the particle reaches the distance &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
For the case of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; interactions, we have a series of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; interactions happening over N intervals of &amp;lt;math&amp;gt;dx&amp;lt;/math&amp;gt; with the probability &amp;lt;math&amp;gt;dx/\lambda&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
:&amp;lt;math&amp;gt;P(N,x,\lambda)&amp;lt;/math&amp;gt; = probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; events within the length &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{dx_1}{\lambda}\frac{dx_2}{\lambda}\frac{dx_3}{\lambda} \dots \frac{dx_N}{\lambda} e^{\frac{-x}{\lambda}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above expression represents the probability for a particular sequence of events in which an interaction occurs after a distance &amp;lt;math&amp;gt;dx_1&amp;lt;/math&amp;gt; then a interaction after &amp;lt;math&amp;gt;dx_2&amp;lt;/math&amp;gt; , &amp;lt;math&amp;gt;\dots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So in essence the above expression is a &amp;quot;probability element&amp;quot; where another probability element may be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; P(N,x, \lambda)=\frac{dx_2}{\lambda}\frac{dx_1}{\lambda}\frac{dx_3}{\lambda} \dots \frac{dx_N}{\lambda} e^{\frac{-x}{\lambda}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where the first interaction occurs after the distance &amp;lt;math&amp;gt;x_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= \Pi_{i=1}^{N} \left [ \frac{dx_i}{\lambda} \right ] e^{\frac{-x}{\lambda}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So we can write a differential probability element which we need to add up as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;d^NP(N,x, \lambda)=\frac{1}{N!} \Pi_{i=1}^{N} \left [ \frac{dx_i}{\lambda} \right ] e^{\frac{-x}{\lambda}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The N! accounts for the degeneracy in which for every N! permutations there is really only one new combination.  ie we are double counting when we integrate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using the integral formula&lt;br /&gt;
: &amp;lt;math&amp;gt; \Pi_{i=1}^{N} \left [\int_0^x \frac{dx_i}{\lambda} \right ]= \left [ \frac{x}{\lambda}\right]^N&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
we end up with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(N,x, \lambda) = \frac{\left [ \frac{x}{\lambda}\right]^N}{N!} e^{\frac{-x}{\lambda}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Mean of Poisson Dist====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = \sum_{i=1}^{\infty} i P(i,x, \lambda)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_{i=1}^{\infty} i \frac{\left [ \frac{x}{\lambda}\right]^i}{i!} e^{\frac{-x}{\lambda}}&lt;br /&gt;
= \frac{x}{\lambda} \sum_{i=1}^{\infty}  \frac{\left [ \frac{x}{\lambda}\right]^{(i-1)}}{(i-1)!} e^{\frac{-x}{\lambda}} = \frac{x}{\lambda} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x,\mu) = \frac{\mu^x e^{-\mu}}{x!} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Variance of Poisson Dist====&lt;br /&gt;
&lt;br /&gt;
For [http://wiki.iac.isu.edu/index.php/TF_ErrAna_Homework#Poisson_Prob_Dist Homework] you will show, in a manner similar to the above mean calculation, that the variance of the Poisson distribution is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Gaussian===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Gaussian (Normal) distribution is an approximation of the Binomial distribution for the case of a large number of possible different observations.  Poisson approximated the binomial distribution for the case when p&amp;lt;&amp;lt;1 ( the average number of successes is a lot smaller than the number of trials &amp;lt;math&amp;gt;(\mu = np)&amp;lt;/math&amp;gt; ).&lt;br /&gt;
&lt;br /&gt;
The Gaussian distribution is accepted as one of the most likely distributions to describe measurements.&lt;br /&gt;
&lt;br /&gt;
A Gaussian distribution which is normalized such that its integral is unity is refered to as the Normal distribution.  You could mathematically construct a Gaussian distribution which is not normalized to unity (this is often done when fitting experimental data).&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_G(x,\mu, \sigma) = \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{1}{2} \left( \frac{x -\mu}{\sigma} \right) ^2}&amp;lt;/math&amp;gt; = probability of observing &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; from a Gaussian parent distribution with a mean &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; and standard deviation &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Half-Width &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; (a.k.a. Full Width as Half Max)====&lt;br /&gt;
&lt;br /&gt;
The half width &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is used to describe the range of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; through which the distributions amplitude decreases to half of its maximum value.&lt;br /&gt;
&lt;br /&gt;
;ie: &amp;lt;math&amp;gt;P_G(\mu \pm \frac{\Gamma}{2}, \mu, \sigma) = \frac{P_G(\mu,\mu,\sigma)}{2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Side note:the point of steepest descent is located at &amp;lt;math&amp;gt;x \pm \sigma&amp;lt;/math&amp;gt;  such that &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;math&amp;gt;P_G(\mu \pm \sigma, \mu, \sigma) = e^{1/2} P_G(\mu,\mu,\sigma)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Probable Error (P.E.)====&lt;br /&gt;
&lt;br /&gt;
The probable error is the range of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; in which half of the observations (values of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;) are expected to fall.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;math&amp;gt;x= \mu \pm P.E.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Binomial with Large N becomes Gaussian====&lt;br /&gt;
&lt;br /&gt;
Consider the binomial distribution in which a fair coin is tossed a large number of times (N is very large and and EVEN number N=2n)&lt;br /&gt;
&lt;br /&gt;
What is the probability you get exactly &amp;lt;math&amp;gt;\frac{1}{2}N -s&amp;lt;/math&amp;gt; heads and &amp;lt;math&amp;gt;\frac{1}{2}N +s&amp;lt;/math&amp;gt; tails where s is an integer?&lt;br /&gt;
&lt;br /&gt;
The Binomial Probability distribution is given as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_B(x) = {N\choose x}p^{x}q^{N-x}  = \frac{N!}{x!(N-x)!}p^{x}q^{N-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
p = probability of success= 1/2&lt;br /&gt;
&lt;br /&gt;
q= 1-p = 1/2&lt;br /&gt;
&lt;br /&gt;
N = number of trials =2n&lt;br /&gt;
&lt;br /&gt;
x= number of successes=n-s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_B(n-s)   = \frac{2n!}{(n-s)!(2n-n+s)!}p^{n-s}q^{2n-n+s}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{2n!}{(n-s)!(n+s)!}p^{n-s}q^{n+s}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{2n!}{(n-s)!(n+s)!} \left(\frac{1}{2}\right)^{n-s} \left(\frac{1}{2}\right)^{n+s}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{2n!}{(n-s)!(n+s)!} \left(\frac{1}{2}\right)^{2n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now let's cast this probability with respect to the probability that we get an even number of heads and tails by defining the following ratio R such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;R \equiv \frac{P_B(n-s)}{P_B(n)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_B(x=n) = \frac{N!}{n!(N-n)!}p^{n}q^{N-n} = \frac{(2n)!}{n!(n)!}p^{n}q^{n} =  \frac{(2n)!}{(n)!(n)!} \left(\frac{1}{2}\right)^{2n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;R = \frac{\frac{2n!}{(n-s)!(n+s)!} \left(\frac{1}{2}\right)^{2n}}{\frac{(2n)!}{(n)!(n)!} \left(\frac{1}{2}\right)^{2n}} = \frac{n! n!}{(n-s)! (n+s)!}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take the natural logarithm of both sides&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \ln (R) = \ln \left ( \frac{n! n!}{(n-s)! (n+s)!} \right) = \ln(n!)+\ln(n!) - \ln\left[(n-s)!\right ] - \ln \left[(n+s)!\right] = 2 \ln(n!) - \ln\left [ (n-s)! \right ] - \ln \left [ (n+s)! \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stirling's Approximation says&lt;br /&gt;
:&amp;lt;math&amp;gt;n! \sim \left (2 \pi n\right)^{1/2} n^n e^{-n}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow &amp;lt;/math&amp;gt;&lt;br /&gt;
;&amp;lt;math&amp;gt;\ln(n!) \sim  \ln \left [ \left (2 \pi n\right)^{1/2} n^n e^{-n}\right ] = \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ n^{1/2} \right  ] +\ln\left [ n^n \right ] + \ln \left [e^{-n}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ n^{1/2} \right  ] +n\ln\left [ n \right ] + (-n)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ n^{1/2} \right  ] +n(\ln\left [ n \right ] -1 )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
similarly&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\ln\left [(n-s)! \right ] \sim   \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ (n-1)^{1/2} \right  ] + (n-s)(\ln\left [ (n-s) \right ] -1 )&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\ln\left [(n+s)! \right ] \sim   \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ (n+1)^{1/2} \right  ] + (n+s)(\ln\left [ (n+s) \right ] -1 )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \ln (R) = 2 \times  \left (\ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ n^{1/2} \right  ] +n(\ln\left [ n \right ] -1 ) \right ) &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;- \left ( \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ (n-1)^{1/2} \right  ] + (n-s)(\ln\left [ (n-s) \right ] -1 )\right )&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt; -\left ( \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ (n+1)^{1/2} \right  ] + (n+s)(\ln\left [ (n+s) \right ] -1 )\right ) &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2 \ln  \left [ n^{1/2} \right  ] +2 n(\ln\left [ n \right ] -1 )  - \ln  \left [ (n-1)^{1/2} \right  ] - (n-s)(\ln\left [ (n-s) \right ] -1 ) -\ln  \left [ (n+1)^{1/2} \right  ] - (n+s)(\ln\left [ (n+s) \right ] -1 )&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\ln  \left [ n^{1/2} \right  ] = \ln  \left [ (n-1)^{1/2} \right  ]  = \ln  \left [ (n+1)^{1/2} \right  ]&amp;lt;/math&amp;gt; For Large n&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \ln (R) =  2 n(\ln\left [ n \right ] -1 )   - (n-s)(\ln\left [ (n-s) \right ] -1 ) - (n+s)(\ln\left [ (n+s) \right ] -1 )&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; =2 n(\ln\left [ n \right ] -1 )   - (n-s)(\ln\left [ n(1-s/n) \right ] -1 ) - (n+s)(\ln\left [ n(1+s/n) \right ] -1 )&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2n \ln (n) - 2n - (n-s) \left [ \ln (n) + \ln (1-s/n) -1\right ] - (n+s) \left [ \ln (n) + \ln (1+s/n) -1\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  - 2n - (n-s) \left [  \ln (1-s/n) -1\right ] - (n+s) \left [  \ln (1+s/n) -1\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=   - (n-s) \left [  \ln (1-s/n) \right ] - (n+s) \left [  \ln (1+s/n) \right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;-1 &amp;lt; s/n \le 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\ln (1+s/n) = s/n - \frac{s^2}{2n^2} + \frac{s^3}{3 n^3} \dots&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\ln(R) =- (n-s) \left [    -s/n - \frac{s^2}{2n^2} - \frac{s^3}{3 n^3} \right ] - (n+s) \left [   s/n - \frac{s^2}{2n^2} + \frac{s^3}{3 n^3}  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= - \frac{s^2}{n} = - \frac{2s^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;R \sim e^{-2s^2/N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as a result &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(n-s) = R P_B(n)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P_B(x=n)=  \frac{(2n)!}{(n)!(n)!} \left(\frac{1}{2}\right)^{2n} =  \frac{(\left ( \left (2 \pi 2n\right)^{1/2} (2n)^{2n} e^{-2n}\right ) }{\left(\left (2 \pi n\right)^{1/2} n^n e^{-n}\right ) \left ( \left (2 \pi n\right)^{1/2} n^n e^{-n}\right)}  \left(\frac{1}{2}\right)^{2n}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \left(\frac{1}{\pi n} \right )^{1/2} = \left(\frac{2}{\pi N} \right )^{1/2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(n-s) = \left(\frac{2}{\pi N} \right )^{1/2} e^{-2s^2/N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In binomial distributions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma^2 = Npq = \frac{N}{4}&amp;lt;/math&amp;gt; for this problem&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;N = 4 \sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(n-s) = \left(\frac{2}{\pi 4 \sigma^2} \right )^{1/2} e^{-2s^2/N} = \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{2s^2}{4 \sigma^2}}  = \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{1}{2} \left( \frac{s}{\sigma} \right) ^2}&amp;lt;/math&amp;gt; &lt;br /&gt;
= probability of exactly &amp;lt;math&amp;gt;(\frac{N}{2} -s)&amp;lt;/math&amp;gt; heads AND &amp;lt;math&amp;gt;(\frac{N}{2} +s)&amp;lt;/math&amp;gt; tails after flipping the coin N times (N is and even number and s is an integer).&lt;br /&gt;
&lt;br /&gt;
If we let &amp;lt;math&amp;gt;x = n-s&amp;lt;/math&amp;gt;  and realize that  for a binomial distributions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = Np = N/2 = n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(x) = \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{1}{2} \left( \frac{n-x}{\sigma} \right) ^2} = \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{1}{2} \left( \frac{x - \mu}{\sigma} \right) ^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; So when N gets big the Gaussian distribution is a good approximation to the Binomianl&lt;br /&gt;
&lt;br /&gt;
==== Gaussian approximation to Poisson when &amp;lt;math&amp;gt;\mu \gg 1&amp;lt;/math&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(r) = \frac{\mu^r e^{-\mu}}{r!}&amp;lt;/math&amp;gt; = Poisson probability distribution&lt;br /&gt;
&lt;br /&gt;
substitute&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x \equiv r - \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x + \mu) = \frac{\mu^{x + \mu} e^{-\mu}}{(x+\mu)!} = e^{-\mu} \frac{\mu^{\mu} \mu^x}{(\mu + x)!} = e^{-\mu} \mu^{\mu}\frac{\mu^x}{(\mu)! (\mu+1) \dots (\mu+x)}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; =  e^{-\mu} \frac{\mu^{\mu}}{\mu!} \left [ \frac{\mu}{(\mu+1)} \cdot  \frac{\mu}{(\mu+2)}  \dots \frac{\mu}{(\mu+x)}  \right ] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;e^{-\mu} \frac{\mu^{\mu}}{\mu!}  = e^{-\mu} \frac{\mu^{\mu}}{\sqrt{2 \pi \mu} \mu^{\mu}e^{-\mu}}=  \frac{1}{\sqrt{2 \pi \mu}}&amp;lt;/math&amp;gt; '''Stirling's Approximation when &amp;lt;math&amp;gt;\mu \gg 1&amp;lt;/math&amp;gt;''' &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x + \mu) =  \frac{1}{\sqrt{2 \pi \mu}} \left [ \frac{\mu}{(\mu+1)} \cdot  \frac{\mu}{(\mu+2)}  \dots \frac{\mu}{(\mu+x)}  \right ] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left [ \frac{\mu}{(\mu+1)} \cdot\frac{\mu}{(\mu+2)}  \dots \frac{\mu}{(\mu+x)}  \right ]  = \frac{1}{1 + \frac{1}{\mu}} \cdot  \frac{1}{1 + \frac{2}{\mu}} \dots  \frac{1}{1 + \frac{x}{\mu}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;e^{x/\mu} \approx 1 + \frac{x}{\mu}&amp;lt;/math&amp;gt;  : if &amp;lt;math&amp;gt;x/\mu \ll 1&amp;lt;/math&amp;gt;  Note:&amp;lt;math&amp;gt;x \equiv r - \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x + \mu) =  \frac{1}{\sqrt{2 \pi \mu}} \left [  \frac{1}{1 + \frac{1}{\mu}} \cdot  \frac{1}{1 + \frac{2}{\mu}} \dots  \frac{1}{1 + \frac{x}{\mu}} \right ]  = \frac{1}{\sqrt{2 \pi \mu}} \left [  e^{-1/\mu} \times e^{-2/\mu} \cdots e^{-x/\mu}  \right ] = \frac{1}{\sqrt{2 \pi \mu}} e^{-1 \left[ \frac{1}{\mu} +\frac{2}{\mu} \cdots \frac{x}{\mu}  \right ]}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{1}{\sqrt{2 \pi \mu}} e^{\frac{-1}{\mu} \left[ \sum_1^x i \right ]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
another mathematical identity&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_{i=1}^{x} i = \frac{x}{2}(1+x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x + \mu) =  \frac{1}{\sqrt{2 \pi \mu}} e^{\frac{-1}{\mu} \left[ \frac{x}{2}(1+x) \right ]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if&amp;lt;math&amp;gt; x \gg 1&amp;lt;/math&amp;gt; then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{x}{2}(1+x) \approx \frac{x^2}{2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x + \mu) =  \frac{1}{\sqrt{2 \pi \mu}} e^{\frac{-1}{\mu} \left[ \frac{x^2}{2} \right ]} = \frac{1}{\sqrt{2 \pi \mu}} e^{\frac{-x^2}{2\mu} }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the Poisson distribution &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
replacing dummy variable x with r - \mu&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(r) =  \frac{1}{\sqrt{2 \pi \sigma^2}} e^{\frac{-(r - \mu)^2}{2\sigma^2} } =\frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{1}{2} \left( \frac{r -\mu}{\sigma} \right) ^2}&amp;lt;/math&amp;gt; = Gaussian distribution when &amp;lt;math&amp;gt;\mu \gg 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Integral Probability (Cumulative Distribution Function)====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Poisson and Binomial distributions are discrete probability distributions (integers).&lt;br /&gt;
&lt;br /&gt;
The Gaussian distribution is our first continuous distribution as the variables are real numbers.  It is not very meaningful to speak of the probability that the variate (x) assumes a specific value.  &lt;br /&gt;
&lt;br /&gt;
One could consider defining a  probability element &amp;lt;math&amp;gt;A_G&amp;lt;/math&amp;gt; which is really an integral over a finite region &amp;lt;math&amp;gt;\Delta x&amp;lt;/math&amp;gt; such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;A_G(\Delta x, \mu, \sigma) = \frac{1}{\sigma \sqrt{2 \pi}} \int_{\mu - \Delta x}^{\mu + \Delta x} e^{- \frac{1}{2} \left ( \frac{x - \mu}{\sigma}\right )^2} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantage of this definition becomes apparent when you are interesting in quantifying the probability that a measurement would fall outside a range &amp;lt;math&amp;gt;\Delta x&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P_G( x - \Delta x &amp;gt; x &amp;gt; x + \Delta x) = 1 - A_G(\Delta x, \mu, \sigma)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Cumulative Distribution Function (CDF), however, is defined in terms of the integral from the variates min value&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;CDF \equiv \int_{x_{min}}^{x} P_G( x, \mu, \sigma) = \int_{-\infty}^{x} P_G( x, \mu, \sigma) =  P_G(X \le x) =&amp;lt;/math&amp;gt; Probability that you measure a value less than or equal to &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== discrete CDF example =====&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The probability that a student fails this class is 7.3%.&lt;br /&gt;
&lt;br /&gt;
What is the probability more than 5 student will fail in a class of 32 students?&lt;br /&gt;
&lt;br /&gt;
Answ:  &amp;lt;math&amp;gt;P_B(x\ge 5) = \sum_{x=5}^{32} P_B(x) = CDF( x \ge 5) = 1- \sum_{x=0}^4 P_B(x) = 1 - CDF(x&amp;lt;5) &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= 1 - P_B(x=0)- P_B(x=1)- P_B(x=2)- P_B(x=3)- P_B(x=4)&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= 1 - 0.088 - 0.223 - 0.272 - 0.214 - 0.122 = 0.92 \Rightarrow P_B(x \ge 5) = 0.08&amp;lt;/math&amp;gt;= 8%&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is an 8% probability that 5 or more student will fail the class&lt;br /&gt;
&lt;br /&gt;
===== 2 SD rule of thumb for Gaussian PDF =====&lt;br /&gt;
&lt;br /&gt;
In the above example you calculated the probability that more than 5 student will fail a class.  You can extend this principle to calculate the probability of taking a measurement which exceeds the expected mean value.  &lt;br /&gt;
&lt;br /&gt;
One of the more common consistency checks you can make on a sample data set which you expect to be from a Gaussian distribution is to ask how many data points appear more than 2 S.D. (&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;) from the mean value.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CDF for this is&lt;br /&gt;
: &amp;lt;math&amp;gt;P_G(X \le \mu - 2 \sigma, \mu , \sigma ) = \int_{-\infty}^{\mu - 2\sigma} P_G(x, \mu, \sigma) dx&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{1}{\sigma \sqrt{2 \pi}} \int_{-\infty}^{\mu - 2\sigma} e^{- \frac{1}{2} \left ( \frac{x - \mu}{\sigma}\right )^2} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;z = \frac{x-2}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;dz = \frac{dx}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\Rightarrow P_G(X \le \mu - 2 \sigma, \mu , \sigma ) =  \frac{1}{ \sqrt{2 \pi}} \int_{-\infty}^{\mu - 2\sigma} e^{- \frac{z^2}{2} } dz&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above integral can only be done numerically by expanding the exponential in a power series&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;e^x = \sum_{n=0}^{\infty} \frac{x^n}{n!}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow e^{-x} = 1 -x + \frac{x^2}{2!} - \frac{x^3}{3!} \cdots&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow e^{-z^2/2} = 1 -\frac{z^2}{2}+ \frac{z^4}{8} - \frac{z^6}{48} \cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P_G(X \le \mu - 2 \sigma, \mu , \sigma ) =  \frac{1}{ \sqrt{2 \pi}} \int_{-\infty}^{\mu - 2\sigma}  \left ( 1 -\frac{z^2}{2}+ \frac{z^4}{8} - \frac{z^6}{48} \cdots \right)dz&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \left . \frac{1}{ \sqrt{2 \pi}} \left ( z  -\frac{z^3}{6}+ \frac{z^5}{40} - \frac{z^7}{48 \times 7} \cdots   \right ) \right |_{-\infty}^{\mu - 2\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=\left .  \frac{1}{\pi} \sum_{j=0}^{\infty} \frac{(-1)^j \left (\frac{x}{\sqrt{2}} \right)^{2j+1}}{j! (2j+1)} \right |_{x=\mu - 2\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No analytical for the probability but one which you can compute.&lt;br /&gt;
&lt;br /&gt;
Below is a table representing the cumulative probability &amp;lt;math&amp;gt;P_G(x&amp;lt; \mu - \delta \mbox{ and }  x&amp;gt; \mu + \delta , \mu, \sigma)&amp;lt;/math&amp;gt; for events to occur outside and interval of &amp;lt;math&amp;gt;\pm \delta&amp;lt;/math&amp;gt; in a Gaussian distribution&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;  |cellpadding=&amp;quot;20&amp;quot; cellspacing=&amp;quot;0 &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;P_G(x&amp;lt; \mu - \delta \mbox{ and } x&amp;gt; \mu + \delta , \mu, \sigma)&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;3.2 \times 10^{-1}&amp;lt;/math&amp;gt; ||1&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;4.4 \times 10^{-2}&amp;lt;/math&amp;gt; ||2&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;2.7 \times 10^{-3}&amp;lt;/math&amp;gt; ||3&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;6.3 \times 10^{-5}&amp;lt;/math&amp;gt; ||4&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:TF_Error_CDF_Gauss.png| 400 px]]&lt;br /&gt;
&lt;br /&gt;
===Cauchy/Lorentzian/Breit-Wigner Distribution===&lt;br /&gt;
In Mathematics, the Cauchy distribution is written as&lt;br /&gt;
:&amp;lt;math&amp;gt;P_{CL}(x, x_0, \Gamma) = \frac{1}{\pi} \frac{\Gamma/2}{(x -x_0)^2 + (\Gamma/2)^2}&amp;lt;/math&amp;gt; = Cauchy-Lorentian Distribution&lt;br /&gt;
&lt;br /&gt;
:Note; The probability does not fall as rapidly to zero as the Gaussian.  As a result, the Gaussian's central peak contributes more to the area than the Lorentzian's.&lt;br /&gt;
&lt;br /&gt;
This distribution happens to be a solution to physics problems involving forced resonances (spring systems driven by a source, or a nuclear interaction which induces a metastable state).&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_{BW} = \sigma(E)=  \frac{1}{2\pi}\frac{\Gamma}{(E-E_0)^2 + (\Gamma/2)^2}&amp;lt;/math&amp;gt; = Breit-Wigner distribution&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;E_0 =&amp;lt;/math&amp;gt; mass resonance&lt;br /&gt;
:&amp;lt;math&amp;gt;\Gamma = &amp;lt;/math&amp;gt;FWHM&lt;br /&gt;
: &amp;lt;math&amp;gt;\Delta E \Delta t = \Gamma \tau = \frac{h}{2 \pi}&amp;lt;/math&amp;gt; = uncertainty principle&lt;br /&gt;
:&amp;lt;math&amp;gt;\tau=&amp;lt;/math&amp;gt;lifetime of resonance/intermediate state particle&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A Beit-Wigner function fit to cross section measured as a function of energy will allow one to evaluate the rate increases that are produced when the probing energy excites a resonant state that has a mass &amp;lt;math&amp;gt;E_0&amp;lt;/math&amp;gt; and lasts for the time &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; derived from the Half Width &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== mean====&lt;br /&gt;
&lt;br /&gt;
Mean is not defined&lt;br /&gt;
&lt;br /&gt;
Mode = Median = &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;E_0&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==== Variance ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The variance is also not defined but rather the distribution is parameterized in terms of the Half Width &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;z = \frac{x-\mu}{\Gamma/2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \frac{\Gamma^2}{4\pi} \int_{-\infty}^{\infty} \frac{z^2}{1+z^2} dz&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above integral does not converge for large deviations &amp;lt;math&amp;gt;(x -\mu)&amp;lt;/math&amp;gt; .  The width of the distribution is instead characterized by &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; = FWHM&lt;br /&gt;
&lt;br /&gt;
===Landau===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_L(x) = \frac{1}{2 \pi i} \int_{c-i\infty}^{c+i\infty}\! e^{s \log s + x s}\, ds &amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt; is any positive real number.&lt;br /&gt;
&lt;br /&gt;
To simplify computation it is more convenient to use the equivalent expression&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_L(x) = \frac{1}{\pi} \int_0^\infty\! e^{-t \log t - x t} \sin(\pi t)\, dt.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above distribution was derived by Landau (L. Landau, &amp;quot;On the Energy Loss of Fast Particles by Ionization&amp;quot;, J. Phys., vol 8 (1944), pg 201 ) to describe the energy loss by particles traveling through thin material ( materials with a thickness on the order of a few radiation lengths).&lt;br /&gt;
&lt;br /&gt;
Bethe-Bloch derived an expression to determine the AVERAGE amount of energy lost by a particle traversing a given material &amp;lt;math&amp;gt;(\frac{dE}{dx})&amp;lt;/math&amp;gt; assuming several collisions which span the physical limits of the interaction.&lt;br /&gt;
&lt;br /&gt;
For the case a thin absorbers, the number of collisions is so small that the central limit theorem used to average over several collision doesn't apply and there is a finite possibility of observing large energy losses.&lt;br /&gt;
&lt;br /&gt;
As a result one would expect a distribution which is Gaussian like but with a &amp;quot;tail&amp;quot; on the &amp;lt;math&amp;gt;\mu + \sigma&amp;lt;/math&amp;gt; side of the distribution.&lt;br /&gt;
&lt;br /&gt;
===Gamma===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P_{\gamma}(x,k,\theta) = x^{k-1} \frac{e^{-x/\theta}}{\theta^k \, \Gamma(k)}\text{ for } x &amp;gt; 0\text{ and }k, \theta &amp;gt; 0.\,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt; \Gamma(z) = \int_0^\infty  t^{z-1} e^{-t}\,dt\;&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The distribution is used for &amp;quot;waiting time&amp;quot; models.  How long do you need to wait for a rain storm, how long do you need to wait to die,...&lt;br /&gt;
&lt;br /&gt;
Climatologists use this for predicting how rain fluctuates from season to season.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;k =&amp;lt;/math&amp;gt; integer then the above distribution is a sum of &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; independent exponential distributions&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P_{\gamma}(x,k,\theta) = 1 - e^{-x/\theta} \sum_{j=0}^{k-1}\frac{1}{j!}\left ( \frac{x}{\theta}\right)^j &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Mean====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = k \theta&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Variance====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = k \theta^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Properties====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\lim_{X \rightarrow \infty} P_{\gamma}(x,k,\theta) = \left \{  {\infty \;\;\;\; k &amp;lt;1 \atop 0 \;\;\;\; k&amp;gt;1} \right .&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{1}{\theta} \;\; \mbox{if} k=1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Beta===&lt;br /&gt;
:&amp;lt;math&amp;gt; P_{\beta}(x;\alpha,\beta) = \frac{x^{\alpha-1}(1-x)^{\beta-1}}{\int_0^1 u^{\alpha-1} (1-u)^{\beta-1}\, du} \!&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;= \frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)}\, x^{\alpha-1}(1-x)^{\beta-1}\!&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;= \frac{1}{\mathrm{B}(\alpha,\beta)}\, x&lt;br /&gt;
^{\alpha-1}(1-x)^{\beta-1}\!&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Mean====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = \frac{\alpha}{\alpha + \beta}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variance====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \frac{\alpha \beta }{(\alpha + \beta)^2 (\alpha + \beta + 1)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exponential===&lt;br /&gt;
&lt;br /&gt;
The exponential distribution may be used to describe the processes that are in between Binomial and Poisson (exponential decay)&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P_{e}(x,\lambda) = \left \{  {\lambda e^{-\lambda x} \;\;\;\; x \ge 0\atop 0 \;\;\;\; x&amp;lt;0} \right .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; CDF_{e}(x,\lambda) = \left \{  {\lambda 1-e^{-\lambda x} \;\;\;\; x \ge 0\atop 0 \;\;\;\; x&amp;lt;0} \right .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Mean====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = \frac{1}{\lambda}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variance ====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = \frac{1}{\lambda^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Skewness and Kurtosis==&lt;br /&gt;
&lt;br /&gt;
Distributions may also be characterized by how they look in terms of Skewness and Kurtosis&lt;br /&gt;
&lt;br /&gt;
=== Skewness===&lt;br /&gt;
&lt;br /&gt;
Measures the symmetry of the distribution&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Skewness = &amp;lt;math&amp;gt;\frac{\sum (x_i - \bar{x})^3}{(N-1)s^3} = \frac{\mbox{3rd moment}}{\mbox{2nd moment}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
:&amp;lt;math&amp;gt;s^2 = \frac{\sum (x_i - \bar{x})^2}{N-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;The higher the number the more asymmetric (or skewed) the distribution is.  The closer to zero the more symmetric.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A negative skewness indicates a tail on the left side of the distribution.&lt;br /&gt;
Positive skewness indicates a tail on the right.&lt;br /&gt;
&lt;br /&gt;
===Kurtosis===&lt;br /&gt;
&lt;br /&gt;
Measures the &amp;quot;pointyness&amp;quot; of the distribution&lt;br /&gt;
&lt;br /&gt;
Kurtosis = &amp;lt;math&amp;gt;\frac{\sum (x_i - \bar{x})^4}{(N-1)s^4}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
:&amp;lt;math&amp;gt;s^2 = \frac{\sum (x_i - \bar{x})^2}{N-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
K=3 for Normal Distribution&lt;br /&gt;
&lt;br /&gt;
In ROOT the Kurtosis entry in the statistics box is really the &amp;quot;excess kurtosis&amp;quot; which is the subtraction of the kurtosis by 3&lt;br /&gt;
&lt;br /&gt;
Excess Kurtosis = &amp;lt;math&amp;gt;\frac{\sum (x_i - \bar{x})^4}{(N-1)s^4} - 3&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case a Positive excess Kurtosis will  indicate a peak that is sharper than a gaussian while a negative value will indicate a peak that is flatter than a comparable Gaussian distribution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:ForeErrAna_Gaus-Cauchy_SkeKurt.gif|200 px]][[File:ForeErrAna_Gaus-Landau_SkeKurt.gif|200 px]][[File:ForeErrAna_Gaus-gamma_SkeKurt.gif|200 px]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences] [[Forest_Error_Analysis_for_the_Physical_Sciences]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=Forest_ErrAna_StatDist&amp;diff=91109</id>
		<title>Forest ErrAna StatDist</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=Forest_ErrAna_StatDist&amp;diff=91109"/>
		<updated>2014-01-31T20:18:44Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Standard Deviation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Parent Distribution==&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; represent our ith attempt to measurement the quantity &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Due to the random errors present in any experiment we should not expect &amp;lt;math&amp;gt;x_i = x&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we neglect systematic errors, then we should expect &amp;lt;math&amp;gt; x_i&amp;lt;/math&amp;gt; to, on average, follow some probability distribution around the correct value &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This probability distribution can be referred to as the &amp;quot;parent population&amp;quot;.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Average and Variance ==&lt;br /&gt;
===Average===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The word &amp;quot;average&amp;quot; is used to describe a property of a &amp;quot;parent&amp;quot; probability distribution or a set of observations/measurements made in an experiment which gives an indication of a likely outcome of an experiment.&lt;br /&gt;
&lt;br /&gt;
The symbol&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is usually used to represent the &amp;quot;mean&amp;quot; of a known probability (parent) distribution (parent mean) while the &amp;quot;average&amp;quot; of a set of observations/measurements is denoted as &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and is commonly referred to as the &amp;quot;sample&amp;quot; average or &amp;quot;sample mean&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Definition of the mean&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu \equiv \lim_{N\rightarrow \infty} \frac{\sum x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here the above average of a parent distribution is defined in terms of an infinite sum of observations (x_i) of an observable x divided by the number of observations.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; is a calculation of the mean using a finite number of observations&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \bar{x} \equiv  \frac{\sum x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This definition uses the assumption that the result of an experiment, measuring a sample average of &amp;lt;math&amp;gt;(\bar{x})&amp;lt;/math&amp;gt;, asymptotically approaches the &amp;quot;true&amp;quot; average of the parent distribution &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
===Variance===&lt;br /&gt;
&lt;br /&gt;
The word &amp;quot;variance&amp;quot; is used to describe a property of a probability distribution or a set of observations/measurements made in an experiment which gives an indication how much an observation will deviate from and average value.&lt;br /&gt;
&lt;br /&gt;
A deviation &amp;lt;math&amp;gt;(d_i)&amp;lt;/math&amp;gt; of any measurement &amp;lt;math&amp;gt;(x_i)&amp;lt;/math&amp;gt; from a parent distribution with a mean &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; can be defined as &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;d_i\equiv x_i - \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the deviations should average to ZERO for an infinite number of observations by definition of the mean.&lt;br /&gt;
&lt;br /&gt;
Definition of the average&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu \equiv \lim_{N\rightarrow \infty} \frac{\sum x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\lim_{N\rightarrow \infty} \frac{\sum (x_i - \mu)}{N}&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \left ( \lim_{N\rightarrow \infty} \frac{\sum (x_i }{N}\right ) - \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \left ( \lim_{N\rightarrow \infty} \frac{\sum (x_i }{N}\right ) - \lim_{N\rightarrow \infty} \frac{\sum x_i}{N} = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But the AVERAGE DEVIATION &amp;lt;math&amp;gt;(\bar{d})&amp;lt;/math&amp;gt; is given by an average of the magnitude of the deviations given by &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{d} = \lim_{N\rightarrow \infty} \frac{\sum \left | (x_i - \mu)\right |}{N}&amp;lt;/math&amp;gt; = a measure of the dispersion of the expected observations about the mean&lt;br /&gt;
&lt;br /&gt;
Taking the absolute value though is cumbersome when performing a statistical analysis so one may express this dispersion in terms of the variance&lt;br /&gt;
&lt;br /&gt;
A typical variable used to denote the variance is&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and is defined as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \lim_{N\rightarrow \infty}\left [ \frac{\sum (x_i-\mu)^2 }{N}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Standard Deviation====&lt;br /&gt;
&lt;br /&gt;
The standard deviation is defined as the square root of the variance&lt;br /&gt;
&lt;br /&gt;
:S.D. = &amp;lt;math&amp;gt;\sqrt{\sigma^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The mean should be thought of as a parameter which characterizes the observations we are making in an experiment.  In general the mean specifies the probability distribution that is representative of the observable we are trying to measure through experimentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The variance characterizes the uncertainty associated with our experimental attempts to determine the &amp;quot;true&amp;quot; value.  Although the mean and true value may not be equal, their difference should be less than the uncertainty given by the governing probability distribution.&lt;br /&gt;
&lt;br /&gt;
==== Another Expression for Variance====&lt;br /&gt;
&lt;br /&gt;
Using the definition of variance (omitting the limit as &amp;lt;math&amp;gt;n \rightarrow \infty&amp;lt;/math&amp;gt;) &lt;br /&gt;
;Evaluating the definition of variance: &amp;lt;math&amp;gt;\sigma^2 \equiv \frac{\sum(x_i-\mu)^2}{N} = \frac{\sum (x_i^2 -2x_i \mu + \mu^2)}{N} = \frac{\sum x_i^2}{N} - 2 \mu \frac{\sum x_i}{N} + \frac{N \mu^2}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \frac{\sum x_i^2}{N} -2 \mu^2 + \mu^2 =\frac{\sum x_i^2}{N} - \mu^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum(x_i-\mu)^2}{N}  =\frac{\sum x_i^2}{N} - \mu^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can recast the above in terms of expectation value where &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E[x] \equiv \sum x_i P_x(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \sigma^2 = E[(x-\mu)^2] = \sum_{x=0}^n (x_i - \mu)^2 P(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= E[x^2] - \left ( E[x]\right )^2 = \sum_{x=0}^n x_i^2 P(x_i) - \left ( \sum_{x=0}^n x_i P(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Average for an unknown probability distribution (parent population)==&lt;br /&gt;
&lt;br /&gt;
If the &amp;quot;Parent Population&amp;quot; is not known, you are just given a list of numbers with no indication of the probability distribution that they were drawn from, then the average and variance may be calculate as shown below.&lt;br /&gt;
&lt;br /&gt;
===Arithmetic Mean and variance===&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; observables are mode in an experiment then the arithmetic mean of those observables is defined as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\bar{x} = \frac{\sum_{i=1}^{i=N} x_i}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;unbiased&amp;quot; variance of the above sample is defined as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;s^2 = \frac{\sum_{i=1}^{i=N} (x_i - \bar{x})^2}{N-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;If you were told that the average is &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; then you can calculate the &lt;br /&gt;
&amp;quot;true&amp;quot;  variance of the above sample as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \frac{\sum_{i=1}^{i=N} (x_i - \bar{x})^2}{N}&amp;lt;/math&amp;gt; = RMS Error= Root Mean Squared Error&lt;br /&gt;
&lt;br /&gt;
;Note:RMS = Root Mean Square = &amp;lt;math&amp;gt;\frac{\sum_i^n x_i^2}{n}&amp;lt;/math&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
==== Statistical Variance decreases with  N====&lt;br /&gt;
&lt;br /&gt;
The repetition of an experiment can decrease the STATISTICAL error of the experiment&lt;br /&gt;
&lt;br /&gt;
Consider the following:&lt;br /&gt;
&lt;br /&gt;
The average value of the mean of a sample of n observations drawn from the parent population is the same as the average value of each observation.  (The average of the averages  is the same as one of the averages)&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\bar{x} = \frac{\sum x_i}{N} =&amp;lt;/math&amp;gt; sample mean&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\overline{\left ( \bar{x} \right ) } = \frac{\sum{\bar{x}_i}}{N} =\frac{1}{N} N \bar{x_i} = \bar{x}&amp;lt;/math&amp;gt; if all means are the same&lt;br /&gt;
&lt;br /&gt;
This is the reason why the sample mean is a measure of the population average ( &amp;lt;math&amp;gt;\bar{x} \sim \mu&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Now consider the variance of the average of the averages (this is not the variance of the individual measurements but the variance of their means)&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2_{\bar{x}} = \frac{\sum \left (\bar{x} -\overline{\left ( \bar{x} \right ) }  \right )^2}{N} =\frac{\sum \bar{x_i}^2}{N}  -\left( \overline{\left ( \bar{x} \right ) }  \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{\sum \bar{x_i}^2}{N}  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{\sum \left( \sum \frac{x_i}{N}\right)^2}{N}  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2}\frac{\sum \left( \sum x_i\right)^2}{N}  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2}\frac{\sum \left (\sum x_i^2 + \sum_{i \ne j} x_ix_j \right )}{N}  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2} \left [ \frac{\sum \left(\sum x_i^2 \right)}{N}  + \frac{ \sum \left (\sum_{i \ne j} x_ix_j \right )}{N} \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;If the measurements are all independent&lt;br /&gt;
:Then &amp;lt;math&amp;gt; \frac{\sum_{i \ne j} x_i x_j}{N} = \frac{\sum x_i}{N} \frac{ \sum x_j}{N}&amp;lt;/math&amp;gt; : if &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; is independent of &amp;lt;math&amp;gt;x_j&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;i \ne j&amp;lt;/math&amp;gt;)&lt;br /&gt;
:&amp;lt;math&amp;gt;= \left ( \frac{\sum x_i}{N} \right)^2 = \bar{x}^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
example:&lt;br /&gt;
:(x_1x_2 + x_1x_3 + x_2x_1+x_2x_3+x_3x_1+x_3x_2+ ...) = (x_1+x_2+x_3)&lt;br /&gt;
 The above part of the proof needs work&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2_{\bar{x}}=\frac{1}{N^2} \left [ \frac{\sum \left(\sum x_i^2 \right)}{N}  + \sum_{i \ne j} \bar{x}^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I use the expression &amp;lt;math&amp;gt;\sigma^2 = E[x^2] - \left ( E[x] \right)^2&amp;lt;/math&amp;gt;  again, except for&amp;lt;math&amp;gt; x_i&amp;lt;/math&amp;gt; and not &amp;lt;math&amp;gt;\bar{x}&amp;lt;/math&amp;gt; and turn it around so&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{\left(\sum x_i^2 \right)}{N} = \sigma^2 + \left ( \frac{\sum x_i}{N}\right)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now I have&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2_{\bar{x}}=\frac{1}{N^2} \left [ \sum \left (\sigma^2 +  \left ( \frac{\sum x_i}{N} \right )^2 \right )+ \sum_{i \ne j} \bar{x}^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2} \left [ N\sigma^2 +  N\left ( \frac{\sum x_i}{N} \right )^2 + \sum_{i \ne j} \bar{x}^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2} \left [ N\sigma^2 +  N\left ( \frac{\sum x_i}{N} \right )^2 + N(N-1) \bar{x}^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt; Number of cross terms is N*(N-1)&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{N^2} \left [ N\sigma^2 +  N\left ( \frac{\sum x_i}{N} \right )^2 + (N^2 -N) \left ( \frac{\sum x_i}{N} \right )^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt; Number of cross terms is N*(N-1)&lt;br /&gt;
:&amp;lt;math&amp;gt;= \left [ \frac{\sigma^2}{N} +  \left ( \frac{\sum x_i}{N} \right )^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;= \left [ \frac{\sigma^2}{N} +  \left (  \bar{x}\right )^2 \right ]  -\left( \bar{x} \right )^2&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{\sigma^2}{N} &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above is the essence of counting statistics.&lt;br /&gt;
&lt;br /&gt;
It says that the STATISTICAL error in an experiment decreases as a function of &amp;lt;math&amp;gt;\frac{1}{\sqrt N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Biased and Unbiased variance====&lt;br /&gt;
&lt;br /&gt;
Where does this idea of an unbiased variance come from?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using the same procedure as the previous section let's look at the average variance of the variances.&lt;br /&gt;
&lt;br /&gt;
A sample variance of &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; measurements of &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; is&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma_n^2 = \frac{\sum(x_i-\bar{x})^2}{n} = E[x^2] - \left ( E[x] \right)^2 = \frac{\sum x_i^2}{n} -\left ( \bar{x} \right)^2&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To determine the &amp;quot;true&amp;quot; variance consider taking average of several sample variances (this is the same argument used above which let to &amp;lt;math&amp;gt;\overline{(\bar{x})} = \bar{x}&amp;lt;/math&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum \sigma_i^2}{N} = E[\sigma^2] - \left ( E[\sigma] \right)^2 = \frac{ \sum_j \left [ \frac{\sum_i x_i^2}{n} -\left ( \bar{x} \right)^2 \right ]_j}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{1}{n}\sum_i \left ( \frac{\sum_j x_j^2}{N} \right )_i - \frac {\sum_j \left ( \bar{x} \right)^2 }{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{1}{n}\sum_i \left ( \frac{\sum_j x_j^2}{N} \right )_i - \left [ \left ( \frac {\sum_j \bar{x}}{N} \right)^2  + \sigma_{\bar{x}}^2\right ]&amp;lt;/math&amp;gt;  :  as shown previously      &amp;lt;math&amp;gt;E[\bar{x}^2] = \left ( E[\bar{x}] \right )^2 + \sigma_{\bar{x}}^2&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{1}{n}\sum_i \left ( \left [ \left (\frac{\sum_j x_j}{N}\right)^2 + \sigma^2 \right ]\right )_i - \left [ \left ( \frac {\sum_j x_j}{N} \right)^2  + \frac{\sigma^2}{n}\right ]&amp;lt;/math&amp;gt; : also shown previously&amp;lt;math&amp;gt;\overline{\left ( \bar{x} \right ) } =  \bar{x}&amp;lt;/math&amp;gt;  the universe average is the same as the sample average&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{1}{n} \left ( n\left [ \left (\frac{\sum_j x_j}{N}\right)^2 + n\sigma^2 \right ]\right )_i - \left [ \left ( \frac {\sum_j x_j}{N} \right)^2  + \frac{\sigma^2}{n}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \sigma^2 - \frac{\sigma^2}{n}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{n-1}{n}\sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \sigma^2 = \frac{n}{n-1}\frac{\sum \sigma_i^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 =&amp;lt;/math&amp;gt; the sample variance&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum \sigma_i^2}{N} =&amp;lt;/math&amp;gt; an average of all possible sample variance which should be equivalent to the &amp;quot;true&amp;quot; population variance.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \frac{\sum \sigma_i^2}{N} \sim \sum \frac{x_i-\bar{x}}{n}&amp;lt;/math&amp;gt; : if all the variances are the same this would be equivalent&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\sigma^2 = \frac{n}{n-1}\frac{\sum(x_i-\bar{x})}{n}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{\sum(x_i-\bar{x})}{n-1} =&amp;lt;/math&amp;gt; unbiased sample variance&lt;br /&gt;
&lt;br /&gt;
==Probability Distributions==&lt;br /&gt;
&lt;br /&gt;
=== Mean(Expectation value) and variance===&lt;br /&gt;
====Mean of Discrete Probability Distribution====&lt;br /&gt;
&lt;br /&gt;
In the case that you know the probability distribution you can calculate the mean&amp;lt;math&amp;gt; (\mu)&amp;lt;/math&amp;gt; or expectation value E(x) and standard deviation as&lt;br /&gt;
&lt;br /&gt;
For a Discrete probability distribution&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = E[x]=\lim_{N \rightarrow \infty} \frac{\sum_{i=1}^n x_i N P(x_i)}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;N=&amp;lt;/math&amp;gt; number of observations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;n=&amp;lt;/math&amp;gt; number of different possible observable variables&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x_i =&amp;lt;/math&amp;gt; ith observable quantity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(x_i) =&amp;lt;/math&amp;gt; probability of observing &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; = Probability Mass Distribution for a discrete probability distribution&lt;br /&gt;
&lt;br /&gt;
====Mean of a continuous probability distibution====&lt;br /&gt;
The average (mean) of a sample drawn from any probability distribution is defined in terms of the expectation value E(x) such that&lt;br /&gt;
&lt;br /&gt;
The expectation value for a  continuous probability distribution  is calculated as&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\mu = E(x) = \int_{-\infty}^{\infty} x P(x)dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Variance===&lt;br /&gt;
&lt;br /&gt;
==== Variance of a discrete PDF====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma^2 = \sum_{i=1}^n \left [ (x_i - \mu)^2 P(x_i)\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variance of a Continuous PDF ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma^2 = \int_{-\infty}^{\infty} \left [ (x - \mu)^2 P(x)\right ]dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Expectation of Arbitrary function====&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;f(x)&amp;lt;/math&amp;gt; is an arbitrary function of a variable &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; governed by a probability distribution &amp;lt;math&amp;gt;P(x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then the expectation value of &amp;lt;math&amp;gt;f(x)&amp;lt;/math&amp;gt; is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E[f(x)] = \sum_{i=1}^N f(x_i) P(x_i) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
or if a continuous distribtion&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E[f(x)] = \int_{-\infty}^{\infty} f(x) P(x)dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Uniform===&lt;br /&gt;
&lt;br /&gt;
The Uniform probability distribution function is a continuous probability function over a specified interval in which any value within the interval has the same probability of occurring.&lt;br /&gt;
&lt;br /&gt;
Mathematically the uniform distribution over an interval from a to b is given by&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_U(x) =\left \{  {\frac{1}{b-a} \;\;\;\; x &amp;gt;a \mbox{ and } x &amp;lt;b \atop 0 \;\;\;\; x&amp;gt;b \mbox{ or } x &amp;lt; a} \right .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Mean of Uniform PDF====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = \int_{-\infty}^{\infty} xP_U(x)dx = \int_{a}^{b} \frac{x}{b-a} dx = \left . \frac{x^2}{2(b-a)} \right |_a^b = \frac{1}{2}\frac{b^2 - a^2}{b-a} = \frac{1}{2}(b+a)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Variance of Uniform PDF====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \int_{-\infty}^{\infty} (x-\mu)^2 P_U(x)dx = \int_{a}^{b} \frac{\left (x-\frac{b+a}{2}\right )^2}{b-a} dx = \left . \frac{(x -\frac{b+a}{2})^3}{3(b-a)} \right |_a^b &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{3(b-a)}\left [ \left (b -\frac{b+a}{2} \right )^3 - \left (a -\frac{b+a}{2} \right)^3\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{3(b-a)}\left [ \left (\frac{b-a}{2} \right )^3 - \left (\frac{a-b}{2} \right)^3\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{24(b-a)}\left [ (b-a)^3 - (-1)^3 (b-a)^3\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;=\frac{1}{12}(b-a)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now use ROOT to generate uniform distributions.&lt;br /&gt;
http://wiki.iac.isu.edu/index.php/TF_ErrAna_InClassLab#Day_3&lt;br /&gt;
&lt;br /&gt;
===Binomial Distribution===&lt;br /&gt;
&lt;br /&gt;
Binomial random variable describes experiments in which the outcome has only 2 possibilities.   The two possible outcomes can be labeled as &amp;quot;success&amp;quot; or &amp;quot;failure&amp;quot;. The probabilities may be defined as &lt;br /&gt;
&lt;br /&gt;
;p&lt;br /&gt;
: the probability of a success&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
;q&lt;br /&gt;
:the probability of a failure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we let &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; represent the number of successes after repeating the experiment &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; times&lt;br /&gt;
&lt;br /&gt;
Experiments with &amp;lt;math&amp;gt;n=1&amp;lt;/math&amp;gt; are also known as Bernoulli trails.&lt;br /&gt;
&lt;br /&gt;
Then &amp;lt;math&amp;gt;X&amp;lt;/math&amp;gt; is the Binomial random variable with parameters &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The number of ways in which the &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; successful outcomes can be organized in &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; repeated  trials is&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{n !}{ \left [ (n-x) ! x !\right ]}&amp;lt;/math&amp;gt;  where the &amp;lt;math&amp;gt; !&amp;lt;/math&amp;gt; denotes a factorial such that &amp;lt;math&amp;gt;5! = 5\times4\times3\times2\times1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The expression is known as the binomial coefficient and is represented as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;{n\choose x}=\frac{n!}{x!(n-x)!}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of any one ordering of the success and failures is given by &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P( \mbox{experimental ordering}) = p^{x}q^{n-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This means the probability of getting exactly k successes after n trials is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_B(x) = {n\choose x}p^{x}q^{n-x} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Mean====&lt;br /&gt;
&lt;br /&gt;
It can be shown that the Expectation Value of the distribution is&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = n p&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = \sum_{x=0}^n x P_B(x) = \sum_{x=0}^n x \frac{n!}{x!(n-x)!} p^{x}q^{n-x}&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt; =  \sum_{x=1}^n  \frac{n!}{(x-1)!(n-x)!} p^{x}q^{n-x}&amp;lt;/math&amp;gt;  :summation starts from x=1 and not x=0 now&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np \sum_{x=1}^n  \frac{(n-1)!}{(x-1)!(n-x)!} p^{x-1}q^{n-x}&amp;lt;/math&amp;gt;  :factor out &amp;lt;math&amp;gt;np&amp;lt;/math&amp;gt; : replace n-1 with m everywhere and it looks like binomial distribution&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np \sum_{y=0}^{n-1}  \frac{(n-1)!}{(y)!(n-y-1)!} p^{y}q^{n-y-1}&amp;lt;/math&amp;gt; :change summation index so y=x-1, now n become n-1&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np \sum_{y=0}^{n-1}  \frac{(n-1)!}{(y)!(n-1-y)!} p^{y}q^{n-1-y}&amp;lt;/math&amp;gt; :&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np (q+p)^{n-1}&amp;lt;/math&amp;gt;  :definition of binomial expansion&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np 1^{n-1}&amp;lt;/math&amp;gt;  :q+p =1&lt;br /&gt;
:&amp;lt;math&amp;gt; =  np &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====variance ====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = npq&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Remember: &amp;lt;math&amp;gt;\frac{\sum(x_i-\mu)^2}{N} = \frac{\sum (x_i^2 -2x_i \mu + \mu^2)}{N} = \frac{\sum x_i^2}{N} - 2 \mu \frac{\sum x_i}{N} + \frac{N \mu^2}{N} &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \frac{\sum x_i^2}{N} -2 \mu^2 + \mu^2 =\frac{\sum x_i^2}{N} - \mu^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{\sum(x_i-\mu)^2}{N}  =\frac{\sum x_i^2}{N} - \mu^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \sigma^2 = E[(x-\mu)^2] = \sum_{x=0}^n (x_i - \mu)^2 P_B(x_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= E[x^2] - \left ( E[x]\right )^2 = \sum_{x=0}^n x_i^2 P_B(x_i) - \left ( \sum_{x=0}^n x_i P_B(x_i)\right )^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To calculate the variance of the Binomial distribution I will just calculate &amp;lt;math&amp;gt;E[x^2]&amp;lt;/math&amp;gt; and then subtract off &amp;lt;math&amp;gt;\left ( E[x]\right )^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;E[x^2] = \sum_{x=0}^n x^2 P_B(x)&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_{x=1}^n x^2 P_B(x)&amp;lt;/math&amp;gt;   : x=0 term is zero so no contribution&lt;br /&gt;
:&amp;lt;math&amp;gt;=\sum_{x=1}^n x^2 \frac{n!}{x!(n-x)!} p^{x}q^{n-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \sum_{x=1}^n x \frac{(n-1)!}{(x-1)!(n-x)!} p^{x-1}q^{n-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let m=n-1 and y=x-1&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \sum_{y=0}^n (y+1) \frac{m!}{(y)!(m-1-y+1)!} p^{y}q^{m-1-y+1}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \sum_{y=0}^n (y+1) P(y)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \left ( \sum_{y=0}^n y P(y) + \sum_{y=0}^n (1) P(y) \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \left ( mp + 1 \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= np \left ( (n-1)p + 1 \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = E[x^2] - \left ( E[x] \right)^2 = np \left ( (n-1)p + 1 \right) - (np)^2 = np(1-p) = npq&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examples===&lt;br /&gt;
&lt;br /&gt;
==== The number of times a coin toss is heads.====&lt;br /&gt;
&lt;br /&gt;
The probability of a coin landing with the head of the coin facing up is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P = \frac{\mbox{number of desired outcomes}}{\mbox{number of possible outcomes}} = \frac{1}{2}&amp;lt;/math&amp;gt; = Uniform distribution with a=0 (tails) b=1 (heads).&lt;br /&gt;
&lt;br /&gt;
Suppose you toss a coin 4 times.  Here are the possible outcomes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;  |cellpadding=&amp;quot;20&amp;quot; cellspacing=&amp;quot;0 &lt;br /&gt;
|order Number&lt;br /&gt;
|colspan= &amp;quot;4&amp;quot; | Trial #&lt;br /&gt;
| # of Heads&lt;br /&gt;
|-&lt;br /&gt;
| || 1|| 2 || 3|| 4 ||&lt;br /&gt;
|-&lt;br /&gt;
|1 ||t || t || t|| t ||0&lt;br /&gt;
|-&lt;br /&gt;
|2||h || t || t|| t ||1&lt;br /&gt;
|-&lt;br /&gt;
|3||t || h || t|| t ||1&lt;br /&gt;
|-&lt;br /&gt;
|4||t || t || h|| t ||1&lt;br /&gt;
|-&lt;br /&gt;
|5||t || t || t|| h ||1&lt;br /&gt;
|-&lt;br /&gt;
|6||h || h || t|| t ||2&lt;br /&gt;
|-&lt;br /&gt;
|7||h || t || h|| t ||2&lt;br /&gt;
|-&lt;br /&gt;
|8||h || t || t|| h||2&lt;br /&gt;
|-&lt;br /&gt;
|9||t || h || h|| t ||2&lt;br /&gt;
|-&lt;br /&gt;
|10||t || h || t|| h ||2&lt;br /&gt;
|-&lt;br /&gt;
|11||t || t || h|| h ||2&lt;br /&gt;
|-&lt;br /&gt;
|12||t|| h || h|| h||3&lt;br /&gt;
|-&lt;br /&gt;
|13||h|| t || h|| h||3&lt;br /&gt;
|-&lt;br /&gt;
|14||h|| h || t|| h||3&lt;br /&gt;
|-&lt;br /&gt;
|15||h|| h || h|| t||3&lt;br /&gt;
|-&lt;br /&gt;
|16||h|| h || h|| h||4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The probability of order #1 happening is&lt;br /&gt;
&lt;br /&gt;
P( order #1) = &amp;lt;math&amp;gt;\left ( \frac{1}{2} \right )^0\left ( \frac{1}{2} \right )^4 = \frac{1}{16}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
P( order #2) = &amp;lt;math&amp;gt;\left ( \frac{1}{2} \right )^1\left ( \frac{1}{2} \right )^3 = \frac{1}{16}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The probability of observing the coin land on heads 3 times out of 4 trials is.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(x=3) = \frac{4}{16} = \frac{1}{4} =  {n\choose x}p^{x}q^{n-x}  = \frac{4 !}{ \left [ (4-3) ! 3 !\right ]} \left ( \frac{1}{2}\right )^{3}\left ( \frac{1}{2}\right )^{4-3} = \frac{24}{1 \times 6} \frac{1}{16} = \frac{1}{4}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== A 6 sided die====&lt;br /&gt;
&lt;br /&gt;
A die is a 6 sided cube with dots on each side.  Each side has a unique number of dots with at most 6 dots on any one side.&lt;br /&gt;
&lt;br /&gt;
P=1/6 = probability of landing on any side of the cube.&lt;br /&gt;
&lt;br /&gt;
Expectation value :&lt;br /&gt;
; The expected (average) value for rolling a single die.&lt;br /&gt;
: &amp;lt;math&amp;gt;E({\rm Roll\ With\ 6\ Sided\ Die}) =\sum_i x_i P(x_i) =1 \left ( \frac{1}{6} \right) + 2\left ( \frac{1}{6} \right)+ 3\left ( \frac{1}{6} \right)+ 4\left ( \frac{1}{6} \right)+ 5\left ( \frac{1}{6} \right)+ 6\left ( \frac{1}{6} \right)=\frac{1 + 2 + 3 + 4 + 5 + 6}{6} = 3.5&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variance:&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;E({\rm Roll\ With\ 6\ Sided\ Die}) =\sum_i (x_i - \mu)^2 P(x_i)  &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= (1-3.5)^2 \left ( \frac{1}{6} \right) + (2-3.5)^2\left ( \frac{1}{6} \right)+ (3-3.5)^2\left ( \frac{1}{6} \right)+ (4-3.5)^2\left ( \frac{1}{6} \right)+ (5-3.5)^2\left ( \frac{1}{6} \right)+ (6-3.5)^2\left ( \frac{1}{6} \right) =2.92&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \sum_i (x_i)^2 P(x_i) - \mu^2 = \left [ 1 \left ( \frac{1}{6} \right) + 4\left ( \frac{1}{6} \right)+ 9\left ( \frac{1}{6} \right)+ 16\left ( \frac{1}{6} \right)+ 25\left ( \frac{1}{6} \right)+ 36\left ( \frac{1}{6} \right) \right ] - (3.5)^3 =2.92&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If we roll the die 10 times what is the probability that X dice will show a 6?&lt;br /&gt;
&lt;br /&gt;
A success will be that the die landed with 6 dots face up.&lt;br /&gt;
&lt;br /&gt;
So the probability of this is 1/6 (p=1/6) , we toss it 10 times (n=10) so the binomial distribution function for a success/fail experiment says&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P_B(x)  =  {n\choose x}p^{x}q^{n-x}  = \frac{10 !}{ \left [ (10-x) ! x !\right ]} \left ( \frac{1}{6}\right )^{x}\left ( \frac{5}{6}\right )^{10-x} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So the probability the die will have 6 dots face up in 4/10 rolls is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P_B(x=4)  =  \frac{10 !}{ \left [ (10-4) ! 4 !\right ]} \left ( \frac{1}{6}\right )^{4}\left ( \frac{5}{6}\right )^{10-4} &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; =  \frac{10 !}{ \left [ (6) ! 4 !\right ]} \left ( \frac{1}{6}\right )^{4}\left ( \frac{5}{6}\right )^{6} = \frac{210 \times 5^6}{6^10}=0.054 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mean = np =&amp;lt;math&amp;gt;\mu =  10/6 = 1.67&amp;lt;/math&amp;gt; &lt;br /&gt;
Variance = &amp;lt;math&amp;gt;\sigma^2 = 10 (1/6)(5/6) = 1.38&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Poisson Distribution===&lt;br /&gt;
&lt;br /&gt;
The Poisson distribution is an approximation to the binomial distribution in the event that the probability of a success is quite small &amp;lt;math&amp;gt;(p \ll 1)&amp;lt;/math&amp;gt;.  As the number of repeated observations (n) gets large,  the  binomial distribution becomes more difficult to evaluate because of the leading term&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{n !}{ \left [ (n-x) ! x !\right ]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The poisson distribution overcomes this problem by defining the probability in terms of the average &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x) = \frac{\mu^x e^{-\mu}}{x!}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Poisson as approximation to Binomial====&lt;br /&gt;
&lt;br /&gt;
To drive home the idea that the Poisson distribution approximates a Binomial distribution at small p and large n consider the following derivation&lt;br /&gt;
&lt;br /&gt;
The Binomial Probability Distriubtions is&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_B(x) = \frac{n!}{x!(n-x)!}p^{x}q^{n-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \frac{n!}{(n-x)!} = \frac{(n-x)! (n-x+1) (n-x + 2) \dots (n-1)(n)}{(n-x)!}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= n (n-1)(n-2) \dots (n-x+2) (n-x+1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;IFF &amp;lt;math&amp;gt;x \ll n \Rightarrow&amp;lt;/math&amp;gt; we have x terms above&lt;br /&gt;
:then &amp;lt;math&amp;gt;\frac{n!}{(n-x)!} =n^x&amp;lt;/math&amp;gt;&lt;br /&gt;
:example:&amp;lt;math&amp;gt; \frac{100!}{(100-1)!} = \frac{99! \times 100}{99!} = 100^1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This leave us with &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) = \frac{n^x}{x!}p^{x}q^{n-x}= \frac{(np)^x}{x!}(1-p)^{n-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{(\mu)^x}{x!}(1-p)^{n}(1-p)^{-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;(1-p)^{-x} = \frac{1}{(1-p)^x} = 1+px = 1 : p \ll 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(x) = \frac{(\mu)^x}{x!}(1-p)^{n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;(1-p)^{n} = \left [(1-p)^{1/p} \right]^{\mu}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\lim_{p \rightarrow 0} \left [(1-p)^{1/p} \right]^{\mu} = \left ( \frac{1}{e} \right)^{\mu} = e^{- \mu}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
;For  &amp;lt;math&amp;gt;x \ll n&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\lim_{p \rightarrow 0}P_B(x,n,p ) = P_P(x,\mu)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Derivation of Poisson Distribution====&lt;br /&gt;
&lt;br /&gt;
The mean free path of a particle traversing a volume of material is a common problem in nuclear and particle physics.  If you want to shield your apparatus or yourself from radiation you want to know how far the radiation travels through material.  &lt;br /&gt;
&lt;br /&gt;
The mean free path is the average distance a particle travels through a material before interacting with the material. &lt;br /&gt;
;If we let &amp;lt;math&amp;gt;\lambda&amp;lt;/math&amp;gt; represent the mean free path &lt;br /&gt;
;Then the probability of having an interaction after a distance x is&lt;br /&gt;
: &amp;lt;math&amp;gt;\frac{x}{\lambda}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as a result&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;1-\frac{x}{\lambda}= P(0,x, \lambda)&amp;lt;/math&amp;gt; = probability of getting no events after a length dx&lt;br /&gt;
&lt;br /&gt;
When we consider &amp;lt;math&amp;gt;\frac{x}{\lambda} \ll 1&amp;lt;/math&amp;gt; ( we are looking for small distances such that the probability of no interactions is high)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(0,x, \lambda) = e^{\frac{-x}{\lambda}} \approx 1 - \frac{x}{\lambda}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we wish to find the probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; events over a distance &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; given the mean free path.&lt;br /&gt;
&lt;br /&gt;
This is calculated as a joint probability.  If it were the case that we wanted to know the probability of only one interaction over a distance &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;.  Then we would want to multiply the probability that an interaction happened after a distance &amp;lt;math&amp;gt;dx&amp;lt;/math&amp;gt; by the probability that no more interactions happen by the time the particle reaches the distance &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
For the case of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; interactions, we have a series of &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; interactions happening over N intervals of &amp;lt;math&amp;gt;dx&amp;lt;/math&amp;gt; with the probability &amp;lt;math&amp;gt;dx/\lambda&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
:&amp;lt;math&amp;gt;P(N,x,\lambda)&amp;lt;/math&amp;gt; = probability of finding &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; events within the length &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{dx_1}{\lambda}\frac{dx_2}{\lambda}\frac{dx_3}{\lambda} \dots \frac{dx_N}{\lambda} e^{\frac{-x}{\lambda}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above expression represents the probability for a particular sequence of events in which an interaction occurs after a distance &amp;lt;math&amp;gt;dx_1&amp;lt;/math&amp;gt; then a interaction after &amp;lt;math&amp;gt;dx_2&amp;lt;/math&amp;gt; , &amp;lt;math&amp;gt;\dots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So in essence the above expression is a &amp;quot;probability element&amp;quot; where another probability element may be&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt; P(N,x, \lambda)=\frac{dx_2}{\lambda}\frac{dx_1}{\lambda}\frac{dx_3}{\lambda} \dots \frac{dx_N}{\lambda} e^{\frac{-x}{\lambda}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where the first interaction occurs after the distance &amp;lt;math&amp;gt;x_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;= \Pi_{i=1}^{N} \left [ \frac{dx_i}{\lambda} \right ] e^{\frac{-x}{\lambda}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So we can write a differential probability element which we need to add up as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;d^NP(N,x, \lambda)=\frac{1}{N!} \Pi_{i=1}^{N} \left [ \frac{dx_i}{\lambda} \right ] e^{\frac{-x}{\lambda}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The N! accounts for the degeneracy in which for every N! permutations there is really only one new combination.  ie we are double counting when we integrate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using the integral formula&lt;br /&gt;
: &amp;lt;math&amp;gt; \Pi_{i=1}^{N} \left [\int_0^x \frac{dx_i}{\lambda} \right ]= \left [ \frac{x}{\lambda}\right]^N&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
we end up with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(N,x, \lambda) = \frac{\left [ \frac{x}{\lambda}\right]^N}{N!} e^{\frac{-x}{\lambda}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Mean of Poisson Dist====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = \sum_{i=1}^{\infty} i P(i,x, \lambda)&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=  \sum_{i=1}^{\infty} i \frac{\left [ \frac{x}{\lambda}\right]^i}{i!} e^{\frac{-x}{\lambda}}&lt;br /&gt;
= \frac{x}{\lambda} \sum_{i=1}^{\infty}  \frac{\left [ \frac{x}{\lambda}\right]^{(i-1)}}{(i-1)!} e^{\frac{-x}{\lambda}} = \frac{x}{\lambda} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x,\mu) = \frac{\mu^x e^{-\mu}}{x!} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Variance of Poisson Dist====&lt;br /&gt;
&lt;br /&gt;
For [http://wiki.iac.isu.edu/index.php/TF_ErrAna_Homework#Poisson_Prob_Dist Homework] you will show, in a manner similar to the above mean calculation, that the variance of the Poisson distribution is &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Gaussian===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Gaussian (Normal) distribution is an approximation of the Binomial distribution for the case of a large number of possible different observations.  Poisson approximated the binomial distribution for the case when p&amp;lt;&amp;lt;1 ( the average number of successes is a lot smaller than the number of trials &amp;lt;math&amp;gt;(\mu = np)&amp;lt;/math&amp;gt; ).&lt;br /&gt;
&lt;br /&gt;
The Gaussian distribution is accepted as one of the most likely distributions to describe measurements.&lt;br /&gt;
&lt;br /&gt;
A Gaussian distribution which is normalized such that its integral is unity is refered to as the Normal distribution.  You could mathematically construct a Gaussian distribution which is not normalized to unity (this is often done when fitting experimental data).&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_G(x,\mu, \sigma) = \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{1}{2} \left( \frac{x -\mu}{\sigma} \right) ^2}&amp;lt;/math&amp;gt; = probability of observing &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; from a Gaussian parent distribution with a mean &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt; and standard deviation &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Half-Width &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; (a.k.a. Full Width as Half Max)====&lt;br /&gt;
&lt;br /&gt;
The half width &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is used to describe the range of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; through which the distributions amplitude decreases to half of its maximum value.&lt;br /&gt;
&lt;br /&gt;
;ie: &amp;lt;math&amp;gt;P_G(\mu \pm \frac{\Gamma}{2}, \mu, \sigma) = \frac{P_G(\mu,\mu,\sigma)}{2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Side note:the point of steepest descent is located at &amp;lt;math&amp;gt;x \pm \sigma&amp;lt;/math&amp;gt;  such that &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;math&amp;gt;P_G(\mu \pm \sigma, \mu, \sigma) = e^{1/2} P_G(\mu,\mu,\sigma)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Probable Error (P.E.)====&lt;br /&gt;
&lt;br /&gt;
The probable error is the range of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; in which half of the observations (values of &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;) are expected to fall.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;math&amp;gt;x= \mu \pm P.E.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Binomial with Large N becomes Gaussian====&lt;br /&gt;
&lt;br /&gt;
Consider the binomial distribution in which a fair coin is tossed a large number of times (N is very large and and EVEN number N=2n)&lt;br /&gt;
&lt;br /&gt;
What is the probability you get exactly &amp;lt;math&amp;gt;\frac{1}{2}N -s&amp;lt;/math&amp;gt; heads and &amp;lt;math&amp;gt;\frac{1}{2}N +s&amp;lt;/math&amp;gt; tails where s is an integer?&lt;br /&gt;
&lt;br /&gt;
The Binomial Probability distribution is given as&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_B(x) = {N\choose x}p^{x}q^{N-x}  = \frac{N!}{x!(N-x)!}p^{x}q^{N-x}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
p = probability of success= 1/2&lt;br /&gt;
&lt;br /&gt;
q= 1-p = 1/2&lt;br /&gt;
&lt;br /&gt;
N = number of trials =2n&lt;br /&gt;
&lt;br /&gt;
x= number of successes=n-s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_B(n-s)   = \frac{2n!}{(n-s)!(2n-n+s)!}p^{n-s}q^{2n-n+s}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{2n!}{(n-s)!(n+s)!}p^{n-s}q^{n+s}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{2n!}{(n-s)!(n+s)!} \left(\frac{1}{2}\right)^{n-s} \left(\frac{1}{2}\right)^{n+s}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \frac{2n!}{(n-s)!(n+s)!} \left(\frac{1}{2}\right)^{2n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now let's cast this probability with respect to the probability that we get an even number of heads and tails by defining the following ratio R such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;R \equiv \frac{P_B(n-s)}{P_B(n)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_B(x=n) = \frac{N!}{n!(N-n)!}p^{n}q^{N-n} = \frac{(2n)!}{n!(n)!}p^{n}q^{n} =  \frac{(2n)!}{(n)!(n)!} \left(\frac{1}{2}\right)^{2n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;R = \frac{\frac{2n!}{(n-s)!(n+s)!} \left(\frac{1}{2}\right)^{2n}}{\frac{(2n)!}{(n)!(n)!} \left(\frac{1}{2}\right)^{2n}} = \frac{n! n!}{(n-s)! (n+s)!}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take the natural logarithm of both sides&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \ln (R) = \ln \left ( \frac{n! n!}{(n-s)! (n+s)!} \right) = \ln(n!)+\ln(n!) - \ln\left[(n-s)!\right ] - \ln \left[(n+s)!\right] = 2 \ln(n!) - \ln\left [ (n-s)! \right ] - \ln \left [ (n+s)! \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stirling's Approximation says&lt;br /&gt;
:&amp;lt;math&amp;gt;n! \sim \left (2 \pi n\right)^{1/2} n^n e^{-n}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow &amp;lt;/math&amp;gt;&lt;br /&gt;
;&amp;lt;math&amp;gt;\ln(n!) \sim  \ln \left [ \left (2 \pi n\right)^{1/2} n^n e^{-n}\right ] = \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ n^{1/2} \right  ] +\ln\left [ n^n \right ] + \ln \left [e^{-n}\right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ n^{1/2} \right  ] +n\ln\left [ n \right ] + (-n)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ n^{1/2} \right  ] +n(\ln\left [ n \right ] -1 )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
similarly&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\ln\left [(n-s)! \right ] \sim   \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ (n-1)^{1/2} \right  ] + (n-s)(\ln\left [ (n-s) \right ] -1 )&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\ln\left [(n+s)! \right ] \sim   \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ (n+1)^{1/2} \right  ] + (n+s)(\ln\left [ (n+s) \right ] -1 )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow \ln (R) = 2 \times  \left (\ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ n^{1/2} \right  ] +n(\ln\left [ n \right ] -1 ) \right ) &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;- \left ( \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ (n-1)^{1/2} \right  ] + (n-s)(\ln\left [ (n-s) \right ] -1 )\right )&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt; -\left ( \ln \left [ \left (2 \pi \right)^{1/2} \right ] +\ln  \left [ (n+1)^{1/2} \right  ] + (n+s)(\ln\left [ (n+s) \right ] -1 )\right ) &amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2 \ln  \left [ n^{1/2} \right  ] +2 n(\ln\left [ n \right ] -1 )  - \ln  \left [ (n-1)^{1/2} \right  ] - (n-s)(\ln\left [ (n-s) \right ] -1 ) -\ln  \left [ (n+1)^{1/2} \right  ] - (n+s)(\ln\left [ (n+s) \right ] -1 )&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\ln  \left [ n^{1/2} \right  ] = \ln  \left [ (n-1)^{1/2} \right  ]  = \ln  \left [ (n+1)^{1/2} \right  ]&amp;lt;/math&amp;gt; For Large n&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \ln (R) =  2 n(\ln\left [ n \right ] -1 )   - (n-s)(\ln\left [ (n-s) \right ] -1 ) - (n+s)(\ln\left [ (n+s) \right ] -1 )&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; =2 n(\ln\left [ n \right ] -1 )   - (n-s)(\ln\left [ n(1-s/n) \right ] -1 ) - (n+s)(\ln\left [ n(1+s/n) \right ] -1 )&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= 2n \ln (n) - 2n - (n-s) \left [ \ln (n) + \ln (1-s/n) -1\right ] - (n+s) \left [ \ln (n) + \ln (1+s/n) -1\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=  - 2n - (n-s) \left [  \ln (1-s/n) -1\right ] - (n+s) \left [  \ln (1+s/n) -1\right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;=   - (n-s) \left [  \ln (1-s/n) \right ] - (n+s) \left [  \ln (1+s/n) \right ]&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;-1 &amp;lt; s/n \le 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\ln (1+s/n) = s/n - \frac{s^2}{2n^2} + \frac{s^3}{3 n^3} \dots&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\ln(R) =- (n-s) \left [    -s/n - \frac{s^2}{2n^2} - \frac{s^3}{3 n^3} \right ] - (n+s) \left [   s/n - \frac{s^2}{2n^2} + \frac{s^3}{3 n^3}  \right ]&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= - \frac{s^2}{n} = - \frac{2s^2}{N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;R \sim e^{-2s^2/N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as a result &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P(n-s) = R P_B(n)&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P_B(x=n)=  \frac{(2n)!}{(n)!(n)!} \left(\frac{1}{2}\right)^{2n} =  \frac{(\left ( \left (2 \pi 2n\right)^{1/2} (2n)^{2n} e^{-2n}\right ) }{\left(\left (2 \pi n\right)^{1/2} n^n e^{-n}\right ) \left ( \left (2 \pi n\right)^{1/2} n^n e^{-n}\right)}  \left(\frac{1}{2}\right)^{2n}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= \left(\frac{1}{\pi n} \right )^{1/2} = \left(\frac{2}{\pi N} \right )^{1/2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(n-s) = \left(\frac{2}{\pi N} \right )^{1/2} e^{-2s^2/N}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In binomial distributions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma^2 = Npq = \frac{N}{4}&amp;lt;/math&amp;gt; for this problem&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;N = 4 \sigma^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(n-s) = \left(\frac{2}{\pi 4 \sigma^2} \right )^{1/2} e^{-2s^2/N} = \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{2s^2}{4 \sigma^2}}  = \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{1}{2} \left( \frac{s}{\sigma} \right) ^2}&amp;lt;/math&amp;gt; &lt;br /&gt;
= probability of exactly &amp;lt;math&amp;gt;(\frac{N}{2} -s)&amp;lt;/math&amp;gt; heads AND &amp;lt;math&amp;gt;(\frac{N}{2} +s)&amp;lt;/math&amp;gt; tails after flipping the coin N times (N is and even number and s is an integer).&lt;br /&gt;
&lt;br /&gt;
If we let &amp;lt;math&amp;gt;x = n-s&amp;lt;/math&amp;gt;  and realize that  for a binomial distributions&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mu = Np = N/2 = n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(x) = \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{1}{2} \left( \frac{n-x}{\sigma} \right) ^2} = \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{1}{2} \left( \frac{x - \mu}{\sigma} \right) ^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; So when N gets big the Gaussian distribution is a good approximation to the Binomianl&lt;br /&gt;
&lt;br /&gt;
==== Gaussian approximation to Poisson when &amp;lt;math&amp;gt;\mu \gg 1&amp;lt;/math&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(r) = \frac{\mu^r e^{-\mu}}{r!}&amp;lt;/math&amp;gt; = Poisson probability distribution&lt;br /&gt;
&lt;br /&gt;
substitute&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x \equiv r - \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x + \mu) = \frac{\mu^{x + \mu} e^{-\mu}}{(x+\mu)!} = e^{-\mu} \frac{\mu^{\mu} \mu^x}{(\mu + x)!} = e^{-\mu} \mu^{\mu}\frac{\mu^x}{(\mu)! (\mu+1) \dots (\mu+x)}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; =  e^{-\mu} \frac{\mu^{\mu}}{\mu!} \left [ \frac{\mu}{(\mu+1)} \cdot  \frac{\mu}{(\mu+2)}  \dots \frac{\mu}{(\mu+x)}  \right ] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;e^{-\mu} \frac{\mu^{\mu}}{\mu!}  = e^{-\mu} \frac{\mu^{\mu}}{\sqrt{2 \pi \mu} \mu^{\mu}e^{-\mu}}=  \frac{1}{\sqrt{2 \pi \mu}}&amp;lt;/math&amp;gt; '''Stirling's Approximation when &amp;lt;math&amp;gt;\mu \gg 1&amp;lt;/math&amp;gt;''' &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x + \mu) =  \frac{1}{\sqrt{2 \pi \mu}} \left [ \frac{\mu}{(\mu+1)} \cdot  \frac{\mu}{(\mu+2)}  \dots \frac{\mu}{(\mu+x)}  \right ] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\left [ \frac{\mu}{(\mu+1)} \cdot\frac{\mu}{(\mu+2)}  \dots \frac{\mu}{(\mu+x)}  \right ]  = \frac{1}{1 + \frac{1}{\mu}} \cdot  \frac{1}{1 + \frac{2}{\mu}} \dots  \frac{1}{1 + \frac{x}{\mu}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;e^{x/\mu} \approx 1 + \frac{x}{\mu}&amp;lt;/math&amp;gt;  : if &amp;lt;math&amp;gt;x/\mu \ll 1&amp;lt;/math&amp;gt;  Note:&amp;lt;math&amp;gt;x \equiv r - \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x + \mu) =  \frac{1}{\sqrt{2 \pi \mu}} \left [  \frac{1}{1 + \frac{1}{\mu}} \cdot  \frac{1}{1 + \frac{2}{\mu}} \dots  \frac{1}{1 + \frac{x}{\mu}} \right ]  = \frac{1}{\sqrt{2 \pi \mu}} \left [  e^{-1/\mu} \times e^{-2/\mu} \cdots e^{-x/\mu}  \right ] = \frac{1}{\sqrt{2 \pi \mu}} e^{-1 \left[ \frac{1}{\mu} +\frac{2}{\mu} \cdots \frac{x}{\mu}  \right ]}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{1}{\sqrt{2 \pi \mu}} e^{\frac{-1}{\mu} \left[ \sum_1^x i \right ]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
another mathematical identity&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sum_{i=1}^{x} i = \frac{x}{2}(1+x)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x + \mu) =  \frac{1}{\sqrt{2 \pi \mu}} e^{\frac{-1}{\mu} \left[ \frac{x}{2}(1+x) \right ]}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if&amp;lt;math&amp;gt; x \gg 1&amp;lt;/math&amp;gt; then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{x}{2}(1+x) \approx \frac{x^2}{2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(x + \mu) =  \frac{1}{\sqrt{2 \pi \mu}} e^{\frac{-1}{\mu} \left[ \frac{x^2}{2} \right ]} = \frac{1}{\sqrt{2 \pi \mu}} e^{\frac{-x^2}{2\mu} }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the Poisson distribution &lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \mu&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
replacing dummy variable x with r - \mu&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_P(r) =  \frac{1}{\sqrt{2 \pi \sigma^2}} e^{\frac{-(r - \mu)^2}{2\sigma^2} } =\frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{1}{2} \left( \frac{r -\mu}{\sigma} \right) ^2}&amp;lt;/math&amp;gt; = Gaussian distribution when &amp;lt;math&amp;gt;\mu \gg 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Integral Probability (Cumulative Distribution Function)====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Poisson and Binomial distributions are discrete probability distributions (integers).&lt;br /&gt;
&lt;br /&gt;
The Gaussian distribution is our first continuous distribution as the variables are real numbers.  It is not very meaningful to speak of the probability that the variate (x) assumes a specific value.  &lt;br /&gt;
&lt;br /&gt;
One could consider defining a  probability element &amp;lt;math&amp;gt;A_G&amp;lt;/math&amp;gt; which is really an integral over a finite region &amp;lt;math&amp;gt;\Delta x&amp;lt;/math&amp;gt; such that&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;A_G(\Delta x, \mu, \sigma) = \frac{1}{\sigma \sqrt{2 \pi}} \int_{\mu - \Delta x}^{\mu + \Delta x} e^{- \frac{1}{2} \left ( \frac{x - \mu}{\sigma}\right )^2} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantage of this definition becomes apparent when you are interesting in quantifying the probability that a measurement would fall outside a range &amp;lt;math&amp;gt;\Delta x&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P_G( x - \Delta x &amp;gt; x &amp;gt; x + \Delta x) = 1 - A_G(\Delta x, \mu, \sigma)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Cumulative Distribution Function (CDF), however, is defined in terms of the integral from the variates min value&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;CDF \equiv \int_{x_{min}}^{x} P_G( x, \mu, \sigma) = \int_{-\infty}^{x} P_G( x, \mu, \sigma) =  P_G(X \le x) =&amp;lt;/math&amp;gt; Probability that you measure a value less than or equal to &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== discrete CDF example =====&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The probability that a student fails this class is 7.3%.&lt;br /&gt;
&lt;br /&gt;
What is the probability more than 5 student will fail in a class of 32 students?&lt;br /&gt;
&lt;br /&gt;
Answ:  &amp;lt;math&amp;gt;P_B(x\ge 5) = \sum_{x=5}^{32} P_B(x) = CDF( x \ge 5) = 1- \sum_{x=0}^4 P_B(x) = 1 - CDF(x&amp;lt;5) &amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;= 1 - P_B(x=0)- P_B(x=1)- P_B(x=2)- P_B(x=3)- P_B(x=4)&amp;lt;/math&amp;gt; &lt;br /&gt;
: &amp;lt;math&amp;gt;= 1 - 0.088 - 0.223 - 0.272 - 0.214 - 0.122 = 0.92 \Rightarrow P_B(x \ge 5) = 0.08&amp;lt;/math&amp;gt;= 8%&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is an 8% probability that 5 or more student will fail the class&lt;br /&gt;
&lt;br /&gt;
===== 2 SD rule of thumb for Gaussian PDF =====&lt;br /&gt;
&lt;br /&gt;
In the above example you calculated the probability that more than 5 student will fail a class.  You can extend this principle to calculate the probability of taking a measurement which exceeds the expected mean value.  &lt;br /&gt;
&lt;br /&gt;
One of the more common consistency checks you can make on a sample data set which you expect to be from a Gaussian distribution is to ask how many data points appear more than 2 S.D. (&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;) from the mean value.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The CDF for this is&lt;br /&gt;
: &amp;lt;math&amp;gt;P_G(X \le \mu - 2 \sigma, \mu , \sigma ) = \int_{-\infty}^{\mu - 2\sigma} P_G(x, \mu, \sigma) dx&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{1}{\sigma \sqrt{2 \pi}} \int_{-\infty}^{\mu - 2\sigma} e^{- \frac{1}{2} \left ( \frac{x - \mu}{\sigma}\right )^2} dx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;z = \frac{x-2}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;dz = \frac{dx}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;\Rightarrow P_G(X \le \mu - 2 \sigma, \mu , \sigma ) =  \frac{1}{ \sqrt{2 \pi}} \int_{-\infty}^{\mu - 2\sigma} e^{- \frac{z^2}{2} } dz&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above integral can only be done numerically by expanding the exponential in a power series&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;e^x = \sum_{n=0}^{\infty} \frac{x^n}{n!}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow e^{-x} = 1 -x + \frac{x^2}{2!} - \frac{x^3}{3!} \cdots&amp;lt;/math&amp;gt; &lt;br /&gt;
:&amp;lt;math&amp;gt;\Rightarrow e^{-z^2/2} = 1 -\frac{z^2}{2}+ \frac{z^4}{8} - \frac{z^6}{48} \cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;P_G(X \le \mu - 2 \sigma, \mu , \sigma ) =  \frac{1}{ \sqrt{2 \pi}} \int_{-\infty}^{\mu - 2\sigma}  \left ( 1 -\frac{z^2}{2}+ \frac{z^4}{8} - \frac{z^6}{48} \cdots \right)dz&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; = \left . \frac{1}{ \sqrt{2 \pi}} \left ( z  -\frac{z^3}{6}+ \frac{z^5}{40} - \frac{z^7}{48 \times 7} \cdots   \right ) \right |_{-\infty}^{\mu - 2\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;=\left .  \frac{1}{\pi} \sum_{j=0}^{\infty} \frac{(-1)^j \left (\frac{x}{\sqrt{2}} \right)^{2j+1}}{j! (2j+1)} \right |_{x=\mu - 2\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No analytical for the probability but one which you can compute.&lt;br /&gt;
&lt;br /&gt;
Below is a table representing the cumulative probability &amp;lt;math&amp;gt;P_G(x&amp;lt; \mu - \delta \mbox{ and }  x&amp;gt; \mu + \delta , \mu, \sigma)&amp;lt;/math&amp;gt; for events to occur outside and interval of &amp;lt;math&amp;gt;\pm \delta&amp;lt;/math&amp;gt; in a Gaussian distribution&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;  |cellpadding=&amp;quot;20&amp;quot; cellspacing=&amp;quot;0 &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;P_G(x&amp;lt; \mu - \delta \mbox{ and } x&amp;gt; \mu + \delta , \mu, \sigma)&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;\delta&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;3.2 \times 10^{-1}&amp;lt;/math&amp;gt; ||1&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;4.4 \times 10^{-2}&amp;lt;/math&amp;gt; ||2&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;2.7 \times 10^{-3}&amp;lt;/math&amp;gt; ||3&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;6.3 \times 10^{-5}&amp;lt;/math&amp;gt; ||4&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:TF_Error_CDF_Gauss.png| 400 px]]&lt;br /&gt;
&lt;br /&gt;
===Cauchy/Lorentzian/Breit-Wigner Distribution===&lt;br /&gt;
In Mathematics, the Cauchy distribution is written as&lt;br /&gt;
:&amp;lt;math&amp;gt;P_{CL}(x, x_0, \Gamma) = \frac{1}{\pi} \frac{\Gamma/2}{(x -x_0)^2 + (\Gamma/2)^2}&amp;lt;/math&amp;gt; = Cauchy-Lorentian Distribution&lt;br /&gt;
&lt;br /&gt;
:Note; The probability does not fall as rapidly to zero as the Gaussian.  As a result, the Gaussian's central peak contributes more to the area than the Lorentzian's.&lt;br /&gt;
&lt;br /&gt;
This distribution happens to be a solution to physics problems involving forced resonances (spring systems driven by a source, or a nuclear interaction which induces a metastable state).&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_{BW} = \sigma(E)=  \frac{1}{2\pi}\frac{\Gamma}{(E-E_0)^2 + (\Gamma/2)^2}&amp;lt;/math&amp;gt; = Breit-Wigner distribution&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;E_0 =&amp;lt;/math&amp;gt; mass resonance&lt;br /&gt;
:&amp;lt;math&amp;gt;\Gamma = &amp;lt;/math&amp;gt;FWHM&lt;br /&gt;
: &amp;lt;math&amp;gt;\Delta E \Delta t = \Gamma \tau = \frac{h}{2 \pi}&amp;lt;/math&amp;gt; = uncertainty principle&lt;br /&gt;
:&amp;lt;math&amp;gt;\tau=&amp;lt;/math&amp;gt;lifetime of resonance/intermediate state particle&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A Beit-Wigner function fit to cross section measured as a function of energy will allow one to evaluate the rate increases that are produced when the probing energy excites a resonant state that has a mass &amp;lt;math&amp;gt;E_0&amp;lt;/math&amp;gt; and lasts for the time &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; derived from the Half Width &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== mean====&lt;br /&gt;
&lt;br /&gt;
Mean is not defined&lt;br /&gt;
&lt;br /&gt;
Mode = Median = &amp;lt;math&amp;gt;x_0&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;E_0&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==== Variance ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The variance is also not defined but rather the distribution is parameterized in terms of the Half Width &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let &lt;br /&gt;
:&amp;lt;math&amp;gt;z = \frac{x-\mu}{\Gamma/2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \frac{\Gamma^2}{4\pi} \int_{-\infty}^{\infty} \frac{z^2}{1+z^2} dz&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above integral does not converge for large deviations &amp;lt;math&amp;gt;(x -\mu)&amp;lt;/math&amp;gt; .  The width of the distribution is instead characterized by &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; = FWHM&lt;br /&gt;
&lt;br /&gt;
===Landau===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_L(x) = \frac{1}{2 \pi i} \int_{c-i\infty}^{c+i\infty}\! e^{s \log s + x s}\, ds &amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;c&amp;lt;/math&amp;gt; is any positive real number.&lt;br /&gt;
&lt;br /&gt;
To simplify computation it is more convenient to use the equivalent expression&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;P_L(x) = \frac{1}{\pi} \int_0^\infty\! e^{-t \log t - x t} \sin(\pi t)\, dt.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above distribution was derived by Landau (L. Landau, &amp;quot;On the Energy Loss of Fast Particles by Ionization&amp;quot;, J. Phys., vol 8 (1944), pg 201 ) to describe the energy loss by particles traveling through thin material ( materials with a thickness on the order of a few radiation lengths).&lt;br /&gt;
&lt;br /&gt;
Bethe-Bloch derived an expression to determine the AVERAGE amount of energy lost by a particle traversing a given material &amp;lt;math&amp;gt;(\frac{dE}{dx})&amp;lt;/math&amp;gt; assuming several collisions which span the physical limits of the interaction.&lt;br /&gt;
&lt;br /&gt;
For the case a thin absorbers, the number of collisions is so small that the central limit theorem used to average over several collision doesn't apply and there is a finite possibility of observing large energy losses.&lt;br /&gt;
&lt;br /&gt;
As a result one would expect a distribution which is Gaussian like but with a &amp;quot;tail&amp;quot; on the &amp;lt;math&amp;gt;\mu + \sigma&amp;lt;/math&amp;gt; side of the distribution.&lt;br /&gt;
&lt;br /&gt;
===Gamma===&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P_{\gamma}(x,k,\theta) = x^{k-1} \frac{e^{-x/\theta}}{\theta^k \, \Gamma(k)}\text{ for } x &amp;gt; 0\text{ and }k, \theta &amp;gt; 0.\,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt; \Gamma(z) = \int_0^\infty  t^{z-1} e^{-t}\,dt\;&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The distribution is used for &amp;quot;waiting time&amp;quot; models.  How long do you need to wait for a rain storm, how long do you need to wait to die,...&lt;br /&gt;
&lt;br /&gt;
Climatologists use this for predicting how rain fluctuates from season to season.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;math&amp;gt;k =&amp;lt;/math&amp;gt; integer then the above distribution is a sum of &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; independent exponential distributions&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P_{\gamma}(x,k,\theta) = 1 - e^{-x/\theta} \sum_{j=0}^{k-1}\frac{1}{j!}\left ( \frac{x}{\theta}\right)^j &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Mean====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = k \theta&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Variance====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = k \theta^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Properties====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\lim_{X \rightarrow \infty} P_{\gamma}(x,k,\theta) = \left \{  {\infty \;\;\;\; k &amp;lt;1 \atop 0 \;\;\;\; k&amp;gt;1} \right .&amp;lt;/math&amp;gt;&lt;br /&gt;
: &amp;lt;math&amp;gt;= \frac{1}{\theta} \;\; \mbox{if} k=1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Beta===&lt;br /&gt;
:&amp;lt;math&amp;gt; P_{\beta}(x;\alpha,\beta) = \frac{x^{\alpha-1}(1-x)^{\beta-1}}{\int_0^1 u^{\alpha-1} (1-u)^{\beta-1}\, du} \!&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;= \frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)}\, x^{\alpha-1}(1-x)^{\beta-1}\!&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;= \frac{1}{\mathrm{B}(\alpha,\beta)}\, x&lt;br /&gt;
^{\alpha-1}(1-x)^{\beta-1}\!&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Mean====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = \frac{\alpha}{\alpha + \beta}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variance====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\sigma^2 = \frac{\alpha \beta }{(\alpha + \beta)^2 (\alpha + \beta + 1)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Exponential===&lt;br /&gt;
&lt;br /&gt;
The exponential distribution may be used to describe the processes that are in between Binomial and Poisson (exponential decay)&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; P_{e}(x,\lambda) = \left \{  {\lambda e^{-\lambda x} \;\;\;\; x \ge 0\atop 0 \;\;\;\; x&amp;lt;0} \right .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; CDF_{e}(x,\lambda) = \left \{  {\lambda 1-e^{-\lambda x} \;\;\;\; x \ge 0\atop 0 \;\;\;\; x&amp;lt;0} \right .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Mean====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = \frac{1}{\lambda}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Variance ====&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\mu = \frac{1}{\lambda^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Skewness and Kurtosis==&lt;br /&gt;
&lt;br /&gt;
Distributions may also be characterized by how they look in terms of Skewness and Kurtosis&lt;br /&gt;
&lt;br /&gt;
=== Skewness===&lt;br /&gt;
&lt;br /&gt;
Measures the symmetry of the distribution&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Skewness = &amp;lt;math&amp;gt;\frac{\sum (x_i - \bar{x})^3}{(N-1)s^3} = \frac{\mbox{3rd moment}}{\mbox{2nd moment}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
:&amp;lt;math&amp;gt;s^2 = \frac{\sum (x_i - \bar{x})^2}{N-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;The higher the number the more asymmetric (or skewed) the distribution is.  The closer to zero the more symmetric.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A negative skewness indicates a tail on the left side of the distribution.&lt;br /&gt;
Positive skewness indicates a tail on the right.&lt;br /&gt;
&lt;br /&gt;
===Kurtosis===&lt;br /&gt;
&lt;br /&gt;
Measures the &amp;quot;pointyness&amp;quot; of the distribution&lt;br /&gt;
&lt;br /&gt;
Kurtosis = &amp;lt;math&amp;gt;\frac{\sum (x_i - \bar{x})^4}{(N-1)s^4}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &lt;br /&gt;
:&amp;lt;math&amp;gt;s^2 = \frac{\sum (x_i - \bar{x})^2}{N-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
K=3 for Normal Distribution&lt;br /&gt;
&lt;br /&gt;
In ROOT the Kurtosis entry in the statistics box is really the &amp;quot;excess kurtosis&amp;quot; which is the subtraction of the kurtosis by 3&lt;br /&gt;
&lt;br /&gt;
Excess Kurtosis = &amp;lt;math&amp;gt;\frac{\sum (x_i - \bar{x})^4}{(N-1)s^4} - 3&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case a Positive excess Kurtosis will  indicate a peak that is sharper than a gaussian while a negative value will indicate a peak that is flatter than a comparable Gaussian distribution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:ForeErrAna_Gaus-Cauchy_SkeKurt.gif|200 px]][[File:ForeErrAna_Gaus-Landau_SkeKurt.gif|200 px]][[File:ForeErrAna_Gaus-gamma_SkeKurt.gif|200 px]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Forest_Error_Analysis_for_the_Physical_Sciences] [[Forest_Error_Analysis_for_the_Physical_Sciences]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=Chriss%27_Work_Page&amp;diff=71906</id>
		<title>Chriss' Work Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=Chriss%27_Work_Page&amp;diff=71906"/>
		<updated>2012-03-12T19:19:32Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: Created page with 'This is a temporary blank page for material related to Chriss Jackson's work with the rotating W target.'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a temporary blank page for material related to Chriss Jackson's work with the rotating W target.&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=HRRL_Positron_Rotating_W_Target&amp;diff=71905</id>
		<title>HRRL Positron Rotating W Target</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=HRRL_Positron_Rotating_W_Target&amp;diff=71905"/>
		<updated>2012-03-12T19:17:43Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=45 degree angle=&lt;br /&gt;
&lt;br /&gt;
The Tungsten target should make a 45 degree angle with the beam.&lt;br /&gt;
&lt;br /&gt;
 make the motor so it can be rotated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Beam Heat Load=&lt;br /&gt;
&lt;br /&gt;
;Accelerator Settings&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
| beam energy || 10 MeV&lt;br /&gt;
|-&lt;br /&gt;
| Rep Rate: ||   300 Hz&lt;br /&gt;
|-&lt;br /&gt;
| I_peak:     || 200 mA/pulse&lt;br /&gt;
|-&lt;br /&gt;
| pulse width:|| 0.1 &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;s (100 ns)&lt;br /&gt;
|-&lt;br /&gt;
| Vacuum:|| &amp;lt;math&amp;gt;10^{-8}&amp;lt;/math&amp;gt; Torr&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;math&amp;gt;200 \frac{\mbox{mA}}{\mbox{pulse}} \times 300 \frac{\mbox{pulses}}{\mbox{sec}} \times 0.1 \mu \mbox{s}= 60 \mu A&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Time on for one second is 30 us. and Time off is 0.999999 s The average current 0.999999 * 0 + 0.000001*300*200mA = &lt;br /&gt;
60&amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;A.&lt;br /&gt;
&lt;br /&gt;
''P'' = (10 MeV) &amp;lt;math&amp;gt;\times&amp;lt;/math&amp;gt; (60 &amp;lt;math&amp;gt;\mu&amp;lt;/math&amp;gt;A) = 600 Watts.&lt;br /&gt;
&lt;br /&gt;
=Target Chamber design=&lt;br /&gt;
&lt;br /&gt;
Latest Design From empire and Sadiq's measurement of the available space&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;20&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:EmpMagHRRLPositronTargetChamberDrw_9-20-11.png | 200 px]]||[[File:HRRLPositronTargetSpace_10-5-11.png | 200 px]] || [[File:HRRLPositronTargetCoupler_10-5-11.png | 200 px]]|| [[File:HRRLPositronTargetHub_10-5-11.png | 200 px]]&lt;br /&gt;
|-&lt;br /&gt;
| Target motor Design  || Available beam line space || Motor axle coupling to rotary union || Hub and spline to attache targets&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Dimensions are in inches&lt;br /&gt;
&lt;br /&gt;
[[File:HRRLPositronTargetChamber_4-20-11.png | 200 px]]&lt;br /&gt;
&lt;br /&gt;
There is an 18&amp;quot; space in Z for the target chamber.  If you want to rotate a disk on the 5&amp;quot; wide motor you will need at least a a 10&amp;quot; x 10&amp;quot; area.&lt;br /&gt;
&lt;br /&gt;
So we could try as a first design a chamber which is 18&amp;quot; x 15&amp;quot; x 15&amp;quot;.&lt;br /&gt;
We need the following&lt;br /&gt;
&lt;br /&gt;
*2 beam flanges flush with the walls of the chamber.&lt;br /&gt;
*2 flanges to allow access for hands to work on the target motor inside.  It should able to fit hands through.&lt;br /&gt;
*a flange on top which will allow a 10&amp;quot; diameter target disk to come out.&lt;br /&gt;
*a flange on the bottom for the ion pump.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
July Design From empire&lt;br /&gt;
&lt;br /&gt;
[[File:EmpMagHRRLPositronTargetChamberDrw_7-25-11.png | 200 px]]&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;20&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:EmpMagHRRLPositronTargetChamberPict_7-25-11.png | 200 px]]||[[File:EmpMagStatorCoolLines_7-26-11.png | 200 px]]&lt;br /&gt;
|-&lt;br /&gt;
| Rotary Union overlayed on conceptual drawing.   || Conceptual drawing of stator cooling lines.  We will need separate connection to them on the vacuum chamber.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Gate Valve - Target distance=&lt;br /&gt;
&lt;br /&gt;
The distance from the front of the gate valve to the most beam upstream part of the target chamber is&lt;br /&gt;
&lt;br /&gt;
88.43 cm&lt;br /&gt;
&lt;br /&gt;
The gate valve closes in 0.7 sec.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So water would need to travel at a speed of 88.43 cm/0.7 sec = 1.26 m/sec&lt;br /&gt;
&lt;br /&gt;
= Properties of Tungsten=&lt;br /&gt;
&lt;br /&gt;
*Melting Point = 3695 K.&lt;br /&gt;
&lt;br /&gt;
*Heat Capacity = &amp;lt;math&amp;gt;(25~ ^{o}C)~ 24.27 ~ J ~ mol^{-1} ~ K^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*These data are from: [http://en.wikipedia.org/wiki/Tungsten Tungsten]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Heat loss due to radiation: ( \sigma T^4)&lt;br /&gt;
&lt;br /&gt;
=Tungsten Temperature as a function of heat load=&lt;br /&gt;
&lt;br /&gt;
*IAC beamline pressure = &amp;lt;math&amp;gt;10^{-8} &amp;lt;/math&amp;gt; Torr&lt;br /&gt;
&lt;br /&gt;
*The Tungsten heats up when an MeV energy electron impinges its surface.  The imperfect vacuum inside the beam pipe does allow some radiative cooling.&lt;br /&gt;
&lt;br /&gt;
*Conduction and Radiation&lt;br /&gt;
&lt;br /&gt;
=Calculating Radiators Equilibrium Temperature=&lt;br /&gt;
&lt;br /&gt;
==1.Calculating number of particles per second ==&lt;br /&gt;
&lt;br /&gt;
We have electron beam of:&lt;br /&gt;
&lt;br /&gt;
Frequency:  f=1000Hz&lt;br /&gt;
&lt;br /&gt;
Peak current:  I=10~mAmp=0.01 Amp&lt;br /&gt;
&lt;br /&gt;
Pulse width: &amp;lt;math&amp;gt; \Delta t= 50~ns=5 \times10^{-8}&amp;lt;/math&amp;gt; seconds&lt;br /&gt;
&lt;br /&gt;
So, how many electrons we have in each second?&lt;br /&gt;
&lt;br /&gt;
By Q=It, we have&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                            &amp;lt;math&amp;gt; N \times e=f \times I \times \Delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Where N is the total electron numbers hits target per second, e is electron charge and f, I and ∆t are given above. Number of particle per second is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                            &amp;lt;math&amp;gt;  N = \frac {f \times I \times \Delta t}{e} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==2.Calculating Energy deposited per second==&lt;br /&gt;
&lt;br /&gt;
If we find the energy deposited by each electron and multiply to the total number of electrons in each second, we will find the total energy per second deposited in radiator.&lt;br /&gt;
&lt;br /&gt;
To find energy deposited by each electron, we need to use formula&lt;br /&gt;
&lt;br /&gt;
                               &amp;lt;math&amp;gt; E_{dep~one}={(\frac{dE}{dx})}_{coll}\times t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Where is &amp;lt;math&amp;gt; E_{dep~one} &amp;lt;/math&amp;gt; is energy deposited by one electron, &amp;lt;math&amp;gt; {(\frac{dE}{dx})}_{coll} &amp;lt;/math&amp;gt; is mean energy loss  (also stopping  power) by collision of electron  and &amp;lt;math&amp;gt; t &amp;lt;/math&amp;gt; is thickness of the radiator.&lt;br /&gt;
&lt;br /&gt;
Actually, energy loss of a electron comes from two parts: 1) the emission of electromagnetic radiation arising from scattering in the electric field of a nucleus (bremsstrahlung); 2) Collisional energy loss when passing through matter. Bremsstrahlung will not contribute to the temperature, because it is radiation.&lt;br /&gt;
&lt;br /&gt;
Stopping power can be found from nuclear data tables &amp;lt;math&amp;gt; (dE/dx)_{ave} &amp;lt;/math&amp;gt; and thickness is 0.001 times of radiation length. From Particle Data group we got radiation length and average total stopping powers around 15MeV for electrons in these materials from National Institute of Standards and Technology: [http://physics.nist.gov/PhysRefData/Star/Text/ESTAR.html Tungsten Stopping Power].&lt;br /&gt;
&lt;br /&gt;
===Table of Radiation Lengths===&lt;br /&gt;
Note:These data is from Particle Data group,Link: [http://pdg.lbl.gov/AtomicNuclearProperties/].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;20&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|Elements&lt;br /&gt;
|Radiation Lengths &amp;lt;math&amp;gt; (g/cm^{2} )&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|W || 6.76&lt;br /&gt;
|-&lt;br /&gt;
|}&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Table of energy calculations===&lt;br /&gt;
For the thickness of 0.001 Radiation Length (0.0001RL) of radiators. &lt;br /&gt;
Note: &amp;lt;math&amp;gt;(dE/dx)_{coll}&amp;lt;/math&amp;gt; is from National Institute of Standards and Technology. Link:  [[http://physics.nist.gov/PhysRefData/Star/Text/ESTAR.html]])&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;20&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Elements&lt;br /&gt;
|&amp;lt;math&amp;gt;(dE/dx)_{coll} (MeV \; cm^2/g)&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt; t~(  g~cm^{-2}&amp;lt;/math&amp;gt;)&lt;br /&gt;
|&amp;lt;math&amp;gt;E_{(dep~one)}&amp;lt;/math&amp;gt; (MeV)&lt;br /&gt;
|&amp;lt;math&amp;gt;E_{dep/s}&amp;lt;/math&amp;gt; (MeV/s)&lt;br /&gt;
|&amp;lt;math&amp;gt;E_{dep/s}&amp;lt;/math&amp;gt; (J/s)&lt;br /&gt;
|-&lt;br /&gt;
|W  ||1.247 ||0.00676 ||0.00842972 ||&amp;lt;math&amp;gt;2.63*10^{10}&amp;lt;/math&amp;gt;  ||&amp;lt;math&amp;gt;4.21*10^{-3}&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In above table,we took the total numbers of electrons per second and multiply it to Energy deposited by one electron,get total energy deposited per second (which is power).&lt;br /&gt;
&lt;br /&gt;
                                          &amp;lt;math&amp;gt;P_{dep}= E_{dep}/s = ( E_{(dep~by~one)})\times(Number~of~electrons~per~second)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==3.Calculating equilibrium temperature using Stefan–Boltzmann law==&lt;br /&gt;
If we assume that there is no energy conduction and total energy is just radiated from two surfaces of the radiators which are as big as beam spot,in our case beam spot is 2mm in diameter.  According to Stefan–Boltzmann law, this total power radiated will be&lt;br /&gt;
 &lt;br /&gt;
                                            &amp;lt;math&amp;gt; P_{rad} =  A \sigma T^{4}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where T is radiating temperature P is the radiating power, A is surface area that beam incident and σ is Stefan–Boltzmann constant or Stefan's constant. To reach equilibrium temperature, Power deposited in and power radiated should be. So&lt;br /&gt;
                                            &amp;lt;math&amp;gt;  P_{dep}=P_{rad}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
so&lt;br /&gt;
&lt;br /&gt;
                                         &amp;lt;math&amp;gt; T = [  \frac{P_{dep}}{A\sigma} ]^{1/4} = [  \frac{N*E_{(dep~one)}}{A\sigma} ]^{1/4} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Vendors=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==MDC Target Chamber==&lt;br /&gt;
&lt;br /&gt;
Target chamber: MDC vacuum products can send a prefab one you just need to weld up.&lt;br /&gt;
&lt;br /&gt;
John Brooks&lt;br /&gt;
&lt;br /&gt;
jbrooks@mdcvacuum.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1-800-443-8817&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
510-265-3569&lt;br /&gt;
&lt;br /&gt;
[[File:TargetChamberDesign_1.0.pdf]]&lt;br /&gt;
&lt;br /&gt;
Tom Bogden (John's boss)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
MDC does not have a fast closing gate valve.  Model GV1500 closes in 0.7 seconds and costs $1600.  One that closes in 10 msec costs about $10k&lt;br /&gt;
&lt;br /&gt;
==Tungsten Disks==&lt;br /&gt;
&lt;br /&gt;
;Dimensions are in cm&lt;br /&gt;
&lt;br /&gt;
[[File:HRRL_PosTargetDesign_4-20-11.png| 200 px]]&lt;br /&gt;
&lt;br /&gt;
http://www.alibaba.com/product-gs/346924116/Tungsten_Disk_With_Screw.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://www.zlxtech.com.cn/products.asp?productcode=7401000404&lt;br /&gt;
&lt;br /&gt;
http://www.cleveland-tungsten.com/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the motor has a radius of 2.5&amp;quot; and I want to shield the motor from the beam using 2&amp;quot; of Pb and the beam is about 1&amp;quot; in diameter then I want a Tungsten disk that is &lt;br /&gt;
&lt;br /&gt;
5.21&amp;quot; in radius = 13.25 cm in radius ~ 30 cm in diameter&lt;br /&gt;
&lt;br /&gt;
Then density of Tungsten is&lt;br /&gt;
&lt;br /&gt;
19.25 g/cm^3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
19.25 g/cm^3 \times \pi (30 cm)^2 = 54,428 g/cm&lt;br /&gt;
&lt;br /&gt;
= 8.7 kg if it is 0.16 cm thick&lt;br /&gt;
&lt;br /&gt;
The moment of inertia for a disk  about its center is MR^2/2&lt;br /&gt;
&lt;br /&gt;
So I = 8.7kg \times (0.3 m)^2/2 = 0.4 kg m^2&lt;br /&gt;
&lt;br /&gt;
I should look into a ring of tungsten attached to a less dense material.&lt;br /&gt;
&lt;br /&gt;
VX-U42 torque is about 50 in-lbs = 5.65 N m&lt;br /&gt;
&lt;br /&gt;
Max acceleration would be&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\alpha = \frac{5.65 N m}{0.4 kg m^2} = 14.4 rad/sec \times \frac{1}{2 \pi} = 2.3 cycles/sec&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Brushless Motor==&lt;br /&gt;
&lt;br /&gt;
===Motor wiring diagram===&lt;br /&gt;
&lt;br /&gt;
[[Media:U-42EmpireMagneticsMotorWiringDiag.pdf]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Rick Halstead&lt;br /&gt;
&lt;br /&gt;
5830 Commerce Blvd&lt;br /&gt;
&lt;br /&gt;
Rohnert Park, CA 94928	 &lt;br /&gt;
	&lt;br /&gt;
Phone: 707-584-2801&lt;br /&gt;
&lt;br /&gt;
Fax: 707-584-3418	&lt;br /&gt;
&lt;br /&gt;
rick@empiremagnetics.com:&lt;br /&gt;
&lt;br /&gt;
The VX grade motors,  with dry lubes have been used in deep space (Wake&lt;br /&gt;
Shield Module)  where I'm told they were trying to get 10^-12 torr. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We need 10^{-8 }Torr&lt;br /&gt;
&lt;br /&gt;
Vacuum lab grade motor U42.&lt;br /&gt;
&lt;br /&gt;
http://www.empiremagnetics.com/prod_vac/prod_vac_vx_stepper_frame42.htm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tony:  Some of the couplings I had in mind:&lt;br /&gt;
http://www.sdp-si.com/estore/CoverPg/Couplings.htm  &lt;br /&gt;
&lt;br /&gt;
http://www.servometer.com/products/couplings/   &lt;br /&gt;
&lt;br /&gt;
I'm thinking the coupler with adaptation of a compression seal. &lt;br /&gt;
http://www.jaecofs.com/stainless-steel-compression-fittings.html &lt;br /&gt;
&lt;br /&gt;
The challenge will be to get them to make a version that can be sealed&lt;br /&gt;
at each end,  technically it is feasible,  it's an issue of engineering&lt;br /&gt;
resource to chase them down,  get a quote then propose it to you,  so&lt;br /&gt;
you can get funding.&lt;br /&gt;
&lt;br /&gt;
===Motor COntroller===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Jason Brickner&lt;br /&gt;
Olympus Controls&lt;br /&gt;
Tel. 208.475.4670 | Email jbrickner@olympus-controls.com&lt;br /&gt;
&lt;br /&gt;
===Torque===&lt;br /&gt;
&lt;br /&gt;
The MRI rotary Unions require 2 in-oz of torque each&lt;br /&gt;
&lt;br /&gt;
The U42 has a minimum static torque of 375 in-oz (1 Nm/8.851 oz-in) = 42.4 Nm&lt;br /&gt;
&lt;br /&gt;
The Momentum of inertia of a thin disk about its axial axis is&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;MR^2/2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moment of Inertia of a ring:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;MR^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The target will be a disk of Aluminum with an outer ring of tungsten.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I_{\mbox{Al disk}} =M_{\mbox{Al}} R^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;M_{\mbox{Al}}= \rho \times V = 2.7 g/cm^3 (0.2 cm) \times \pi ( 9 in 2.54 cm/in)^2 =2.7 g/cm^3 0.2 cm \pi 523 cm^2 = 886 g&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I_{\mbox{Al disk}} =886 g \times 523 cm^2 = 463423 g cm^2 \times (1 oz/28 g) (1 in/2.54 cm) (1in/2.54 cm) = 2565 oz-in^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;Torque = 42.4 Nm = I \alpha&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
\alpha = 42.4 Nm/(0.04 kg m^2))=1060 rad/sec^2&lt;br /&gt;
&lt;br /&gt;
I_{\mbox{W}} = MR^2 =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;M_{\mbox{W ring}} = 19.25 g/cm^3 \times \pi ((30 cm)^2 - (28.5 cm)^2) = 5.3 kg = 11.7 lbs&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I = 5.3 kg \times 29 cm^2 = 0.4457 kg m^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I_{tot} = I_{\mbox{Al disk}} + I_{\mbox{W}} = (0.04 + 0.4457) kg m^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\alpha = 42.4 Nm/(0.49 kg m^2) = 87 rad/s^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
How much time to accelerate to 50 Hz = &amp;lt;math&amp;gt;50 *2 *\pi&amp;lt;/math&amp;gt; rad/sec?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\omega_f = \alpha t^2/2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;t = \sqrt{\frac{2 \omega_f}{\alpha}} =\sqrt{\frac{2 50 8 2 *\pi}{87}} = 4.2&amp;lt;/math&amp;gt; seconds&lt;br /&gt;
&lt;br /&gt;
==Rotary coupler/Union==&lt;br /&gt;
&lt;br /&gt;
===ORNL rotating tungsten target===&lt;br /&gt;
&lt;br /&gt;
Full Name:	 Thomas J. McManamy&lt;br /&gt;
&lt;br /&gt;
Email Address:	 mcmanamytj@ornl.gov&lt;br /&gt;
&lt;br /&gt;
Phone Number:	 865-576-0039&lt;br /&gt;
&lt;br /&gt;
Fax Number:	 865-241-6909&lt;br /&gt;
&lt;br /&gt;
Postal Address:	 OAK RIDGE NATIONAL LABORATORY&lt;br /&gt;
&lt;br /&gt;
PO BOX 2008 MS6476&lt;br /&gt;
&lt;br /&gt;
OAK RIDGE TN 37831-6476&lt;br /&gt;
&lt;br /&gt;
http://www.ornl.gov/info/reporter/no116/nov09_dw.htm#revolution&lt;br /&gt;
&lt;br /&gt;
===DSTI===&lt;br /&gt;
&lt;br /&gt;
http://www.dsti.com/products/?gclid=CPWEvP6ogagCFRs5gwod6SSXtA&lt;br /&gt;
&lt;br /&gt;
Brett Villella&lt;br /&gt;
brett.villella@dsti.com&lt;br /&gt;
&lt;br /&gt;
Dynamic Sealing Technologies, Inc.&lt;br /&gt;
&lt;br /&gt;
13829 Jay Street NW&lt;br /&gt;
&lt;br /&gt;
Andover, MN 55304&lt;br /&gt;
&lt;br /&gt;
Direct: 763-404-8021&lt;br /&gt;
&lt;br /&gt;
Main: 763-786-3758&lt;br /&gt;
&lt;br /&gt;
Fax: 763-786-9674&lt;br /&gt;
&lt;br /&gt;
Web: www.dsti.com&lt;br /&gt;
&lt;br /&gt;
Model:  SPS-5510-R.A , a single pass rotary union, the input connector is 3/4&amp;quot; diameter as shown in the drawing below.&lt;br /&gt;
&lt;br /&gt;
The minimum torque needed to rotate base on zero pressure is 4 in-lbs.&lt;br /&gt;
&lt;br /&gt;
[[File:SinglePassRotaryUnionDSTi_v1.pdf]]&lt;br /&gt;
&lt;br /&gt;
 The target chamber design should be able to accommodate a 4&amp;quot; = 3.14+ 1&amp;quot; length in order to accept a rotary union which works at liquid nitrogen temperatures.  The above single pass rotary union is good to -25F according to the company.&lt;br /&gt;
&lt;br /&gt;
Place order for 2 with Michel @ 763-404-8024&lt;br /&gt;
&lt;br /&gt;
===gat===&lt;br /&gt;
&lt;br /&gt;
The guy from Empiremagnetics says that the ferofluid used in the unions below becomes stiff at low temperatures causes too much load on the motors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://www.gat-mbh.de/index.php?page=rotovac-en&amp;amp;group=produkte-en:rotating_unions-en&lt;br /&gt;
&lt;br /&gt;
http://www.tengxuan.net/old/product.asp?Catalog=8&lt;br /&gt;
&lt;br /&gt;
http://www.rotarysystems.com/?gclid=CID4r6z22acCFQM6gwodoQVQ9w&lt;br /&gt;
    http://rotarysystems.com/series-006&lt;br /&gt;
&lt;br /&gt;
==Motor Controller==&lt;br /&gt;
&lt;br /&gt;
http://www.centent.com/&lt;br /&gt;
&lt;br /&gt;
=Target specifications=&lt;br /&gt;
&lt;br /&gt;
The U42 motor has a 4.2 inch diameter.  With a 2&amp;quot; Pb brick for shielding this would put the target radiu to at least (2.1 + 2 + 1) 5.1 inches.&lt;br /&gt;
&lt;br /&gt;
== Moment of Inertia==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I_{Disk} = \frac{1}{2} MR^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;I_{Hoop} = \frac{1}{2} M(R_1^2 +R_2^2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
R= 32 cm = 12.6 inches.&lt;br /&gt;
&lt;br /&gt;
==Torque==&lt;br /&gt;
&lt;br /&gt;
==Rotational Speed==&lt;br /&gt;
===Mechanical design===&lt;br /&gt;
&lt;br /&gt;
An Aluminum disk will be machined to have several Tungsten targets attached.&lt;br /&gt;
&lt;br /&gt;
The disk has a radius of about 5.1 inches.  The circumference will be 2 \pi r \approx 45 inches.  If the targets are 1&amp;quot; wide with 1&amp;quot; gaps, then you will have about 20 targets.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you rotate the target at 1 Hz then in one second you can hit 20 targets.  This means your rep rate can be 20 Hz. &lt;br /&gt;
&lt;br /&gt;
If you rotate the target at 50 Hz then your rep rate can be 1 kHz.&lt;br /&gt;
&lt;br /&gt;
But since you will have 20 gaps (empty target positions) then you could run at 2 kHz.&lt;br /&gt;
&lt;br /&gt;
So a target rotating 25 Hz can accept a rep rate of 1 kHz.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The HRRL easily runs at 300 Hz.  For a target with 20 foils you would run the motor at 300/40 = 7.5 Hz.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Heat load===&lt;br /&gt;
You will need at least 2 holes in the Tungsten disk which you can use as an empty target. The Max pulse rate of the Linac is 1 kHz.   So a 500 Hz motor would be the Max speed needed if you have 2 Windows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
How long can a 1.6 mm thick piece of Tungsten that has an area of 2.5&amp;quot; x 2.5&amp;quot; be in a 600 Watt heat source before melting.&lt;br /&gt;
&lt;br /&gt;
Specific Heat Capacity = &amp;lt;math&amp;gt; 130  \frac{J}{kg K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thermal Conductivity = &amp;lt;math&amp;gt; 173\frac{W}{m K}=100\frac{BTU}{hr ft F}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Melting point of Tungsten is 3600 Kelvin.&lt;br /&gt;
&lt;br /&gt;
density = 19.25&amp;lt;math&amp;gt;\frac{g}{cm^3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Volume = &amp;lt;math&amp;gt;(.16 cm)(2.5 cm)^2 = 1 cm^3&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mass = &amp;lt;math&amp;gt;1 cm^2 \times 19.25 g/cm^3 = 19.25 g&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;Q = C_m m \Delta T = 130  \frac{J}{kg K} \times 0.967 kg \times (3600-300 K) = 414843 J = 600 J/s *t &amp;lt;/math&amp;gt; Watt = J/s&lt;br /&gt;
:: &amp;lt;math&amp;gt;\Rightarrow t= 691 seconds.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If Zinc&lt;br /&gt;
&lt;br /&gt;
: C_m = 0.39 J/g/K Density = 7.13 g/cm^3 \Right arrow M = 7.13 \times 50.3 = 358 g, Melting point 693 K&lt;br /&gt;
:Q = 0.39 \times 0.358 \times 393 = 55 Joules = 10^3 Watts * t \Rightarrow t = 0.055 s \Rightarrow  18 Hz.&lt;br /&gt;
&lt;br /&gt;
Now You need to calculate how quickly water can absorb heat&lt;br /&gt;
&lt;br /&gt;
;Water properties&lt;br /&gt;
:C_m = 4.12 J/g/K , Density = 1 g/cm^3 assuming aflow rate of 1 liter/sec \Rightarrow mass = 1 g, Boiling point water = 373.15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tungsten's specific heat capacity is about 30 times larger than water.  So for the same mass and power input water's temperature will change a factor of 30 more than tungsten.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In 1 second Tungsten's temperature change will be &lt;br /&gt;
:\frac{600 J}{130 \times 0.967} = 5K&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Copper coils which have water flowing through them are soldered to the Tungsten.  The water is a heat sink transferring heat from the Tungsten to the water.&lt;br /&gt;
&lt;br /&gt;
;Heat transfer by conduction&lt;br /&gt;
:&amp;lt;math&amp;gt;\frac{Q}{t} = \frac{\kappa A \Delta T}{d}&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;\kappa \equiv&amp;lt;/math&amp;gt; Heat Conductivity&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Sadiq's Calculation =&lt;br /&gt;
&lt;br /&gt;
Moment of inertia of a cylinder rotating in with z axis:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; I = \frac{m r^2}{2} =  \frac{\rho \times V r^2}{2} = \frac{\rho \times \pi r^2 h \times r^2}{2} = \frac{\rho \pi r^4 h}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\alpha = \frac{d w}{dt} = \frac{d^2\theta}{dt^2} = \frac{\tau}{I} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; w = \frac{\tau}{I}t + w_0  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \theta = \frac{1}{2} \frac{\tau}{I} t^2 + w_0 t + \theta_0  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Angular change due to acceleration is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \Delta \theta = \frac{1}{2} \frac{\tau}{I} t^2 + w_0 t + \theta_0  - ( w_0 t + \theta_0) = \frac{1}{2} \frac{\tau}{I} t^2 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Position change at some distance R from the center is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \Delta l = \Delta \theta R = \frac{1}{2} \frac{\tau}{I} t^2 R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \Delta l = \frac{1}{2} \frac{\tau}{I} t^2 R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Assume we just have one disk, and we are looking for position change at the radius, r=R. We are also looking at the the position change after one revolution, t = T.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \Delta l = \frac{1}{2} \frac{\tau}{\frac{\rho \pi r^4 h}{2}} T^2 r  = \frac{\tau}{\rho \pi r^3 h} \frac{1}{f^2}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; f^2 r^3 = \frac{\tau}{\rho \pi  h} \frac{1}{\Delta l }  &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
or    &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;f^2 r^3 \Delta l = \frac{\tau}{\rho \pi  h}  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rough Estimation ==&lt;br /&gt;
&lt;br /&gt;
100 oz-in = 0.706154 N*m&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \tau = 400~oz-in = 2.82462~N*m &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho_{Al} = 2.7 ~g~ cm^{-3} = 2.7 \times 10^3 ~kg~ m^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We choose:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; h = 1~inch = 0.0254 ~m&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \Delta l = \frac{1}{4}~inch = 0.00635 ~m&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; f^2 r^3 = \frac{2.82462~N*m}{(2.7 \times 10^3 ~kg~ m^{-3} )\times 3.14 \times (0.0254 ~m)}  \times  \frac{1}{0.00635 ~m } = 2.0656616 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; f^2 r^3  = 2.0656616 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;  r^3  = \frac{2}{f^2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;  r  = ( \frac{2}{f^2} ) ^ {1/3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which means: If out motor has a torque of &amp;lt;math&amp;gt; 400~oz-in &amp;lt;/math&amp;gt;, and rotating a 1 inch thick cylindrical aluminium  plate, to move a point outer edge of the plate, forward or backward, 1/4 inch in next revolution, the radius and frequency of the plate should satisfy:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;  r^3  = \frac{2}{f^2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 {| border=&amp;quot;1&amp;quot;  |cellpadding=&amp;quot;20&amp;quot; cellspacing=&amp;quot;0 &lt;br /&gt;
|-&lt;br /&gt;
|r (cm) || r (inch)  || Circumference (in)  ||  #tar (Number of 1-inch-targets can be mounted on the disk) || Rep rate (Hz) ||&lt;br /&gt;
|-&lt;br /&gt;
| 43.1  || 17.0  || 106.56   ||  53  ||  5 ||&lt;br /&gt;
|-&lt;br /&gt;
| 27.1   || 10.7  ||  67.00  ||   33    ||  10   ||&lt;br /&gt;
|-&lt;br /&gt;
| 17.2   || 6.8  || 42.53    ||   21     ||  20 ||&lt;br /&gt;
|-&lt;br /&gt;
|  13.0   ||  5.1  || 32.14  ||    16    || 30 || &lt;br /&gt;
|-&lt;br /&gt;
|  10.8  ||  4.3  || 26.70  ||   23     || 40 ||&lt;br /&gt;
|-&lt;br /&gt;
|  9.3  || 3.7   || 22.99   ||   11   || 50  ||&lt;br /&gt;
|-&lt;br /&gt;
|  8.2  || 3.2   || 20.27   ||   10   || 60 || &lt;br /&gt;
|-&lt;br /&gt;
|  7.4  || 2.9  || 18.30    ||   9    || 70 || &lt;br /&gt;
|-&lt;br /&gt;
|  6.8  || 2.6  ||  16.81   ||   8   || 80  ||&lt;br /&gt;
|-&lt;br /&gt;
|  6.27  || 2.5 ||  15.50   ||    7    || 90 || &lt;br /&gt;
|-&lt;br /&gt;
|  5.85  || 2.2  ||  14.46  ||    7    ||  100 ||&lt;br /&gt;
|-&lt;br /&gt;
|  3.68  || 1.45  || 9.10   ||   4    ||  200 || &lt;br /&gt;
|-&lt;br /&gt;
|  2.81  || 1.11  ||  6.95  ||    3   || 300 || &lt;br /&gt;
|-&lt;br /&gt;
|  2.0  || 0.787  ||  4.94  ||   2    || 500 || &lt;br /&gt;
|-&lt;br /&gt;
|  1.25  || 0.492 ||  3.09  ||   1    || 1000 ||&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Q=&lt;br /&gt;
 Q: Does the W target has to be in the vacuum? &lt;br /&gt;
    What if we have it in the air, at the ends of the beam line we have very thin vacuum window? &lt;br /&gt;
    In photofission experiment we had 1 mil vacuum window. under &lt;br /&gt;
    15 MeV e- beam, only 1/1000 electron will interact with the window, produce bremsstrahlung photon.&lt;br /&gt;
&lt;br /&gt;
 Q: Can we make positron target that is inner part of the vacuum box, then we rotate all the box. Heat will be transfered to box, &lt;br /&gt;
    box can cooled by water from outside. &lt;br /&gt;
    May be box does not have to rotation movement? I can do other moments like up-down and right-left.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
   I think we can make a Tungsten target as a part of the beam line. That means outer part Tungsten target will be beam pine. &lt;br /&gt;
 Then we can use water cooling to cool our Tungsten target from outside. &lt;br /&gt;
 Before we had all the electrons hitting Faraday Cup, which did not melt the copper even when there was not cooling water &lt;br /&gt;
 circling around FC. &lt;br /&gt;
 Tungsten has higher melting point, plus we run cooling water around Tungsten target, then Tungsten shouldn't melt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first version of a positron converter target will be designed to distribute the heat load by rotating the tungsten target.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Calculate for 1 mm and 2 mm thick Tungsten&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Look for Tungsten disks to attach to brushless motor and fit into beam pipe&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Chriss Jackson's Work=&lt;br /&gt;
[[Chriss' Work Page]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go Back [[Positrons]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=JacksonLDSwork&amp;diff=71904</id>
		<title>JacksonLDSwork</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=JacksonLDSwork&amp;diff=71904"/>
		<updated>2012-03-12T19:16:46Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page is a dummy page for Chriss Jackson to edit as needed pertaining to the Rotating W Target Positron Project.&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=JacksonLDSwork&amp;diff=71903</id>
		<title>JacksonLDSwork</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=JacksonLDSwork&amp;diff=71903"/>
		<updated>2012-03-12T19:12:55Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: Created page with 'This page is a dummy page for Chris Jacksson to edit as needed pertaining to the Rotating W Target Positron Project.'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page is a dummy page for Chris Jacksson to edit as needed pertaining to the Rotating W Target Positron Project.&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=Work_Shop_Safety&amp;diff=65372</id>
		<title>Work Shop Safety</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=Work_Shop_Safety&amp;diff=65372"/>
		<updated>2011-08-10T20:02:18Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Bench Grinder */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Machine Specific Safety=&lt;br /&gt;
&lt;br /&gt;
==Saws==&lt;br /&gt;
&lt;br /&gt;
-Table Saw-&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=Y9V4FyCX97Y&amp;amp;ob=av3e&lt;br /&gt;
&lt;br /&gt;
-Circular Saw-&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=VlXl99iZkfM&amp;amp;feature=fvwrel&lt;br /&gt;
&lt;br /&gt;
==Drill Press==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=Ox6nXyRtuog&lt;br /&gt;
&lt;br /&gt;
==Bench Grinder==&lt;br /&gt;
&lt;br /&gt;
-Grinder-&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=GTpNPr35OlE&lt;br /&gt;
&lt;br /&gt;
-wire wheel-&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=5kHH12MlkFQ&lt;br /&gt;
&lt;br /&gt;
==Lathe/Milling machine==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=xv6unAYenZE&lt;br /&gt;
&lt;br /&gt;
==Acetylene Torch==&lt;br /&gt;
&lt;br /&gt;
-Safety-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=DFU4OjEYGBI&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
***Old****&lt;br /&gt;
http://www.youtube.com/watch?v=3Ln0_hLDQqo&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=9um45rCRcpY&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=IsfwM32OI40&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=VfRQxxxLJuo&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=DFU4OjEYGBI&lt;br /&gt;
&lt;br /&gt;
*****Old****&lt;br /&gt;
Brazing&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=ZojIpKCo4TQ&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note. We are updating the video list for this section. Until updates are complete please watch all videos listed.&lt;br /&gt;
&lt;br /&gt;
=Graham resource Center=&lt;br /&gt;
&lt;br /&gt;
http://library.iit.edu/grc/safety/&lt;br /&gt;
&lt;br /&gt;
=ehow safety tips=&lt;br /&gt;
&lt;br /&gt;
http://www.ehow.com/videos-on_7156_workshop-safety-tips.html&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=Work_Shop_Safety&amp;diff=65371</id>
		<title>Work Shop Safety</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=Work_Shop_Safety&amp;diff=65371"/>
		<updated>2011-08-10T20:02:00Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Saws */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Machine Specific Safety=&lt;br /&gt;
&lt;br /&gt;
==Saws==&lt;br /&gt;
&lt;br /&gt;
-Table Saw-&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=Y9V4FyCX97Y&amp;amp;ob=av3e&lt;br /&gt;
&lt;br /&gt;
-Circular Saw-&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=VlXl99iZkfM&amp;amp;feature=fvwrel&lt;br /&gt;
&lt;br /&gt;
==Drill Press==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=Ox6nXyRtuog&lt;br /&gt;
&lt;br /&gt;
==Bench Grinder==&lt;br /&gt;
http://www.youtube.com/watch?v=GTpNPr35OlE&lt;br /&gt;
&lt;br /&gt;
wire wheel&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=5kHH12MlkFQ&lt;br /&gt;
&lt;br /&gt;
==Lathe/Milling machine==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=xv6unAYenZE&lt;br /&gt;
&lt;br /&gt;
==Acetylene Torch==&lt;br /&gt;
&lt;br /&gt;
-Safety-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=DFU4OjEYGBI&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
***Old****&lt;br /&gt;
http://www.youtube.com/watch?v=3Ln0_hLDQqo&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=9um45rCRcpY&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=IsfwM32OI40&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=VfRQxxxLJuo&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=DFU4OjEYGBI&lt;br /&gt;
&lt;br /&gt;
*****Old****&lt;br /&gt;
Brazing&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=ZojIpKCo4TQ&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note. We are updating the video list for this section. Until updates are complete please watch all videos listed.&lt;br /&gt;
&lt;br /&gt;
=Graham resource Center=&lt;br /&gt;
&lt;br /&gt;
http://library.iit.edu/grc/safety/&lt;br /&gt;
&lt;br /&gt;
=ehow safety tips=&lt;br /&gt;
&lt;br /&gt;
http://www.ehow.com/videos-on_7156_workshop-safety-tips.html&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=Work_Shop_Safety&amp;diff=65370</id>
		<title>Work Shop Safety</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=Work_Shop_Safety&amp;diff=65370"/>
		<updated>2011-08-10T20:01:21Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Acetylene Torch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Machine Specific Safety=&lt;br /&gt;
&lt;br /&gt;
==Saws==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=Y9V4FyCX97Y&amp;amp;ob=av3e&lt;br /&gt;
http://www.youtube.com/watch?v=VlXl99iZkfM&amp;amp;feature=fvwrel&lt;br /&gt;
&lt;br /&gt;
==Drill Press==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=Ox6nXyRtuog&lt;br /&gt;
&lt;br /&gt;
==Bench Grinder==&lt;br /&gt;
http://www.youtube.com/watch?v=GTpNPr35OlE&lt;br /&gt;
&lt;br /&gt;
wire wheel&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=5kHH12MlkFQ&lt;br /&gt;
&lt;br /&gt;
==Lathe/Milling machine==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=xv6unAYenZE&lt;br /&gt;
&lt;br /&gt;
==Acetylene Torch==&lt;br /&gt;
&lt;br /&gt;
-Safety-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=DFU4OjEYGBI&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
***Old****&lt;br /&gt;
http://www.youtube.com/watch?v=3Ln0_hLDQqo&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=9um45rCRcpY&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=IsfwM32OI40&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=VfRQxxxLJuo&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=DFU4OjEYGBI&lt;br /&gt;
&lt;br /&gt;
*****Old****&lt;br /&gt;
Brazing&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=ZojIpKCo4TQ&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note. We are updating the video list for this section. Until updates are complete please watch all videos listed.&lt;br /&gt;
&lt;br /&gt;
=Graham resource Center=&lt;br /&gt;
&lt;br /&gt;
http://library.iit.edu/grc/safety/&lt;br /&gt;
&lt;br /&gt;
=ehow safety tips=&lt;br /&gt;
&lt;br /&gt;
http://www.ehow.com/videos-on_7156_workshop-safety-tips.html&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=Work_Shop_Safety&amp;diff=65369</id>
		<title>Work Shop Safety</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=Work_Shop_Safety&amp;diff=65369"/>
		<updated>2011-08-10T20:00:32Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Acetylene Torch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Machine Specific Safety=&lt;br /&gt;
&lt;br /&gt;
==Saws==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=Y9V4FyCX97Y&amp;amp;ob=av3e&lt;br /&gt;
http://www.youtube.com/watch?v=VlXl99iZkfM&amp;amp;feature=fvwrel&lt;br /&gt;
&lt;br /&gt;
==Drill Press==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=Ox6nXyRtuog&lt;br /&gt;
&lt;br /&gt;
==Bench Grinder==&lt;br /&gt;
http://www.youtube.com/watch?v=GTpNPr35OlE&lt;br /&gt;
&lt;br /&gt;
wire wheel&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=5kHH12MlkFQ&lt;br /&gt;
&lt;br /&gt;
==Lathe/Milling machine==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=xv6unAYenZE&lt;br /&gt;
&lt;br /&gt;
==Acetylene Torch==&lt;br /&gt;
&lt;br /&gt;
-Safety-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=DFU4OjEYGBI&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
***Old****&lt;br /&gt;
http://www.youtube.com/watch?v=3Ln0_hLDQqo&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=9um45rCRcpY&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=IsfwM32OI40&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=VfRQxxxLJuo&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=DFU4OjEYGBI&lt;br /&gt;
&lt;br /&gt;
*****Old****&lt;br /&gt;
Brazing&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=ZojIpKCo4TQ&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
=Graham resource Center=&lt;br /&gt;
&lt;br /&gt;
http://library.iit.edu/grc/safety/&lt;br /&gt;
&lt;br /&gt;
=ehow safety tips=&lt;br /&gt;
&lt;br /&gt;
http://www.ehow.com/videos-on_7156_workshop-safety-tips.html&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=Work_Shop_Safety&amp;diff=65368</id>
		<title>Work Shop Safety</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=Work_Shop_Safety&amp;diff=65368"/>
		<updated>2011-08-10T19:47:26Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* You Tube Safety Videos */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Machine Specific Safety=&lt;br /&gt;
&lt;br /&gt;
==Saws==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=Y9V4FyCX97Y&amp;amp;ob=av3e&lt;br /&gt;
http://www.youtube.com/watch?v=VlXl99iZkfM&amp;amp;feature=fvwrel&lt;br /&gt;
&lt;br /&gt;
==Drill Press==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=Ox6nXyRtuog&lt;br /&gt;
&lt;br /&gt;
==Bench Grinder==&lt;br /&gt;
http://www.youtube.com/watch?v=GTpNPr35OlE&lt;br /&gt;
&lt;br /&gt;
wire wheel&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=5kHH12MlkFQ&lt;br /&gt;
&lt;br /&gt;
==Lathe/Milling machine==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=xv6unAYenZE&lt;br /&gt;
&lt;br /&gt;
==Acetylene Torch==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=3Ln0_hLDQqo&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=9um45rCRcpY&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=IsfwM32OI40&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=VfRQxxxLJuo&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=DFU4OjEYGBI&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Brazing&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=ZojIpKCo4TQ&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
=Graham resource Center=&lt;br /&gt;
&lt;br /&gt;
http://library.iit.edu/grc/safety/&lt;br /&gt;
&lt;br /&gt;
=ehow safety tips=&lt;br /&gt;
&lt;br /&gt;
http://www.ehow.com/videos-on_7156_workshop-safety-tips.html&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=Work_Shop_Safety&amp;diff=65367</id>
		<title>Work Shop Safety</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=Work_Shop_Safety&amp;diff=65367"/>
		<updated>2011-08-10T19:47:19Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Machine Specific Safety */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Machine Specific Safety=&lt;br /&gt;
&lt;br /&gt;
==Saws==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=Y9V4FyCX97Y&amp;amp;ob=av3e&lt;br /&gt;
http://www.youtube.com/watch?v=VlXl99iZkfM&amp;amp;feature=fvwrel&lt;br /&gt;
&lt;br /&gt;
==Drill Press==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=Ox6nXyRtuog&lt;br /&gt;
&lt;br /&gt;
==Bench Grinder==&lt;br /&gt;
http://www.youtube.com/watch?v=GTpNPr35OlE&lt;br /&gt;
&lt;br /&gt;
wire wheel&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=5kHH12MlkFQ&lt;br /&gt;
&lt;br /&gt;
==Lathe/Milling machine==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=xv6unAYenZE&lt;br /&gt;
&lt;br /&gt;
==Acetylene Torch==&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=3Ln0_hLDQqo&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=9um45rCRcpY&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=IsfwM32OI40&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=VfRQxxxLJuo&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=DFU4OjEYGBI&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Brazing&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=ZojIpKCo4TQ&amp;amp;feature=related&lt;br /&gt;
&lt;br /&gt;
=Graham resource Center=&lt;br /&gt;
&lt;br /&gt;
http://library.iit.edu/grc/safety/&lt;br /&gt;
&lt;br /&gt;
=ehow safety tips=&lt;br /&gt;
&lt;br /&gt;
http://www.ehow.com/videos-on_7156_workshop-safety-tips.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=You Tube Safety Videos=&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=a64y3Ih_s74&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=jIIHNI8X15Q&amp;amp;feature=mfu_in_order&amp;amp;list=UL&lt;br /&gt;
&lt;br /&gt;
http://www.youtube.com/watch?v=4Tb2v_HU7f0&amp;amp;feature=BFa&amp;amp;list=ULd6ZU7ZYh1fA&amp;amp;index=3&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=File:PMT-Optimizations_Data.xls&amp;diff=64202</id>
		<title>File:PMT-Optimizations Data.xls</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=File:PMT-Optimizations_Data.xls&amp;diff=64202"/>
		<updated>2011-06-30T20:16:49Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=64201</id>
		<title>PhotoFission with Polarized Photons from HRRL</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=64201"/>
		<updated>2011-06-30T20:16:41Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Jason's Uploads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:PhotfissionHeros_10-21-08.jpg | 500 px]]&lt;br /&gt;
&lt;br /&gt;
=Experiments=&lt;br /&gt;
*[[October Fission HRRL Measurements 2008]]&lt;br /&gt;
*[[Feb_PhotFisRun_44MeV_March_2011]]&lt;br /&gt;
&lt;br /&gt;
=Analysis=&lt;br /&gt;
&lt;br /&gt;
*[[2008_HRRL_Analysis]]&lt;br /&gt;
*[[2011_44MeV_Analysis_2011]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Simulations=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
==Meeting Notes==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Hand Calculations==&lt;br /&gt;
&lt;br /&gt;
*[[Neutron Polarimeter]]&lt;br /&gt;
&lt;br /&gt;
*[[Dan's parallel calculation]]&lt;br /&gt;
&lt;br /&gt;
*[[2n correlations in Photofission]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Publications==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Radiator Foil]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Using Carbon or Aluminum to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 5 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 8 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Thickness of Lead to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Where does the radiator need to be?]]&lt;br /&gt;
&lt;br /&gt;
[[Determining the uncertainty of Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Things That Still Need to Get Done]]&lt;br /&gt;
&lt;br /&gt;
[[Tasks March 31, 2009]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 2nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (with Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Temporary Files]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics diagram 2/2/11]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (without Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Notes for the July 11th, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Column of Water Length]]&lt;br /&gt;
&lt;br /&gt;
[[Finding the Space Between Lead Shots]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics We Need to Collect]]&lt;br /&gt;
&lt;br /&gt;
[[Compton Scattering]]&lt;br /&gt;
&lt;br /&gt;
[[Constant Fraction Discriminator Details]]&lt;br /&gt;
&lt;br /&gt;
[[Magnet Calculations]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 22nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Current Conceptual Design of Beamline]]&lt;br /&gt;
&lt;br /&gt;
[[ Matching Detectors]]&lt;br /&gt;
&lt;br /&gt;
[[ Cosmic Ray Shielding Test ]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Time of Flight Test]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[PhotoFis.C (ROOT program to analyse data)]]&lt;br /&gt;
&lt;br /&gt;
[[Pictures of experimental setup]]&lt;br /&gt;
&lt;br /&gt;
[[Data bank]]&lt;br /&gt;
&lt;br /&gt;
[[Integrated asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Peaks fitting]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Production Thresholds]]&lt;br /&gt;
&lt;br /&gt;
[[Conversion TDC to Energy]] &lt;br /&gt;
&lt;br /&gt;
[[Cross Sections of C,N,O,Si,Pb]]&lt;br /&gt;
&lt;br /&gt;
[[TDC Calibration]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Plot FWHM distribution]&lt;br /&gt;
&lt;br /&gt;
[[A kind of analysis]]&lt;br /&gt;
&lt;br /&gt;
[[NaI spectra]]&lt;br /&gt;
&lt;br /&gt;
[[B-field calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Plastic Scintillator Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[New Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[Spectra Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung lineshape for E0 = 16 MeV, Ti radiator]]&lt;br /&gt;
&lt;br /&gt;
[[Flux from NaI vs. Gamma Flash]]&lt;br /&gt;
&lt;br /&gt;
[[ACCAPP_09_PhotFis_Poster]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer Info]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[March 2010 Run Report]]&lt;br /&gt;
&lt;br /&gt;
[[Minimum accelerator energy to run experiment]]&lt;br /&gt;
&lt;br /&gt;
[[Collimation geometry for different beam energies]]&lt;br /&gt;
&lt;br /&gt;
[[Counts Rate (44 MeV LINAC)]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer]]&lt;br /&gt;
&lt;br /&gt;
[[Aluminum Converter]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Temperature]]&lt;br /&gt;
&lt;br /&gt;
[[Kicker Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[MCNPX Simulations for Neutron Beam]]&lt;br /&gt;
&lt;br /&gt;
[[IAC experimental cell]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Detector Setup]]&lt;br /&gt;
&lt;br /&gt;
[[44 MeV Beam Line Optimization]]&lt;br /&gt;
&lt;br /&gt;
[[FFs angular asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics &amp;amp; DAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Cool beamline drawings]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Production Rate Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Ribbon Cable Attenuation Measurements]]&lt;br /&gt;
&lt;br /&gt;
[[Current Electronics]]&lt;br /&gt;
&lt;br /&gt;
[[Draft Run Plan 2/23/11]]&lt;br /&gt;
&lt;br /&gt;
[[44 Setup]]&lt;br /&gt;
&lt;br /&gt;
[[n's detectors threshold measurements 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[PS front and back count rates (cosmic) 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 44 MeV  3/1/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 25 MeV  3/4/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[D2O photodisintegration simulation]]&lt;br /&gt;
&lt;br /&gt;
[[Things to do different on next run]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's April 2011 2 neutron correlations talk]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's scribbles on the Hamamatsu R580 Voltage Divider Design]]&lt;br /&gt;
&lt;br /&gt;
[[n's det calibration]]&lt;br /&gt;
&lt;br /&gt;
[[2D Faraday Cup Data Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[(gamma,f) versus (gamma,f)]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung radiation properties, Ee=25 MeV]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/HRRL Go Back]&lt;br /&gt;
&lt;br /&gt;
=Other=&lt;br /&gt;
==Jason's Uploads==&lt;br /&gt;
[[File:PMT-Threshold-Testing.xls]]&lt;br /&gt;
&lt;br /&gt;
[http://sales.hamamatsu.com/index.php?id=13189439&amp;amp;src=newproductpage Hamamatsu Documentation]&lt;br /&gt;
&lt;br /&gt;
[[File:SaintGobainLightGudieQuote.pdf]]&lt;br /&gt;
&lt;br /&gt;
[[File:PMT Beahvior TubeA.pdf]]&lt;br /&gt;
&lt;br /&gt;
[[File:PMT Beahvior TubeB.pdf]]&lt;br /&gt;
&lt;br /&gt;
[[File:PMT Beahvior TubeB(unfiltered).pdf]]&lt;br /&gt;
&lt;br /&gt;
[[File:PMT-Optimizations Data.xls]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=File:PMT_Beahvior_TubeB(unfiltered).pdf&amp;diff=64200</id>
		<title>File:PMT Beahvior TubeB(unfiltered).pdf</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=File:PMT_Beahvior_TubeB(unfiltered).pdf&amp;diff=64200"/>
		<updated>2011-06-30T20:15:45Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=File:PMT_Beahvior_TubeB.pdf&amp;diff=64199</id>
		<title>File:PMT Beahvior TubeB.pdf</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=File:PMT_Beahvior_TubeB.pdf&amp;diff=64199"/>
		<updated>2011-06-30T20:15:36Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=File:PMT_Beahvior_TubeA.pdf&amp;diff=64198</id>
		<title>File:PMT Beahvior TubeA.pdf</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=File:PMT_Beahvior_TubeA.pdf&amp;diff=64198"/>
		<updated>2011-06-30T20:15:18Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=64197</id>
		<title>PhotoFission with Polarized Photons from HRRL</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=64197"/>
		<updated>2011-06-30T20:15:09Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Jason's Uploads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:PhotfissionHeros_10-21-08.jpg | 500 px]]&lt;br /&gt;
&lt;br /&gt;
=Experiments=&lt;br /&gt;
*[[October Fission HRRL Measurements 2008]]&lt;br /&gt;
*[[Feb_PhotFisRun_44MeV_March_2011]]&lt;br /&gt;
&lt;br /&gt;
=Analysis=&lt;br /&gt;
&lt;br /&gt;
*[[2008_HRRL_Analysis]]&lt;br /&gt;
*[[2011_44MeV_Analysis_2011]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Simulations=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
==Meeting Notes==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Hand Calculations==&lt;br /&gt;
&lt;br /&gt;
*[[Neutron Polarimeter]]&lt;br /&gt;
&lt;br /&gt;
*[[Dan's parallel calculation]]&lt;br /&gt;
&lt;br /&gt;
*[[2n correlations in Photofission]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Publications==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Radiator Foil]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Using Carbon or Aluminum to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 5 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 8 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Thickness of Lead to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Where does the radiator need to be?]]&lt;br /&gt;
&lt;br /&gt;
[[Determining the uncertainty of Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Things That Still Need to Get Done]]&lt;br /&gt;
&lt;br /&gt;
[[Tasks March 31, 2009]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 2nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (with Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Temporary Files]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics diagram 2/2/11]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (without Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Notes for the July 11th, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Column of Water Length]]&lt;br /&gt;
&lt;br /&gt;
[[Finding the Space Between Lead Shots]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics We Need to Collect]]&lt;br /&gt;
&lt;br /&gt;
[[Compton Scattering]]&lt;br /&gt;
&lt;br /&gt;
[[Constant Fraction Discriminator Details]]&lt;br /&gt;
&lt;br /&gt;
[[Magnet Calculations]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 22nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Current Conceptual Design of Beamline]]&lt;br /&gt;
&lt;br /&gt;
[[ Matching Detectors]]&lt;br /&gt;
&lt;br /&gt;
[[ Cosmic Ray Shielding Test ]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Time of Flight Test]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[PhotoFis.C (ROOT program to analyse data)]]&lt;br /&gt;
&lt;br /&gt;
[[Pictures of experimental setup]]&lt;br /&gt;
&lt;br /&gt;
[[Data bank]]&lt;br /&gt;
&lt;br /&gt;
[[Integrated asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Peaks fitting]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Production Thresholds]]&lt;br /&gt;
&lt;br /&gt;
[[Conversion TDC to Energy]] &lt;br /&gt;
&lt;br /&gt;
[[Cross Sections of C,N,O,Si,Pb]]&lt;br /&gt;
&lt;br /&gt;
[[TDC Calibration]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Plot FWHM distribution]&lt;br /&gt;
&lt;br /&gt;
[[A kind of analysis]]&lt;br /&gt;
&lt;br /&gt;
[[NaI spectra]]&lt;br /&gt;
&lt;br /&gt;
[[B-field calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Plastic Scintillator Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[New Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[Spectra Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung lineshape for E0 = 16 MeV, Ti radiator]]&lt;br /&gt;
&lt;br /&gt;
[[Flux from NaI vs. Gamma Flash]]&lt;br /&gt;
&lt;br /&gt;
[[ACCAPP_09_PhotFis_Poster]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer Info]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[March 2010 Run Report]]&lt;br /&gt;
&lt;br /&gt;
[[Minimum accelerator energy to run experiment]]&lt;br /&gt;
&lt;br /&gt;
[[Collimation geometry for different beam energies]]&lt;br /&gt;
&lt;br /&gt;
[[Counts Rate (44 MeV LINAC)]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer]]&lt;br /&gt;
&lt;br /&gt;
[[Aluminum Converter]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Temperature]]&lt;br /&gt;
&lt;br /&gt;
[[Kicker Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[MCNPX Simulations for Neutron Beam]]&lt;br /&gt;
&lt;br /&gt;
[[IAC experimental cell]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Detector Setup]]&lt;br /&gt;
&lt;br /&gt;
[[44 MeV Beam Line Optimization]]&lt;br /&gt;
&lt;br /&gt;
[[FFs angular asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics &amp;amp; DAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Cool beamline drawings]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Production Rate Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Ribbon Cable Attenuation Measurements]]&lt;br /&gt;
&lt;br /&gt;
[[Current Electronics]]&lt;br /&gt;
&lt;br /&gt;
[[Draft Run Plan 2/23/11]]&lt;br /&gt;
&lt;br /&gt;
[[44 Setup]]&lt;br /&gt;
&lt;br /&gt;
[[n's detectors threshold measurements 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[PS front and back count rates (cosmic) 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 44 MeV  3/1/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 25 MeV  3/4/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[D2O photodisintegration simulation]]&lt;br /&gt;
&lt;br /&gt;
[[Things to do different on next run]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's April 2011 2 neutron correlations talk]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's scribbles on the Hamamatsu R580 Voltage Divider Design]]&lt;br /&gt;
&lt;br /&gt;
[[n's det calibration]]&lt;br /&gt;
&lt;br /&gt;
[[2D Faraday Cup Data Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[(gamma,f) versus (gamma,f)]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung radiation properties, Ee=25 MeV]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/HRRL Go Back]&lt;br /&gt;
&lt;br /&gt;
=Other=&lt;br /&gt;
==Jason's Uploads==&lt;br /&gt;
[[File:PMT-Threshold-Testing.xls]]&lt;br /&gt;
&lt;br /&gt;
[http://sales.hamamatsu.com/index.php?id=13189439&amp;amp;src=newproductpage Hamamatsu Documentation]&lt;br /&gt;
&lt;br /&gt;
[[File:SaintGobainLightGudieQuote.pdf]]&lt;br /&gt;
&lt;br /&gt;
[[File:PMT Beahvior TubeA.pdf]]&lt;br /&gt;
&lt;br /&gt;
[[File:PMT Beahvior TubeB.pdf]]&lt;br /&gt;
&lt;br /&gt;
[[File:PMT Beahvior TubeB(unfiltered).pdf]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=64196</id>
		<title>PhotoFission with Polarized Photons from HRRL</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=64196"/>
		<updated>2011-06-30T20:14:49Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Jason's Uploads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:PhotfissionHeros_10-21-08.jpg | 500 px]]&lt;br /&gt;
&lt;br /&gt;
=Experiments=&lt;br /&gt;
*[[October Fission HRRL Measurements 2008]]&lt;br /&gt;
*[[Feb_PhotFisRun_44MeV_March_2011]]&lt;br /&gt;
&lt;br /&gt;
=Analysis=&lt;br /&gt;
&lt;br /&gt;
*[[2008_HRRL_Analysis]]&lt;br /&gt;
*[[2011_44MeV_Analysis_2011]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Simulations=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
==Meeting Notes==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Hand Calculations==&lt;br /&gt;
&lt;br /&gt;
*[[Neutron Polarimeter]]&lt;br /&gt;
&lt;br /&gt;
*[[Dan's parallel calculation]]&lt;br /&gt;
&lt;br /&gt;
*[[2n correlations in Photofission]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Publications==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Radiator Foil]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Using Carbon or Aluminum to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 5 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 8 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Thickness of Lead to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Where does the radiator need to be?]]&lt;br /&gt;
&lt;br /&gt;
[[Determining the uncertainty of Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Things That Still Need to Get Done]]&lt;br /&gt;
&lt;br /&gt;
[[Tasks March 31, 2009]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 2nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (with Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Temporary Files]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics diagram 2/2/11]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (without Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Notes for the July 11th, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Column of Water Length]]&lt;br /&gt;
&lt;br /&gt;
[[Finding the Space Between Lead Shots]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics We Need to Collect]]&lt;br /&gt;
&lt;br /&gt;
[[Compton Scattering]]&lt;br /&gt;
&lt;br /&gt;
[[Constant Fraction Discriminator Details]]&lt;br /&gt;
&lt;br /&gt;
[[Magnet Calculations]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 22nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Current Conceptual Design of Beamline]]&lt;br /&gt;
&lt;br /&gt;
[[ Matching Detectors]]&lt;br /&gt;
&lt;br /&gt;
[[ Cosmic Ray Shielding Test ]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Time of Flight Test]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[PhotoFis.C (ROOT program to analyse data)]]&lt;br /&gt;
&lt;br /&gt;
[[Pictures of experimental setup]]&lt;br /&gt;
&lt;br /&gt;
[[Data bank]]&lt;br /&gt;
&lt;br /&gt;
[[Integrated asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Peaks fitting]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Production Thresholds]]&lt;br /&gt;
&lt;br /&gt;
[[Conversion TDC to Energy]] &lt;br /&gt;
&lt;br /&gt;
[[Cross Sections of C,N,O,Si,Pb]]&lt;br /&gt;
&lt;br /&gt;
[[TDC Calibration]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Plot FWHM distribution]&lt;br /&gt;
&lt;br /&gt;
[[A kind of analysis]]&lt;br /&gt;
&lt;br /&gt;
[[NaI spectra]]&lt;br /&gt;
&lt;br /&gt;
[[B-field calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Plastic Scintillator Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[New Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[Spectra Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung lineshape for E0 = 16 MeV, Ti radiator]]&lt;br /&gt;
&lt;br /&gt;
[[Flux from NaI vs. Gamma Flash]]&lt;br /&gt;
&lt;br /&gt;
[[ACCAPP_09_PhotFis_Poster]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer Info]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[March 2010 Run Report]]&lt;br /&gt;
&lt;br /&gt;
[[Minimum accelerator energy to run experiment]]&lt;br /&gt;
&lt;br /&gt;
[[Collimation geometry for different beam energies]]&lt;br /&gt;
&lt;br /&gt;
[[Counts Rate (44 MeV LINAC)]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer]]&lt;br /&gt;
&lt;br /&gt;
[[Aluminum Converter]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Temperature]]&lt;br /&gt;
&lt;br /&gt;
[[Kicker Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[MCNPX Simulations for Neutron Beam]]&lt;br /&gt;
&lt;br /&gt;
[[IAC experimental cell]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Detector Setup]]&lt;br /&gt;
&lt;br /&gt;
[[44 MeV Beam Line Optimization]]&lt;br /&gt;
&lt;br /&gt;
[[FFs angular asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics &amp;amp; DAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Cool beamline drawings]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Production Rate Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Ribbon Cable Attenuation Measurements]]&lt;br /&gt;
&lt;br /&gt;
[[Current Electronics]]&lt;br /&gt;
&lt;br /&gt;
[[Draft Run Plan 2/23/11]]&lt;br /&gt;
&lt;br /&gt;
[[44 Setup]]&lt;br /&gt;
&lt;br /&gt;
[[n's detectors threshold measurements 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[PS front and back count rates (cosmic) 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 44 MeV  3/1/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 25 MeV  3/4/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[D2O photodisintegration simulation]]&lt;br /&gt;
&lt;br /&gt;
[[Things to do different on next run]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's April 2011 2 neutron correlations talk]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's scribbles on the Hamamatsu R580 Voltage Divider Design]]&lt;br /&gt;
&lt;br /&gt;
[[n's det calibration]]&lt;br /&gt;
&lt;br /&gt;
[[2D Faraday Cup Data Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[(gamma,f) versus (gamma,f)]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung radiation properties, Ee=25 MeV]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/HRRL Go Back]&lt;br /&gt;
&lt;br /&gt;
=Other=&lt;br /&gt;
==Jason's Uploads==&lt;br /&gt;
[[File:PMT-Threshold-Testing.xls]]&lt;br /&gt;
&lt;br /&gt;
[http://sales.hamamatsu.com/index.php?id=13189439&amp;amp;src=newproductpage Hamamatsu Documentation]&lt;br /&gt;
&lt;br /&gt;
[[File:SaintGobainLightGudieQuote.pdf]]&lt;br /&gt;
&lt;br /&gt;
[[File:PMT Beahvior|TubeA.pdf]]&lt;br /&gt;
&lt;br /&gt;
[[File:PMT Beahvior|TubeB.pdf]]&lt;br /&gt;
&lt;br /&gt;
[[File:PMT Beahvior|TubeA(unfiltered).pdf]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=64195</id>
		<title>PhotoFission with Polarized Photons from HRRL</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=64195"/>
		<updated>2011-06-30T20:13:32Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Jason's Uploads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:PhotfissionHeros_10-21-08.jpg | 500 px]]&lt;br /&gt;
&lt;br /&gt;
=Experiments=&lt;br /&gt;
*[[October Fission HRRL Measurements 2008]]&lt;br /&gt;
*[[Feb_PhotFisRun_44MeV_March_2011]]&lt;br /&gt;
&lt;br /&gt;
=Analysis=&lt;br /&gt;
&lt;br /&gt;
*[[2008_HRRL_Analysis]]&lt;br /&gt;
*[[2011_44MeV_Analysis_2011]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Simulations=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
==Meeting Notes==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Hand Calculations==&lt;br /&gt;
&lt;br /&gt;
*[[Neutron Polarimeter]]&lt;br /&gt;
&lt;br /&gt;
*[[Dan's parallel calculation]]&lt;br /&gt;
&lt;br /&gt;
*[[2n correlations in Photofission]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Publications==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Radiator Foil]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Using Carbon or Aluminum to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 5 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 8 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Thickness of Lead to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Where does the radiator need to be?]]&lt;br /&gt;
&lt;br /&gt;
[[Determining the uncertainty of Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Things That Still Need to Get Done]]&lt;br /&gt;
&lt;br /&gt;
[[Tasks March 31, 2009]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 2nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (with Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Temporary Files]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics diagram 2/2/11]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (without Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Notes for the July 11th, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Column of Water Length]]&lt;br /&gt;
&lt;br /&gt;
[[Finding the Space Between Lead Shots]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics We Need to Collect]]&lt;br /&gt;
&lt;br /&gt;
[[Compton Scattering]]&lt;br /&gt;
&lt;br /&gt;
[[Constant Fraction Discriminator Details]]&lt;br /&gt;
&lt;br /&gt;
[[Magnet Calculations]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 22nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Current Conceptual Design of Beamline]]&lt;br /&gt;
&lt;br /&gt;
[[ Matching Detectors]]&lt;br /&gt;
&lt;br /&gt;
[[ Cosmic Ray Shielding Test ]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Time of Flight Test]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[PhotoFis.C (ROOT program to analyse data)]]&lt;br /&gt;
&lt;br /&gt;
[[Pictures of experimental setup]]&lt;br /&gt;
&lt;br /&gt;
[[Data bank]]&lt;br /&gt;
&lt;br /&gt;
[[Integrated asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Peaks fitting]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Production Thresholds]]&lt;br /&gt;
&lt;br /&gt;
[[Conversion TDC to Energy]] &lt;br /&gt;
&lt;br /&gt;
[[Cross Sections of C,N,O,Si,Pb]]&lt;br /&gt;
&lt;br /&gt;
[[TDC Calibration]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Plot FWHM distribution]&lt;br /&gt;
&lt;br /&gt;
[[A kind of analysis]]&lt;br /&gt;
&lt;br /&gt;
[[NaI spectra]]&lt;br /&gt;
&lt;br /&gt;
[[B-field calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Plastic Scintillator Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[New Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[Spectra Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung lineshape for E0 = 16 MeV, Ti radiator]]&lt;br /&gt;
&lt;br /&gt;
[[Flux from NaI vs. Gamma Flash]]&lt;br /&gt;
&lt;br /&gt;
[[ACCAPP_09_PhotFis_Poster]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer Info]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[March 2010 Run Report]]&lt;br /&gt;
&lt;br /&gt;
[[Minimum accelerator energy to run experiment]]&lt;br /&gt;
&lt;br /&gt;
[[Collimation geometry for different beam energies]]&lt;br /&gt;
&lt;br /&gt;
[[Counts Rate (44 MeV LINAC)]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer]]&lt;br /&gt;
&lt;br /&gt;
[[Aluminum Converter]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Temperature]]&lt;br /&gt;
&lt;br /&gt;
[[Kicker Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[MCNPX Simulations for Neutron Beam]]&lt;br /&gt;
&lt;br /&gt;
[[IAC experimental cell]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Detector Setup]]&lt;br /&gt;
&lt;br /&gt;
[[44 MeV Beam Line Optimization]]&lt;br /&gt;
&lt;br /&gt;
[[FFs angular asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics &amp;amp; DAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Cool beamline drawings]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Production Rate Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Ribbon Cable Attenuation Measurements]]&lt;br /&gt;
&lt;br /&gt;
[[Current Electronics]]&lt;br /&gt;
&lt;br /&gt;
[[Draft Run Plan 2/23/11]]&lt;br /&gt;
&lt;br /&gt;
[[44 Setup]]&lt;br /&gt;
&lt;br /&gt;
[[n's detectors threshold measurements 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[PS front and back count rates (cosmic) 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 44 MeV  3/1/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 25 MeV  3/4/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[D2O photodisintegration simulation]]&lt;br /&gt;
&lt;br /&gt;
[[Things to do different on next run]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's April 2011 2 neutron correlations talk]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's scribbles on the Hamamatsu R580 Voltage Divider Design]]&lt;br /&gt;
&lt;br /&gt;
[[n's det calibration]]&lt;br /&gt;
&lt;br /&gt;
[[2D Faraday Cup Data Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[(gamma,f) versus (gamma,f)]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung radiation properties, Ee=25 MeV]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/HRRL Go Back]&lt;br /&gt;
&lt;br /&gt;
=Other=&lt;br /&gt;
==Jason's Uploads==&lt;br /&gt;
[[File:PMT-Threshold-Testing.xls]]&lt;br /&gt;
&lt;br /&gt;
[http://sales.hamamatsu.com/index.php?id=13189439&amp;amp;src=newproductpage Hamamatsu Documentation]&lt;br /&gt;
&lt;br /&gt;
[[File:SaintGobainLightGudieQuote.pdf]]&lt;br /&gt;
&lt;br /&gt;
[[File:PMT behavior|TubeA.pdf]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=File:PMT_behavior_D-TubeA.pdf&amp;diff=64194</id>
		<title>File:PMT behavior D-TubeA.pdf</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=File:PMT_behavior_D-TubeA.pdf&amp;diff=64194"/>
		<updated>2011-06-30T20:12:47Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=64193</id>
		<title>PhotoFission with Polarized Photons from HRRL</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=64193"/>
		<updated>2011-06-30T20:12:09Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Jason's Uploads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:PhotfissionHeros_10-21-08.jpg | 500 px]]&lt;br /&gt;
&lt;br /&gt;
=Experiments=&lt;br /&gt;
*[[October Fission HRRL Measurements 2008]]&lt;br /&gt;
*[[Feb_PhotFisRun_44MeV_March_2011]]&lt;br /&gt;
&lt;br /&gt;
=Analysis=&lt;br /&gt;
&lt;br /&gt;
*[[2008_HRRL_Analysis]]&lt;br /&gt;
*[[2011_44MeV_Analysis_2011]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Simulations=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
==Meeting Notes==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Hand Calculations==&lt;br /&gt;
&lt;br /&gt;
*[[Neutron Polarimeter]]&lt;br /&gt;
&lt;br /&gt;
*[[Dan's parallel calculation]]&lt;br /&gt;
&lt;br /&gt;
*[[2n correlations in Photofission]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Publications==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Radiator Foil]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Using Carbon or Aluminum to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 5 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 8 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Thickness of Lead to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Where does the radiator need to be?]]&lt;br /&gt;
&lt;br /&gt;
[[Determining the uncertainty of Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Things That Still Need to Get Done]]&lt;br /&gt;
&lt;br /&gt;
[[Tasks March 31, 2009]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 2nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (with Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Temporary Files]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics diagram 2/2/11]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (without Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Notes for the July 11th, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Column of Water Length]]&lt;br /&gt;
&lt;br /&gt;
[[Finding the Space Between Lead Shots]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics We Need to Collect]]&lt;br /&gt;
&lt;br /&gt;
[[Compton Scattering]]&lt;br /&gt;
&lt;br /&gt;
[[Constant Fraction Discriminator Details]]&lt;br /&gt;
&lt;br /&gt;
[[Magnet Calculations]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 22nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Current Conceptual Design of Beamline]]&lt;br /&gt;
&lt;br /&gt;
[[ Matching Detectors]]&lt;br /&gt;
&lt;br /&gt;
[[ Cosmic Ray Shielding Test ]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Time of Flight Test]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[PhotoFis.C (ROOT program to analyse data)]]&lt;br /&gt;
&lt;br /&gt;
[[Pictures of experimental setup]]&lt;br /&gt;
&lt;br /&gt;
[[Data bank]]&lt;br /&gt;
&lt;br /&gt;
[[Integrated asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Peaks fitting]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Production Thresholds]]&lt;br /&gt;
&lt;br /&gt;
[[Conversion TDC to Energy]] &lt;br /&gt;
&lt;br /&gt;
[[Cross Sections of C,N,O,Si,Pb]]&lt;br /&gt;
&lt;br /&gt;
[[TDC Calibration]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Plot FWHM distribution]&lt;br /&gt;
&lt;br /&gt;
[[A kind of analysis]]&lt;br /&gt;
&lt;br /&gt;
[[NaI spectra]]&lt;br /&gt;
&lt;br /&gt;
[[B-field calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Plastic Scintillator Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[New Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[Spectra Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung lineshape for E0 = 16 MeV, Ti radiator]]&lt;br /&gt;
&lt;br /&gt;
[[Flux from NaI vs. Gamma Flash]]&lt;br /&gt;
&lt;br /&gt;
[[ACCAPP_09_PhotFis_Poster]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer Info]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[March 2010 Run Report]]&lt;br /&gt;
&lt;br /&gt;
[[Minimum accelerator energy to run experiment]]&lt;br /&gt;
&lt;br /&gt;
[[Collimation geometry for different beam energies]]&lt;br /&gt;
&lt;br /&gt;
[[Counts Rate (44 MeV LINAC)]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer]]&lt;br /&gt;
&lt;br /&gt;
[[Aluminum Converter]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Temperature]]&lt;br /&gt;
&lt;br /&gt;
[[Kicker Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[MCNPX Simulations for Neutron Beam]]&lt;br /&gt;
&lt;br /&gt;
[[IAC experimental cell]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Detector Setup]]&lt;br /&gt;
&lt;br /&gt;
[[44 MeV Beam Line Optimization]]&lt;br /&gt;
&lt;br /&gt;
[[FFs angular asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics &amp;amp; DAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Cool beamline drawings]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Production Rate Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Ribbon Cable Attenuation Measurements]]&lt;br /&gt;
&lt;br /&gt;
[[Current Electronics]]&lt;br /&gt;
&lt;br /&gt;
[[Draft Run Plan 2/23/11]]&lt;br /&gt;
&lt;br /&gt;
[[44 Setup]]&lt;br /&gt;
&lt;br /&gt;
[[n's detectors threshold measurements 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[PS front and back count rates (cosmic) 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 44 MeV  3/1/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 25 MeV  3/4/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[D2O photodisintegration simulation]]&lt;br /&gt;
&lt;br /&gt;
[[Things to do different on next run]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's April 2011 2 neutron correlations talk]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's scribbles on the Hamamatsu R580 Voltage Divider Design]]&lt;br /&gt;
&lt;br /&gt;
[[n's det calibration]]&lt;br /&gt;
&lt;br /&gt;
[[2D Faraday Cup Data Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[(gamma,f) versus (gamma,f)]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung radiation properties, Ee=25 MeV]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/HRRL Go Back]&lt;br /&gt;
&lt;br /&gt;
=Other=&lt;br /&gt;
==Jason's Uploads==&lt;br /&gt;
[[File:PMT-Threshold-Testing.xls]]&lt;br /&gt;
&lt;br /&gt;
[http://sales.hamamatsu.com/index.php?id=13189439&amp;amp;src=newproductpage Hamamatsu Documentation]&lt;br /&gt;
&lt;br /&gt;
[[File:SaintGobainLightGudieQuote.pdf]]&lt;br /&gt;
&lt;br /&gt;
[[File:PMT behaviors]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=64192</id>
		<title>PhotoFission with Polarized Photons from HRRL</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=64192"/>
		<updated>2011-06-30T20:12:02Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Jason's Uploads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:PhotfissionHeros_10-21-08.jpg | 500 px]]&lt;br /&gt;
&lt;br /&gt;
=Experiments=&lt;br /&gt;
*[[October Fission HRRL Measurements 2008]]&lt;br /&gt;
*[[Feb_PhotFisRun_44MeV_March_2011]]&lt;br /&gt;
&lt;br /&gt;
=Analysis=&lt;br /&gt;
&lt;br /&gt;
*[[2008_HRRL_Analysis]]&lt;br /&gt;
*[[2011_44MeV_Analysis_2011]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Simulations=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
==Meeting Notes==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Hand Calculations==&lt;br /&gt;
&lt;br /&gt;
*[[Neutron Polarimeter]]&lt;br /&gt;
&lt;br /&gt;
*[[Dan's parallel calculation]]&lt;br /&gt;
&lt;br /&gt;
*[[2n correlations in Photofission]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Publications==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Radiator Foil]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Using Carbon or Aluminum to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 5 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 8 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Thickness of Lead to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Where does the radiator need to be?]]&lt;br /&gt;
&lt;br /&gt;
[[Determining the uncertainty of Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Things That Still Need to Get Done]]&lt;br /&gt;
&lt;br /&gt;
[[Tasks March 31, 2009]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 2nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (with Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Temporary Files]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics diagram 2/2/11]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (without Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Notes for the July 11th, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Column of Water Length]]&lt;br /&gt;
&lt;br /&gt;
[[Finding the Space Between Lead Shots]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics We Need to Collect]]&lt;br /&gt;
&lt;br /&gt;
[[Compton Scattering]]&lt;br /&gt;
&lt;br /&gt;
[[Constant Fraction Discriminator Details]]&lt;br /&gt;
&lt;br /&gt;
[[Magnet Calculations]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 22nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Current Conceptual Design of Beamline]]&lt;br /&gt;
&lt;br /&gt;
[[ Matching Detectors]]&lt;br /&gt;
&lt;br /&gt;
[[ Cosmic Ray Shielding Test ]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Time of Flight Test]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[PhotoFis.C (ROOT program to analyse data)]]&lt;br /&gt;
&lt;br /&gt;
[[Pictures of experimental setup]]&lt;br /&gt;
&lt;br /&gt;
[[Data bank]]&lt;br /&gt;
&lt;br /&gt;
[[Integrated asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Peaks fitting]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Production Thresholds]]&lt;br /&gt;
&lt;br /&gt;
[[Conversion TDC to Energy]] &lt;br /&gt;
&lt;br /&gt;
[[Cross Sections of C,N,O,Si,Pb]]&lt;br /&gt;
&lt;br /&gt;
[[TDC Calibration]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Plot FWHM distribution]&lt;br /&gt;
&lt;br /&gt;
[[A kind of analysis]]&lt;br /&gt;
&lt;br /&gt;
[[NaI spectra]]&lt;br /&gt;
&lt;br /&gt;
[[B-field calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Plastic Scintillator Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[New Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[Spectra Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung lineshape for E0 = 16 MeV, Ti radiator]]&lt;br /&gt;
&lt;br /&gt;
[[Flux from NaI vs. Gamma Flash]]&lt;br /&gt;
&lt;br /&gt;
[[ACCAPP_09_PhotFis_Poster]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer Info]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[March 2010 Run Report]]&lt;br /&gt;
&lt;br /&gt;
[[Minimum accelerator energy to run experiment]]&lt;br /&gt;
&lt;br /&gt;
[[Collimation geometry for different beam energies]]&lt;br /&gt;
&lt;br /&gt;
[[Counts Rate (44 MeV LINAC)]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer]]&lt;br /&gt;
&lt;br /&gt;
[[Aluminum Converter]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Temperature]]&lt;br /&gt;
&lt;br /&gt;
[[Kicker Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[MCNPX Simulations for Neutron Beam]]&lt;br /&gt;
&lt;br /&gt;
[[IAC experimental cell]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Detector Setup]]&lt;br /&gt;
&lt;br /&gt;
[[44 MeV Beam Line Optimization]]&lt;br /&gt;
&lt;br /&gt;
[[FFs angular asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics &amp;amp; DAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Cool beamline drawings]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Production Rate Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Ribbon Cable Attenuation Measurements]]&lt;br /&gt;
&lt;br /&gt;
[[Current Electronics]]&lt;br /&gt;
&lt;br /&gt;
[[Draft Run Plan 2/23/11]]&lt;br /&gt;
&lt;br /&gt;
[[44 Setup]]&lt;br /&gt;
&lt;br /&gt;
[[n's detectors threshold measurements 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[PS front and back count rates (cosmic) 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 44 MeV  3/1/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 25 MeV  3/4/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[D2O photodisintegration simulation]]&lt;br /&gt;
&lt;br /&gt;
[[Things to do different on next run]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's April 2011 2 neutron correlations talk]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's scribbles on the Hamamatsu R580 Voltage Divider Design]]&lt;br /&gt;
&lt;br /&gt;
[[n's det calibration]]&lt;br /&gt;
&lt;br /&gt;
[[2D Faraday Cup Data Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[(gamma,f) versus (gamma,f)]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung radiation properties, Ee=25 MeV]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/HRRL Go Back]&lt;br /&gt;
&lt;br /&gt;
=Other=&lt;br /&gt;
==Jason's Uploads==&lt;br /&gt;
[[File:PMT-Threshold-Testing.xls]]&lt;br /&gt;
&lt;br /&gt;
[http://sales.hamamatsu.com/index.php?id=13189439&amp;amp;src=newproductpage Hamamatsu Documentation]&lt;br /&gt;
&lt;br /&gt;
[[File:SaintGobainLightGudieQuote.pdf]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:PMT behaviors]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=User_talk:Stocjas2&amp;diff=63900</id>
		<title>User talk:Stocjas2</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=User_talk:Stocjas2&amp;diff=63900"/>
		<updated>2011-06-23T15:28:02Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Stuff=&lt;br /&gt;
Specs for the R580 PMT found at this website.&lt;br /&gt;
http://sales.hamamatsu.com/index.php?id=13189439&amp;amp;src=newproductpage&lt;br /&gt;
&lt;br /&gt;
[Presentation][[File:Presentaion.pdf]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=File:SaintGobainLightGudieQuote.pdf&amp;diff=63899</id>
		<title>File:SaintGobainLightGudieQuote.pdf</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=File:SaintGobainLightGudieQuote.pdf&amp;diff=63899"/>
		<updated>2011-06-23T15:27:18Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=63898</id>
		<title>PhotoFission with Polarized Photons from HRRL</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=63898"/>
		<updated>2011-06-23T15:27:04Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Jason's Uploads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:PhotfissionHeros_10-21-08.jpg | 500 px]]&lt;br /&gt;
&lt;br /&gt;
=Experiments=&lt;br /&gt;
*[[October Fission HRRL Measurements 2008]]&lt;br /&gt;
*[[Feb_PhotFisRun_44MeV_March_2011]]&lt;br /&gt;
&lt;br /&gt;
=Analysis=&lt;br /&gt;
&lt;br /&gt;
*[[2008_HRRL_Analysis]]&lt;br /&gt;
*[[2011_44MeV_Analysis_2011]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Simulations=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
==Meeting Notes==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Hand Calculations==&lt;br /&gt;
&lt;br /&gt;
*[[Neutron Polarimeter]]&lt;br /&gt;
&lt;br /&gt;
*[[Dan's parallel calculation]]&lt;br /&gt;
&lt;br /&gt;
*[[2n correlations in Photofission]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Publications==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Radiator Foil]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Using Carbon or Aluminum to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 5 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 8 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Thickness of Lead to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Where does the radiator need to be?]]&lt;br /&gt;
&lt;br /&gt;
[[Determining the uncertainty of Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Things That Still Need to Get Done]]&lt;br /&gt;
&lt;br /&gt;
[[Tasks March 31, 2009]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 2nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (with Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Temporary Files]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics diagram 2/2/11]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (without Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Notes for the July 11th, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Column of Water Length]]&lt;br /&gt;
&lt;br /&gt;
[[Finding the Space Between Lead Shots]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics We Need to Collect]]&lt;br /&gt;
&lt;br /&gt;
[[Compton Scattering]]&lt;br /&gt;
&lt;br /&gt;
[[Constant Fraction Discriminator Details]]&lt;br /&gt;
&lt;br /&gt;
[[Magnet Calculations]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 22nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Current Conceptual Design of Beamline]]&lt;br /&gt;
&lt;br /&gt;
[[ Matching Detectors]]&lt;br /&gt;
&lt;br /&gt;
[[ Cosmic Ray Shielding Test ]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Time of Flight Test]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[PhotoFis.C (ROOT program to analyse data)]]&lt;br /&gt;
&lt;br /&gt;
[[Pictures of experimental setup]]&lt;br /&gt;
&lt;br /&gt;
[[Data bank]]&lt;br /&gt;
&lt;br /&gt;
[[Integrated asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Peaks fitting]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Production Thresholds]]&lt;br /&gt;
&lt;br /&gt;
[[Conversion TDC to Energy]] &lt;br /&gt;
&lt;br /&gt;
[[Cross Sections of C,N,O,Si,Pb]]&lt;br /&gt;
&lt;br /&gt;
[[TDC Calibration]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Plot FWHM distribution]&lt;br /&gt;
&lt;br /&gt;
[[A kind of analysis]]&lt;br /&gt;
&lt;br /&gt;
[[NaI spectra]]&lt;br /&gt;
&lt;br /&gt;
[[B-field calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Plastic Scintillator Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[New Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[Spectra Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung lineshape for E0 = 16 MeV, Ti radiator]]&lt;br /&gt;
&lt;br /&gt;
[[Flux from NaI vs. Gamma Flash]]&lt;br /&gt;
&lt;br /&gt;
[[ACCAPP_09_PhotFis_Poster]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer Info]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[March 2010 Run Report]]&lt;br /&gt;
&lt;br /&gt;
[[Minimum accelerator energy to run experiment]]&lt;br /&gt;
&lt;br /&gt;
[[Collimation geometry for different beam energies]]&lt;br /&gt;
&lt;br /&gt;
[[Counts Rate (44 MeV LINAC)]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer]]&lt;br /&gt;
&lt;br /&gt;
[[Aluminum Converter]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Temperature]]&lt;br /&gt;
&lt;br /&gt;
[[Kicker Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[MCNPX Simulations for Neutron Beam]]&lt;br /&gt;
&lt;br /&gt;
[[IAC experimental cell]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Detector Setup]]&lt;br /&gt;
&lt;br /&gt;
[[44 MeV Beam Line Optimization]]&lt;br /&gt;
&lt;br /&gt;
[[FFs angular asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics &amp;amp; DAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Cool beamline drawings]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Production Rate Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Ribbon Cable Attenuation Measurements]]&lt;br /&gt;
&lt;br /&gt;
[[Current Electronics]]&lt;br /&gt;
&lt;br /&gt;
[[Draft Run Plan 2/23/11]]&lt;br /&gt;
&lt;br /&gt;
[[44 Setup]]&lt;br /&gt;
&lt;br /&gt;
[[n's detectors threshold measurements 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[PS front and back count rates (cosmic) 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 44 MeV  3/1/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 25 MeV  3/4/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[D2O photodisintegration simulation]]&lt;br /&gt;
&lt;br /&gt;
[[Things to do different on next run]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's April 2011 2 neutron correlations talk]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's scribbles on the Hamamatsu R580 Voltage Divider Design]]&lt;br /&gt;
&lt;br /&gt;
[[n's det calibration]]&lt;br /&gt;
&lt;br /&gt;
[[2D Faraday Cup Data Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[(gamma,f) versus (gamma,f)]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung radiation properties, Ee=25 MeV]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/HRRL Go Back]&lt;br /&gt;
&lt;br /&gt;
=Other=&lt;br /&gt;
==Jason's Uploads==&lt;br /&gt;
[[File:PMT-Threshold-Testing.xls]]&lt;br /&gt;
&lt;br /&gt;
[http://sales.hamamatsu.com/index.php?id=13189439&amp;amp;src=newproductpage Hamamatsu Documentation]&lt;br /&gt;
&lt;br /&gt;
[[File:SaintGobainLightGudieQuote.pdf]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=63897</id>
		<title>PhotoFission with Polarized Photons from HRRL</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=63897"/>
		<updated>2011-06-23T15:26:24Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Jason's Uploads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:PhotfissionHeros_10-21-08.jpg | 500 px]]&lt;br /&gt;
&lt;br /&gt;
=Experiments=&lt;br /&gt;
*[[October Fission HRRL Measurements 2008]]&lt;br /&gt;
*[[Feb_PhotFisRun_44MeV_March_2011]]&lt;br /&gt;
&lt;br /&gt;
=Analysis=&lt;br /&gt;
&lt;br /&gt;
*[[2008_HRRL_Analysis]]&lt;br /&gt;
*[[2011_44MeV_Analysis_2011]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Simulations=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
==Meeting Notes==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Hand Calculations==&lt;br /&gt;
&lt;br /&gt;
*[[Neutron Polarimeter]]&lt;br /&gt;
&lt;br /&gt;
*[[Dan's parallel calculation]]&lt;br /&gt;
&lt;br /&gt;
*[[2n correlations in Photofission]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Publications==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Radiator Foil]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Using Carbon or Aluminum to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 5 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 8 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Thickness of Lead to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Where does the radiator need to be?]]&lt;br /&gt;
&lt;br /&gt;
[[Determining the uncertainty of Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Things That Still Need to Get Done]]&lt;br /&gt;
&lt;br /&gt;
[[Tasks March 31, 2009]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 2nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (with Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Temporary Files]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics diagram 2/2/11]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (without Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Notes for the July 11th, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Column of Water Length]]&lt;br /&gt;
&lt;br /&gt;
[[Finding the Space Between Lead Shots]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics We Need to Collect]]&lt;br /&gt;
&lt;br /&gt;
[[Compton Scattering]]&lt;br /&gt;
&lt;br /&gt;
[[Constant Fraction Discriminator Details]]&lt;br /&gt;
&lt;br /&gt;
[[Magnet Calculations]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 22nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Current Conceptual Design of Beamline]]&lt;br /&gt;
&lt;br /&gt;
[[ Matching Detectors]]&lt;br /&gt;
&lt;br /&gt;
[[ Cosmic Ray Shielding Test ]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Time of Flight Test]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[PhotoFis.C (ROOT program to analyse data)]]&lt;br /&gt;
&lt;br /&gt;
[[Pictures of experimental setup]]&lt;br /&gt;
&lt;br /&gt;
[[Data bank]]&lt;br /&gt;
&lt;br /&gt;
[[Integrated asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Peaks fitting]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Production Thresholds]]&lt;br /&gt;
&lt;br /&gt;
[[Conversion TDC to Energy]] &lt;br /&gt;
&lt;br /&gt;
[[Cross Sections of C,N,O,Si,Pb]]&lt;br /&gt;
&lt;br /&gt;
[[TDC Calibration]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Plot FWHM distribution]&lt;br /&gt;
&lt;br /&gt;
[[A kind of analysis]]&lt;br /&gt;
&lt;br /&gt;
[[NaI spectra]]&lt;br /&gt;
&lt;br /&gt;
[[B-field calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Plastic Scintillator Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[New Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[Spectra Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung lineshape for E0 = 16 MeV, Ti radiator]]&lt;br /&gt;
&lt;br /&gt;
[[Flux from NaI vs. Gamma Flash]]&lt;br /&gt;
&lt;br /&gt;
[[ACCAPP_09_PhotFis_Poster]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer Info]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[March 2010 Run Report]]&lt;br /&gt;
&lt;br /&gt;
[[Minimum accelerator energy to run experiment]]&lt;br /&gt;
&lt;br /&gt;
[[Collimation geometry for different beam energies]]&lt;br /&gt;
&lt;br /&gt;
[[Counts Rate (44 MeV LINAC)]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer]]&lt;br /&gt;
&lt;br /&gt;
[[Aluminum Converter]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Temperature]]&lt;br /&gt;
&lt;br /&gt;
[[Kicker Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[MCNPX Simulations for Neutron Beam]]&lt;br /&gt;
&lt;br /&gt;
[[IAC experimental cell]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Detector Setup]]&lt;br /&gt;
&lt;br /&gt;
[[44 MeV Beam Line Optimization]]&lt;br /&gt;
&lt;br /&gt;
[[FFs angular asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics &amp;amp; DAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Cool beamline drawings]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Production Rate Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Ribbon Cable Attenuation Measurements]]&lt;br /&gt;
&lt;br /&gt;
[[Current Electronics]]&lt;br /&gt;
&lt;br /&gt;
[[Draft Run Plan 2/23/11]]&lt;br /&gt;
&lt;br /&gt;
[[44 Setup]]&lt;br /&gt;
&lt;br /&gt;
[[n's detectors threshold measurements 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[PS front and back count rates (cosmic) 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 44 MeV  3/1/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 25 MeV  3/4/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[D2O photodisintegration simulation]]&lt;br /&gt;
&lt;br /&gt;
[[Things to do different on next run]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's April 2011 2 neutron correlations talk]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's scribbles on the Hamamatsu R580 Voltage Divider Design]]&lt;br /&gt;
&lt;br /&gt;
[[n's det calibration]]&lt;br /&gt;
&lt;br /&gt;
[[2D Faraday Cup Data Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[(gamma,f) versus (gamma,f)]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung radiation properties, Ee=25 MeV]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/HRRL Go Back]&lt;br /&gt;
&lt;br /&gt;
=Other=&lt;br /&gt;
==Jason's Uploads==&lt;br /&gt;
[[File:PMT-Threshold-Testing.xls]]&lt;br /&gt;
&lt;br /&gt;
[http://sales.hamamatsu.com/index.php?id=13189439&amp;amp;src=newproductpage Hamamatsu Documentation]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=63896</id>
		<title>PhotoFission with Polarized Photons from HRRL</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=63896"/>
		<updated>2011-06-23T15:26:01Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Jason's Uploads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:PhotfissionHeros_10-21-08.jpg | 500 px]]&lt;br /&gt;
&lt;br /&gt;
=Experiments=&lt;br /&gt;
*[[October Fission HRRL Measurements 2008]]&lt;br /&gt;
*[[Feb_PhotFisRun_44MeV_March_2011]]&lt;br /&gt;
&lt;br /&gt;
=Analysis=&lt;br /&gt;
&lt;br /&gt;
*[[2008_HRRL_Analysis]]&lt;br /&gt;
*[[2011_44MeV_Analysis_2011]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Simulations=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
==Meeting Notes==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Hand Calculations==&lt;br /&gt;
&lt;br /&gt;
*[[Neutron Polarimeter]]&lt;br /&gt;
&lt;br /&gt;
*[[Dan's parallel calculation]]&lt;br /&gt;
&lt;br /&gt;
*[[2n correlations in Photofission]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Publications==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Radiator Foil]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Using Carbon or Aluminum to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 5 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 8 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Thickness of Lead to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Where does the radiator need to be?]]&lt;br /&gt;
&lt;br /&gt;
[[Determining the uncertainty of Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Things That Still Need to Get Done]]&lt;br /&gt;
&lt;br /&gt;
[[Tasks March 31, 2009]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 2nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (with Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Temporary Files]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics diagram 2/2/11]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (without Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Notes for the July 11th, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Column of Water Length]]&lt;br /&gt;
&lt;br /&gt;
[[Finding the Space Between Lead Shots]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics We Need to Collect]]&lt;br /&gt;
&lt;br /&gt;
[[Compton Scattering]]&lt;br /&gt;
&lt;br /&gt;
[[Constant Fraction Discriminator Details]]&lt;br /&gt;
&lt;br /&gt;
[[Magnet Calculations]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 22nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Current Conceptual Design of Beamline]]&lt;br /&gt;
&lt;br /&gt;
[[ Matching Detectors]]&lt;br /&gt;
&lt;br /&gt;
[[ Cosmic Ray Shielding Test ]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Time of Flight Test]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[PhotoFis.C (ROOT program to analyse data)]]&lt;br /&gt;
&lt;br /&gt;
[[Pictures of experimental setup]]&lt;br /&gt;
&lt;br /&gt;
[[Data bank]]&lt;br /&gt;
&lt;br /&gt;
[[Integrated asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Peaks fitting]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Production Thresholds]]&lt;br /&gt;
&lt;br /&gt;
[[Conversion TDC to Energy]] &lt;br /&gt;
&lt;br /&gt;
[[Cross Sections of C,N,O,Si,Pb]]&lt;br /&gt;
&lt;br /&gt;
[[TDC Calibration]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Plot FWHM distribution]&lt;br /&gt;
&lt;br /&gt;
[[A kind of analysis]]&lt;br /&gt;
&lt;br /&gt;
[[NaI spectra]]&lt;br /&gt;
&lt;br /&gt;
[[B-field calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Plastic Scintillator Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[New Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[Spectra Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung lineshape for E0 = 16 MeV, Ti radiator]]&lt;br /&gt;
&lt;br /&gt;
[[Flux from NaI vs. Gamma Flash]]&lt;br /&gt;
&lt;br /&gt;
[[ACCAPP_09_PhotFis_Poster]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer Info]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[March 2010 Run Report]]&lt;br /&gt;
&lt;br /&gt;
[[Minimum accelerator energy to run experiment]]&lt;br /&gt;
&lt;br /&gt;
[[Collimation geometry for different beam energies]]&lt;br /&gt;
&lt;br /&gt;
[[Counts Rate (44 MeV LINAC)]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer]]&lt;br /&gt;
&lt;br /&gt;
[[Aluminum Converter]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Temperature]]&lt;br /&gt;
&lt;br /&gt;
[[Kicker Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[MCNPX Simulations for Neutron Beam]]&lt;br /&gt;
&lt;br /&gt;
[[IAC experimental cell]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Detector Setup]]&lt;br /&gt;
&lt;br /&gt;
[[44 MeV Beam Line Optimization]]&lt;br /&gt;
&lt;br /&gt;
[[FFs angular asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics &amp;amp; DAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Cool beamline drawings]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Production Rate Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Ribbon Cable Attenuation Measurements]]&lt;br /&gt;
&lt;br /&gt;
[[Current Electronics]]&lt;br /&gt;
&lt;br /&gt;
[[Draft Run Plan 2/23/11]]&lt;br /&gt;
&lt;br /&gt;
[[44 Setup]]&lt;br /&gt;
&lt;br /&gt;
[[n's detectors threshold measurements 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[PS front and back count rates (cosmic) 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 44 MeV  3/1/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 25 MeV  3/4/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[D2O photodisintegration simulation]]&lt;br /&gt;
&lt;br /&gt;
[[Things to do different on next run]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's April 2011 2 neutron correlations talk]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's scribbles on the Hamamatsu R580 Voltage Divider Design]]&lt;br /&gt;
&lt;br /&gt;
[[n's det calibration]]&lt;br /&gt;
&lt;br /&gt;
[[2D Faraday Cup Data Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[(gamma,f) versus (gamma,f)]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung radiation properties, Ee=25 MeV]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/HRRL Go Back]&lt;br /&gt;
&lt;br /&gt;
=Other=&lt;br /&gt;
==Jason's Uploads==&lt;br /&gt;
[[File:PMT-Threshold-Testing.xls]]&lt;br /&gt;
[http://sales.hamamatsu.com/index.php?id=13189439&amp;amp;src=newproductpage Hamamatsu Documentation]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=63895</id>
		<title>PhotoFission with Polarized Photons from HRRL</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=63895"/>
		<updated>2011-06-23T15:25:28Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: /* Jason's Uploads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:PhotfissionHeros_10-21-08.jpg | 500 px]]&lt;br /&gt;
&lt;br /&gt;
=Experiments=&lt;br /&gt;
*[[October Fission HRRL Measurements 2008]]&lt;br /&gt;
*[[Feb_PhotFisRun_44MeV_March_2011]]&lt;br /&gt;
&lt;br /&gt;
=Analysis=&lt;br /&gt;
&lt;br /&gt;
*[[2008_HRRL_Analysis]]&lt;br /&gt;
*[[2011_44MeV_Analysis_2011]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Simulations=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
==Meeting Notes==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Hand Calculations==&lt;br /&gt;
&lt;br /&gt;
*[[Neutron Polarimeter]]&lt;br /&gt;
&lt;br /&gt;
*[[Dan's parallel calculation]]&lt;br /&gt;
&lt;br /&gt;
*[[2n correlations in Photofission]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Publications==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Radiator Foil]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Using Carbon or Aluminum to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 5 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 8 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Thickness of Lead to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Where does the radiator need to be?]]&lt;br /&gt;
&lt;br /&gt;
[[Determining the uncertainty of Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Things That Still Need to Get Done]]&lt;br /&gt;
&lt;br /&gt;
[[Tasks March 31, 2009]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 2nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (with Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Temporary Files]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics diagram 2/2/11]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (without Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Notes for the July 11th, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Column of Water Length]]&lt;br /&gt;
&lt;br /&gt;
[[Finding the Space Between Lead Shots]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics We Need to Collect]]&lt;br /&gt;
&lt;br /&gt;
[[Compton Scattering]]&lt;br /&gt;
&lt;br /&gt;
[[Constant Fraction Discriminator Details]]&lt;br /&gt;
&lt;br /&gt;
[[Magnet Calculations]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 22nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Current Conceptual Design of Beamline]]&lt;br /&gt;
&lt;br /&gt;
[[ Matching Detectors]]&lt;br /&gt;
&lt;br /&gt;
[[ Cosmic Ray Shielding Test ]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Time of Flight Test]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[PhotoFis.C (ROOT program to analyse data)]]&lt;br /&gt;
&lt;br /&gt;
[[Pictures of experimental setup]]&lt;br /&gt;
&lt;br /&gt;
[[Data bank]]&lt;br /&gt;
&lt;br /&gt;
[[Integrated asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Peaks fitting]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Production Thresholds]]&lt;br /&gt;
&lt;br /&gt;
[[Conversion TDC to Energy]] &lt;br /&gt;
&lt;br /&gt;
[[Cross Sections of C,N,O,Si,Pb]]&lt;br /&gt;
&lt;br /&gt;
[[TDC Calibration]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Plot FWHM distribution]&lt;br /&gt;
&lt;br /&gt;
[[A kind of analysis]]&lt;br /&gt;
&lt;br /&gt;
[[NaI spectra]]&lt;br /&gt;
&lt;br /&gt;
[[B-field calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Plastic Scintillator Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[New Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[Spectra Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung lineshape for E0 = 16 MeV, Ti radiator]]&lt;br /&gt;
&lt;br /&gt;
[[Flux from NaI vs. Gamma Flash]]&lt;br /&gt;
&lt;br /&gt;
[[ACCAPP_09_PhotFis_Poster]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer Info]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[March 2010 Run Report]]&lt;br /&gt;
&lt;br /&gt;
[[Minimum accelerator energy to run experiment]]&lt;br /&gt;
&lt;br /&gt;
[[Collimation geometry for different beam energies]]&lt;br /&gt;
&lt;br /&gt;
[[Counts Rate (44 MeV LINAC)]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer]]&lt;br /&gt;
&lt;br /&gt;
[[Aluminum Converter]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Temperature]]&lt;br /&gt;
&lt;br /&gt;
[[Kicker Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[MCNPX Simulations for Neutron Beam]]&lt;br /&gt;
&lt;br /&gt;
[[IAC experimental cell]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Detector Setup]]&lt;br /&gt;
&lt;br /&gt;
[[44 MeV Beam Line Optimization]]&lt;br /&gt;
&lt;br /&gt;
[[FFs angular asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics &amp;amp; DAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Cool beamline drawings]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Production Rate Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Ribbon Cable Attenuation Measurements]]&lt;br /&gt;
&lt;br /&gt;
[[Current Electronics]]&lt;br /&gt;
&lt;br /&gt;
[[Draft Run Plan 2/23/11]]&lt;br /&gt;
&lt;br /&gt;
[[44 Setup]]&lt;br /&gt;
&lt;br /&gt;
[[n's detectors threshold measurements 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[PS front and back count rates (cosmic) 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 44 MeV  3/1/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 25 MeV  3/4/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[D2O photodisintegration simulation]]&lt;br /&gt;
&lt;br /&gt;
[[Things to do different on next run]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's April 2011 2 neutron correlations talk]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's scribbles on the Hamamatsu R580 Voltage Divider Design]]&lt;br /&gt;
&lt;br /&gt;
[[n's det calibration]]&lt;br /&gt;
&lt;br /&gt;
[[2D Faraday Cup Data Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[(gamma,f) versus (gamma,f)]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung radiation properties, Ee=25 MeV]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/HRRL Go Back]&lt;br /&gt;
&lt;br /&gt;
=Other=&lt;br /&gt;
==Jason's Uploads==&lt;br /&gt;
Specs for the R580 PMT found at this website. http://sales.hamamatsu.com/index.php?id=13189439&amp;amp;src=newproductpage&lt;br /&gt;
[[File:PMT-Threshold-Testing.xls]]&lt;br /&gt;
[Hamamatsu Documentation]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
	<entry>
		<id>https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=63894</id>
		<title>PhotoFission with Polarized Photons from HRRL</title>
		<link rel="alternate" type="text/html" href="https://wiki.iac.isu.edu/index.php?title=PhotoFission_with_Polarized_Photons_from_HRRL&amp;diff=63894"/>
		<updated>2011-06-23T15:24:58Z</updated>

		<summary type="html">&lt;p&gt;Stocjas2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:PhotfissionHeros_10-21-08.jpg | 500 px]]&lt;br /&gt;
&lt;br /&gt;
=Experiments=&lt;br /&gt;
*[[October Fission HRRL Measurements 2008]]&lt;br /&gt;
*[[Feb_PhotFisRun_44MeV_March_2011]]&lt;br /&gt;
&lt;br /&gt;
=Analysis=&lt;br /&gt;
&lt;br /&gt;
*[[2008_HRRL_Analysis]]&lt;br /&gt;
*[[2011_44MeV_Analysis_2011]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Simulations=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
==Meeting Notes==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Hand Calculations==&lt;br /&gt;
&lt;br /&gt;
*[[Neutron Polarimeter]]&lt;br /&gt;
&lt;br /&gt;
*[[Dan's parallel calculation]]&lt;br /&gt;
&lt;br /&gt;
*[[2n correlations in Photofission]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Publications==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Radiator Foil]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Using Carbon or Aluminum to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 5 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Eγ vs probability with 8 cm of D20 ]]&lt;br /&gt;
&lt;br /&gt;
[[Thickness of Lead to block photons]]&lt;br /&gt;
&lt;br /&gt;
[[Where does the radiator need to be?]]&lt;br /&gt;
&lt;br /&gt;
[[Determining the uncertainty of Eγ]]&lt;br /&gt;
&lt;br /&gt;
[[Things That Still Need to Get Done]]&lt;br /&gt;
&lt;br /&gt;
[[Tasks March 31, 2009]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 2nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (with Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Temporary Files]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics diagram 2/2/11]]&lt;br /&gt;
&lt;br /&gt;
[[Brems Intensity Spectrum (without Collimation Factors) Plots]]&lt;br /&gt;
&lt;br /&gt;
[[Notes for the July 11th, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Column of Water Length]]&lt;br /&gt;
&lt;br /&gt;
[[Finding the Space Between Lead Shots]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics We Need to Collect]]&lt;br /&gt;
&lt;br /&gt;
[[Compton Scattering]]&lt;br /&gt;
&lt;br /&gt;
[[Constant Fraction Discriminator Details]]&lt;br /&gt;
&lt;br /&gt;
[[Magnet Calculations]]&lt;br /&gt;
&lt;br /&gt;
[[Notes from July 22nd, 2008 Meeting]]&lt;br /&gt;
&lt;br /&gt;
[[Current Conceptual Design of Beamline]]&lt;br /&gt;
&lt;br /&gt;
[[ Matching Detectors]]&lt;br /&gt;
&lt;br /&gt;
[[ Cosmic Ray Shielding Test ]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Time of Flight Test]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[PhotoFis.C (ROOT program to analyse data)]]&lt;br /&gt;
&lt;br /&gt;
[[Pictures of experimental setup]]&lt;br /&gt;
&lt;br /&gt;
[[Data bank]]&lt;br /&gt;
&lt;br /&gt;
[[Integrated asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Peaks fitting]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Production Thresholds]]&lt;br /&gt;
&lt;br /&gt;
[[Conversion TDC to Energy]] &lt;br /&gt;
&lt;br /&gt;
[[Cross Sections of C,N,O,Si,Pb]]&lt;br /&gt;
&lt;br /&gt;
[[TDC Calibration]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/Plot FWHM distribution]&lt;br /&gt;
&lt;br /&gt;
[[A kind of analysis]]&lt;br /&gt;
&lt;br /&gt;
[[NaI spectra]]&lt;br /&gt;
&lt;br /&gt;
[[B-field calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Plastic Scintillator Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[New Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[Spectra Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung lineshape for E0 = 16 MeV, Ti radiator]]&lt;br /&gt;
&lt;br /&gt;
[[Flux from NaI vs. Gamma Flash]]&lt;br /&gt;
&lt;br /&gt;
[[ACCAPP_09_PhotFis_Poster]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer Info]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[March 2010 Run Report]]&lt;br /&gt;
&lt;br /&gt;
[[Minimum accelerator energy to run experiment]]&lt;br /&gt;
&lt;br /&gt;
[[Collimation geometry for different beam energies]]&lt;br /&gt;
&lt;br /&gt;
[[Counts Rate (44 MeV LINAC)]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Spectrometer]]&lt;br /&gt;
&lt;br /&gt;
[[Aluminum Converter]]&lt;br /&gt;
&lt;br /&gt;
[[Faraday Cup Temperature]]&lt;br /&gt;
&lt;br /&gt;
[[Kicker Magnets]]&lt;br /&gt;
&lt;br /&gt;
[[MCNPX Simulations for Neutron Beam]]&lt;br /&gt;
&lt;br /&gt;
[[IAC experimental cell]]&lt;br /&gt;
&lt;br /&gt;
[[Neutron Detector Setup]]&lt;br /&gt;
&lt;br /&gt;
[[44 MeV Beam Line Optimization]]&lt;br /&gt;
&lt;br /&gt;
[[FFs angular asymmetry]]&lt;br /&gt;
&lt;br /&gt;
[[Electronics &amp;amp; DAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Cool beamline drawings]]&lt;br /&gt;
&lt;br /&gt;
[[Pair Production Rate Calculation]]&lt;br /&gt;
&lt;br /&gt;
[[Ribbon Cable Attenuation Measurements]]&lt;br /&gt;
&lt;br /&gt;
[[Current Electronics]]&lt;br /&gt;
&lt;br /&gt;
[[Draft Run Plan 2/23/11]]&lt;br /&gt;
&lt;br /&gt;
[[44 Setup]]&lt;br /&gt;
&lt;br /&gt;
[[n's detectors threshold measurements 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[PS front and back count rates (cosmic) 2/28/11]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 44 MeV  3/1/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[FC calibration 25 MeV  3/4/11 ]]&lt;br /&gt;
&lt;br /&gt;
[[D2O photodisintegration simulation]]&lt;br /&gt;
&lt;br /&gt;
[[Things to do different on next run]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's April 2011 2 neutron correlations talk]]&lt;br /&gt;
&lt;br /&gt;
[[Dan's scribbles on the Hamamatsu R580 Voltage Divider Design]]&lt;br /&gt;
&lt;br /&gt;
[[n's det calibration]]&lt;br /&gt;
&lt;br /&gt;
[[2D Faraday Cup Data Analysis]]&lt;br /&gt;
&lt;br /&gt;
[[(gamma,f) versus (gamma,f)]]&lt;br /&gt;
&lt;br /&gt;
[[Bremsstrahlung radiation properties, Ee=25 MeV]]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.iac.isu.edu/index.php/HRRL Go Back]&lt;br /&gt;
&lt;br /&gt;
=Other=&lt;br /&gt;
==Jason's Uploads==&lt;br /&gt;
Specs for the R580 PMT found at this website. http://sales.hamamatsu.com/index.php?id=13189439&amp;amp;src=newproductpage&lt;br /&gt;
[[File:PMT-Threshold-Testing.xls]]&lt;/div&gt;</summary>
		<author><name>Stocjas2</name></author>
	</entry>
</feed>