Sec 8 1 Discrete Least Squares Approximation Sec

  • Slides: 17
Download presentation
Sec: 8. 1 Discrete Least Squares Approximation

Sec: 8. 1 Discrete Least Squares Approximation

Sec: 8. 1 Discrete Least Squares Approximation Find a relationship between x and y.

Sec: 8. 1 Discrete Least Squares Approximation Find a relationship between x and y. From this graph, it appears that the actual relationship between x and y is linear. The likely reason that no line precisely fits the data is because of errors in the data.

Sec: 8. 1 Discrete Least Squares Approximation Fit the data in Table with the

Sec: 8. 1 Discrete Least Squares Approximation Fit the data in Table with the discrete least squares polynomial of degree at most 2. Matrix Form This is a linear system of 3 equations in 3 unknowns 8. 7680 30. 5736 122. 8038 5 15 55 225 979 0. 8418 0. 1106 0. 0527 normal equations

Sec: 8. 1 Discrete Least Squares Approximation Fit the data in Table with the

Sec: 8. 1 Discrete Least Squares Approximation Fit the data in Table with the discrete least squares polynomial of degree at most 2. 0 0. 2500 0. 5000 0. 7500 1. 0000 1. 2840 1. 6487 2. 1170 2. 7183 1. 0051 1. 2739 1. 6481 2. 1278 2. 7130 0. 0051 0. 0101 0. 0006 0. 0108 0. 0053

Sec: 8. 1 Discrete Least Squares Approximation EXAMPLE: Use least-squares regression to fit a

Sec: 8. 1 Discrete Least Squares Approximation EXAMPLE: Use least-squares regression to fit a straight line to x [ 0 2 4 6 9 11 12 15 17 19 ] y [ 5 6 7 6 9 8 7 10 12 12 ] Plot the data and the regression line. clear x = [ 0 2 4 6 9 11 12 15 17 19 ]'; Y = [ 5 6 7 6 9 8 7 10 12 12 ]'; n = length(x) X = [ones(n, 1) x ]; % Y = X * a % B = X'*X; Z = X' * Y; a = BZ a = XY xx=[0: 0. 1: 19]'; yy=a(1)+a(2)*xx; plot(x, Y, 'xr', xx, yy, '-b'); grid on

Sec: 8. 1 Discrete Least Squares Approximation Derivation for the formula: One strategy for

Sec: 8. 1 Discrete Least Squares Approximation Derivation for the formula: One strategy for fitting a “best” line through the data would be to minimize the sum of the absolute value of residual errors for all the available data To minimize a function of two variables, we need to set its partial derivatives to zero and simultaneously solve the resulting equations. The problem is that the absolute-value function is not differentiable at zero, and we might not be able to find solutions to this pair of equations. EXAMPLE: Use least-squares regression to fit a straight line to x [ 0 2 4 6 9 11 12 15 17 19 ] y [ 5 6 7 6 9 8 7 10 12 12 ]

Sec: 8. 1 Discrete Least Squares Approximation Least Squares The least squares approach to

Sec: 8. 1 Discrete Least Squares Approximation Least Squares The least squares approach to this problem involves determining the best approximating line when the error involved is the sum of the squares EXAMPLE: Use least-squares regression to fit a straight line to x [ 0 2 4 6 9 11 12 15 17 19 ] y [ 5 6 7 6 9 8 7 10 12 12 ] The least squares method is the most convenient procedure for determining best linear approximations For a minimum to occur, we need both

Sec: 8. 1 Discrete Least Squares Approximation Least Squares For a minimum to occur,

Sec: 8. 1 Discrete Least Squares Approximation Least Squares For a minimum to occur, we need both These are called the normal equations.

Sec: 8. 1 Discrete Least Squares Approximation Least Squares Use least-squares regression to fit

Sec: 8. 1 Discrete Least Squares Approximation Least Squares Use least-squares regression to fit a straight line to These are called the normal equations. Matrix Form

Sec: 8. 1 Discrete Least Squares Approximation Derivation for the formula: (polynomial of degree

Sec: 8. 1 Discrete Least Squares Approximation Derivation for the formula: (polynomial of degree 2)

Sec: 8. 1 Discrete Least Squares Approximation Least Squares Use least-squares regression to fit

Sec: 8. 1 Discrete Least Squares Approximation Least Squares Use least-squares regression to fit a polynomial of degree 2 to For a minimum to occur, we need both Derivation for the formula: (polynomial of degree 2)

Sec: 8. 1 Discrete Least Squares Approximation Least Squares Use least-squares regression to fit

Sec: 8. 1 Discrete Least Squares Approximation Least Squares Use least-squares regression to fit a polynomial of degree 2 to For a minimum to occur, we need both

Sec: 8. 1 Discrete Least Squares Approximation Least Squares Use least-squares regression to fit

Sec: 8. 1 Discrete Least Squares Approximation Least Squares Use least-squares regression to fit a polynomial of degree 2 to For a minimum to occur, we need both

Sec: 8. 1 Discrete Least Squares Approximation Least Squares Use least-squares regression to fit

Sec: 8. 1 Discrete Least Squares Approximation Least Squares Use least-squares regression to fit a polynomial of degree 2 to For a minimum to occur, we need both normal equations in Matrix Form

Sec: 8. 1 Discrete Least Squares Approximation Least Squares Use least-squares regression to fit

Sec: 8. 1 Discrete Least Squares Approximation Least Squares Use least-squares regression to fit a poly of deg 2 to normal equations. Matrix Form

Sec: 8. 1 Discrete Least Squares Approximation Least Squares Use least-squares regression to fit

Sec: 8. 1 Discrete Least Squares Approximation Least Squares Use least-squares regression to fit a polynomial of degree n to For a minimum to occur, we need both normal equations in Matrix Form Number of data points Degree of polynomial

Sec: 8. 1 Discrete Least Squares Approximation

Sec: 8. 1 Discrete Least Squares Approximation