course Mth 272 8/1 6:15 pm 031. `query
.............................................
Given Solution: `a The text gives you equations related to the sum of the x terms, sum of y values, sum of x^2, sum of y^2 etc, into which you can plug the given information. To use partial derivatives and get the same results. The strategy is to assume that the equation is y = a x + b and write an expression for the sum of the squared errors, then minimize this expression with respect to a and b, which are treated as variables. If y = a x + b then the errors at the four points are respectively | (a * 1 + b) - 0 |, | (a * 2 + b) - 0 |, | (a * 3 + b) - 0 |, | (a * 3 + b) - 1 |, | (a * 4 + b) - 1 |, | (a * 4 + b) - 2 |, | (a * 5 + b) - 2 |, and | (a * 6 + b) - 2 |. The sum of the squared errors is therefore sum of squared errors: ( (a * 1 + b) - 0 )^2+( (a * 2 + b) - 0 )^2+( (a * 3 + b) - 0 )^2+( (a * 3 + b) - 1 )^2+( (a * 4 + b) - 1 )^2+( (a * 4 + b) - 2 )^2+( (a * 5 + b) - 2 )^2+( (a * 6 + b) - 2 )^2. It is straightforward if a little tedious to simplify this expression, but after simplifying all terms, squaring and then collecting like terms we get 116?^2 + 2??28? - 37) + 8?^2 - 16? + 14. We minimize this expression by finding the derivatives with respect to a and b: The derivatives of this expression with respect to a and b are respectively 56? + 16? - 16 and 232? + 56? - 74. Setting both derivatives equal to zero we get the system 56? + 16? - 16 = 0 232? + 56? - 74 = 0. Solving this system for a and b we get a = 1/2, b = - 3/4. So see that this is a minimum we have to evaluate the expression f_aa * f_bb - 4 f_ab^2. f_aa = 56 and f_bb = 56, while f_ab = 0 so f_aa * f_bb - 4 f_ab^2 is positive, telling us we have a minimum. Thus our equation is y = a x + b or y = 1/2 x - 3/4. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& Self-critique (if necessary): ------------------------------------------------ Self-critique Rating: ********************************************* Question: `qQuery problem 7.7.6 (was 7.7.16) use partial derivatives,etc., to find least-squares line for (-3,0), (-1,1), (1,1), (3,2) YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY Your solution: To find the least-squares line for the given points, we could work out the problem by setting up an equation of sums, taking the derivative of that line in regard to a and b, and then solving for a and b by setting the derivatives equal to 0. However, we can also use the formula given in the book. We find that a = (4(0-1+1+6) -4(-3-1+1+3)(0+1+1+2))/(4(9+1+9+1) ?(-3-1+1+3)), which simplifies to 24/80 or .3. For b = ?(0+1+1+2) ?.3(-3-1+1+3)) = ?4-0) = 1. So we can write our line in the format of f(x) = ax +b, so our line is F(x) = .3x +1. confidence rating: 3 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.............................................
Given Solution: `a If y = a x + b then the errors at the four points are respectively | (a * -3 + b) - 0 |, | (a * -1 + b) - 1 |, | (a * 1 + b) - 1 | and | (a * 3 + b) - 2 |. The sum of the squared errors is therefore ( (a * -3 + b) - 0 )^2 + ( (a * -1 + b) - 1 )^2 + ( (a * 1 + b) - 1 )^2 + ( (a * 3 + b) - 2 )^2 = [ 9 a^2 - 6 ab + b^2 ] + [ (a^2 - 2 a b + b^2) - 2 ( -a + b) + 1 ] + [ a^2 + 2 ab + b^2 - 2 ( a + b) + 1 ] + [ 9 a^2 + 6 ab + b^2 - 4 ( 3a + b) + 4 ] = 20?^2 - 12? + 4?^2 - 8? + 6. This expression is to be minimized with respect to variables a and b. The derivative with respect to a is 40 a - 12 and the derivative with respect to b is 8 b - 8. 40 a - 12 = 0 if a = 12/40 = .3. 8b - 8 = 0 if b = 1. The second derivatives with respect to and and b are both positive; the derivative with respect to a then b is zero. So the test for max, min or saddle point yields a max or min, and since both derivatives are positive the critical point gives a min. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& Self-critique (if necessary): ------------------------------------------------ Self-critique Rating: ********************************************* Question: What was your expression for the sum of the squared errors? YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY Your solution: To find the Sum of squared errors, we need to use the formula given in the book. So the sum is equal to S = (-.9-0)^2 + (-.3-1)^2 + (.3-1)^2 + (.9-2)^2 = .2. confidence rating: 3 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.............................................
Given Solution: `a Right, for the values of a and b you correctly obtained above. The expression for squared errors is 20?^2 - 12? + 4?^2 - 8? + 6. For a = .3 and b = 1 this expression gives 1.8 - 3.6 + 4 - 8 + 6 = .2. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& Self-critique (if necessary):