Physics307L F09:Schedule/Week 8 agenda/Linear fit theory

Following John R. Taylor, "An Introduction to Error Analysis," 2nd edition, Chapter 8:

We have a relation as follows, and want to fit $$\ A$$ and $$\ B$$ to the data

 * $$\ y=A+Bx$$

For a given $$\ A$$ and $$\ B$$, the probability for each $$\ y_i$$ is:

 * $$Prob(y_i) \propto \frac{1}{\sigma_y}e^{-(y_i-A-Bx_i)^2/2\sigma_y^2}$$

And we can call the probability of getting all of the data points as:

 * $$Prob = Prob(y_1) \cdot Prob(y_2) \cdot ... \cdot Prob(y_N)$$

Each term has the same $$\sigma_y$$, so can be simplified as:

 * $$Prob \propto \frac{1}{\sigma_y^N}e^{-\chi^2/2}$$
 * $$chi-squared, \chi^2 = \sum_{i=1}^N \frac{\left (y_i - A - Bx_i \right )^2}{\sigma_y^2}$$

To maximize the probability, minimize the chi-squared sum ... take derivatives, solve system of equations, obtain:
(1) $$AN + B \sum x_i = \sum y_i$$ (2) $$A \sum x_i + B \sum x_i^2 = \sum x_i y_i$$


 * $$A=\frac{\sum x_i^2 \sum y_i^2 - \sum x_i \sum x_i y_i}{\Delta}$$


 * $$B=\frac{N\sum x_i y_i - \sum x_i \sum y_i}{\Delta}$$


 * $$\Delta=N \sum x_i^2 - \left ( \sum x_i \right )^2$$