linear fits

9
Linear fits You know how to use the solver to minimize the chi^2 to do linear fits… Where do the errors on the slope and intercept come from?

Upload: nevada-mcfarland

Post on 31-Dec-2015

13 views

Category:

Documents


0 download

DESCRIPTION

Linear fits. You know how to use the solver to minimize the chi^2 to do linear fits… Where do the errors on the slope and intercept come from?. Linear Fits. So far, in order to do a linear fit, we have used the solver to find the values of m and b that minimize chi^2. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Linear fits

Linear fits

You know how to use the solver to minimize the chi^2 to do linear fits…

Where do the errors on the slope and intercept come from?

Page 2: Linear fits

Linear Fits

So far, in order to do a linear fit, we have used the solver to find the values of m and b that minimize chi^2

When the theory has only a linear dependence on its parameters, then the minimum in 2 can be determined analytically. This is why it’s very nice to put data into a form where it can be described by a theory that depends linearly on its parameters.

e.g., any polynomial function such as yth = A + Bx + Cx2 + …is linear in the parameters (A,B,C,…). So let’s minimize c2 for a simple polynomial: a straight line theory.

Using this analytically expression, its also straight-forward to derive an analytical expression for the errors on the slope and intercept.

Page 3: Linear fits

Minimizing 2

Suppose we have data (xi, yi,i) and we want to fit the data to a line: y = A + Bx. First we calculate 2:

i i

ii BxAy2

22

Then we minimize it with respect to the parameters of the theory, A and B. To find the best values of both A and B, we need to carry out this minimization simultaneously. So we take the partial derivative of 2 w.r.t. A and B, and set them both to 0 simultaneously.

iii

i

i

iii

i

BxAyx

B

BxAyA

02

01

2

2

2

2

2

Page 4: Linear fits

Minimizing 2, cont’d.

i i

i

i i

i

i i

ii

i i

i

i ii i

i

xB

xA

yx

xBA

y

2

2

22

222

1

Here are our two equations, rearranged. Note that all the quantities in parentheses can be computed directly from our data, so they are just numbers.Using linear algebra or matrix techniques, it is simple to invert these equations to find A and B.I won’t do it here, but will just write the answer.

The answer is:

i i

i

i i

i

i i

ii

i i

i i

ii

i i

i

i i

i

i i

i

yxyxB

yxxyxA

2222

2222

2

11

1

i i

i

i i

i

i i

i

i i

xx

x

2

2

2

22

1

det

Page 5: Linear fits

Error on Slope and Intercept

Our calculated value for A and B depend on the measured values x_i, y_i. We can therefore get the errors on A and B by using the standard propagation of errors formula on our formulas for these quantities.

Let’s do this for the intercept. The derivation for the error on the slope is parallel.

Let’s also just do this for the simple case when the errors on x are small (negligible) and the errors on the y’s are all the same (sigma_i -> sigma)

Page 6: Linear fits

Error on Intercept

i i

i

i i

i

i i

i

i i

xx

x

2

2

2

22

1

det

Does not depend on y_i.If ignoring errors on x_i, this is just a constant

222

1( i iN x x

When sigma_i -> sigma

Page 7: Linear fits

Error on Intercept

2

2 2 2 2

1 i i i i i

i i i ii i i i

x y x x yA

If the sigma_i’s are all the same (sigma), this becomes

22

1i i i i i

i i i i

A x y x x y

Page 8: Linear fits

Error on intercept2

2

22

22

2 2 22

2 2 2 2 22

1

1

1

1( )

( ) 2 ( )( ) ( )

i i i i ii i i i

j i jj ji

j i jj j

A j i ji j j

j i j j i jj j

A x y x x y

Ax x x

y

x x x

x x x

x x x x x x

2 2 2 2 2 22

2 2 2 22

2 2 22

( ) 2( ) ( ) ( )( )

( ) ( )( )

( ( ) ( ) )

i j

j j j j jj j j j j

j j jj j j

j j jj j

N x x x x x

N x x x

N x x x

Page 9: Linear fits

Error on Intercept

2j

A

x

Look in your linear fitter spread sheet and you’ll see this linked to the error on intercept sheet