x-axis= 0.3, 0.31, 0.28, 0.32, 0.34, 0.29, 0.33, 0.26, 0.3, 0.27, 0.27 y-axis = 0.17, 0.19, 0.21, 0.22, 0.28, 0.26, 0.32, 0.17, 0.19, 0.19, 0.17 what is the equation of the least squares best fit line?
@amoodarya @BulletWithButterflyWings @CGGURUMANJUNATH @djcool31 @electrokid @Falco276 @grant330sims @Hero
@ash2326
the question asks for a "linear least square fit" i.e., find the equation of a straight line that fits the data with a least squared error. 1. let the equation of the straight line be \(y=ax+b\) where a and b are arbitrary contacts to find. 2. each of the given (x,y) points should ideally lie on this line \[\begin{align} 0.17&=a(0.3)+b& 0.19&=a(0.31)+b&0.21&=a(0.28)+b&\cdots \end{align}\] 3. but there is an error in fitting the points on the line \[\begin{align} \delta_1&=0.17-(0.3a+b)\\ \delta_2&=0.19-(0.31a+b)\\ \delta_3&=0.21-(0.28a+b)\\ &\vdots \end{align}\] 4. For a least-square fit, the square of these errors should be minimized i.e, \[\begin{align}\Delta(a,b)&=\delta_1^2+\delta_2^2+\delta_3^2+\cdots\\ \Delta(a,b)&=(0.17-0.3a-b)^2+(0.19-0.31a-b)^2+(0.21-0.28a-b)^2+\cdots \end{align}\] 5. you can use the partial derivatives with respect to "a" and "b", set them to zer and solve the two equations to get "a" and "b" values. NOTE: use the following only if asked and is for your verification. It so happens that for a straight line fit, the formulae for "a" and "b" can be expressed as: \[\begin{align} a&=\frac{\sum y\times \sum x^2-\sum x\times \sum xy}{n\sum x^2-\left(\sum x\right)^2}\\ b&=\frac{\sum n\times \sum xy-\sum x\times \sum y}{n\sum x^2-\left(\sum x\right)^2} \end{align}\]
correction in the last equation\[b=\frac{\color{red}{n\times \sum xy}-\sum x\times \sum y}{n\sum x^2-\left(\sum x\right)^2}\]
Join our real-time social learning platform and learn together with your friends!