Confused on Linear Least Square Fits very basic.

AI Thread Summary
To perform a linear least squares fit on the provided x and y values, define the line as y = mx + b, where m is the slope and b is the y-intercept. Calculate the squared errors for each data point by comparing the predicted values from the line to the actual y values. The total squared error is the sum of these squared differences for all points. To find the best-fitting line, minimize this total squared error by taking partial derivatives with respect to m and b and setting them to zero. In this specific case, the line y = x + 5 perfectly fits the data points.
bobbo7410
36
0
Quite confused. I've read the book/online definitions yet I suppose I may need a simpler explanation.

Lets say I have a table of x y values.

x 1 2 3 4 5
y 6 7 8 9 10

how would I carry out the linear least squares fit of the data to determine the slope and y-intercept?
 
Mathematics news on Phys.org
How about you tell us a definition that you've seen (or give us a link to it), and tell us where you get stuck in trying to apply it?
 
As jtbell says, there are a number of equivalent ways to do that. Not necessarily the simplest, but the most direct is this: Let the line be y= mx+ b where "m" is the slope and "b" is the y-intercept. For x= 1, the "calculated value" would be y= m+ h while the true value is 6. The "square error" is (m+ b- 6)^2. Similarly, for x= 2 the "calculated value" would be y= 2m+ b while the true value is 7. The "square error" is (2m+b- 7)^2. Repeating that for all given values, the "total square error" would be (m+ b- 6)^2+ (2m+ b- 7)^2+ (3m+ b- 8)^2+ (4m+ b- 9)^2+ (5m+ b- 10)^2[/math]. To minimize that, take the partial derivatives with respect to m and b and set them equal to 0.<br /> <br /> Of course, for this particular example, it is obvious that the line y= x+ 5 goes exactly through every point so that is what you would get.
 
Thread 'Video on imaginary numbers and some queries'
Hi, I was watching the following video. I found some points confusing. Could you please help me to understand the gaps? Thanks, in advance! Question 1: Around 4:22, the video says the following. So for those mathematicians, negative numbers didn't exist. You could subtract, that is find the difference between two positive quantities, but you couldn't have a negative answer or negative coefficients. Mathematicians were so averse to negative numbers that there was no single quadratic...
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Thread 'Unit Circle Double Angle Derivations'
Here I made a terrible mistake of assuming this to be an equilateral triangle and set 2sinx=1 => x=pi/6. Although this did derive the double angle formulas it also led into a terrible mess trying to find all the combinations of sides. I must have been tired and just assumed 6x=180 and 2sinx=1. By that time, I was so mindset that I nearly scolded a person for even saying 90-x. I wonder if this is a case of biased observation that seeks to dis credit me like Jesus of Nazareth since in reality...

Similar threads

Back
Top