Lecture 4: Fitting Straight Lines by the Least-Squares Method M.Shattuck, CUNY, Ideal Particle Image Physics 3719 Spring Semester 2011 Problem of Straight-Line Fitting ● We have discussed and seen examples of linearization of data, in which we recast mathematical relations between variables in straight-line form – Easy to recognize by eye – Easy to fit 24 January 2011 Physics 3719, Lecture 04 2 Transform to Linear: Basic Idea x = independent variable y = dependent variable slope 24 January 2011 intercept Physics 3719, Lecture 04 3 Transform to Linear: Example 24 January 2011 Physics 3719, Lecture 04 4 Problem of Straight-Line Fitting ● Remaining problem: I have a set of points (xi,yi ± i) which I expect to follow a linear relationship y = A + Bx What is my best estimate for the coefficients A, B? 24 January 2011 Physics 3719, Lecture 04 5 st 1 : Mechanical Analog ● Suppose we have a set of points (xi,yi). 24 January 2011 Physics 3719, Lecture 04 6 st 1 : Mechanical Analog ● ● Suppose we have a set of points (xi,yi). To each point, connect a spring. (Imagine spring can only move in y direction.) 24 January 2011 Physics 3719, Lecture 04 7 st 1 : Mechanical Analog ● ● ● Suppose we have a set of points (xi,yi). To each point, connect a spring. (Imagine spring can only move in y direction.) To the other end of the springs attach a rigid rod. 24 January 2011 Physics 3719, Lecture 04 8 st 1 : Mechanical Analog ● ● ● ● Suppose we have a set of points (xi,yi). To each point, connect a spring. (Imagine spring can only move in y direction.) To the other end of the springs attach a rigid rod. What will determine where rod comes to rest? 24 January 2011 Physics 3719, Lecture 04 9 Equilibrium position of rod will minimize potential energy. 24 January 2011 Physics 3719, Lecture 04 10 define where In terms of stretch of string then 24 January 2011 Physics 3719, Lecture 04 11 Discussion ● ● To what does the spring constant k correspond in our linear fitting problem? Must the ki all be the same? 24 January 2011 Physics 3719, Lecture 04 12 replace thus replace With the “chi-squared” function: 24 January 2011 Physics 3719, Lecture 04 13 Minimization of 2 Solve two equations in two unknowns See handouts for results. 24 January 2011 Physics 3719, Lecture 04 14 Application left for homework exercise! 24 January 2011 Physics 3719, Lecture 04 15 Accuracy and Precision/ Statistical and Systematic 24 January 2011 Physics 3719, Lecture 04 16 Uncertainties in Experimental Physics ● ● Freshman physics: – 90% of time is spent measuring central value – Compare to “accepted value” – Tack on experimental uncertainty as an afterthought, if at all. Undergrad Lab (and the rest of your careers): – Spend most of your time understanding errors – Before you even touch equipment! – Is experiment worth doing? Will someone fund it? 24 January 2011 Physics 3719, Lecture 04 17 Terminology... ● ● Accuracy: How close to True value? Precision: What is the spread you'd see in repeated measurements? 24 January 2011 Physics 3719, Lecture 04 18 More terminology... ● ● ● Random or Statistical Error: Can be reduced by taking more measurements Systematic Error: Cannot be reduced by taking more measurements Q: When is an experiment “finished”? 24 January 2011 Physics 3719, Lecture 04 19 24 January 2011 Physics 3719, Lecture 04 20 24 January 2011 Physics 3719, Lecture 04 21