Confused on Linear Least Square Fits very basic.

In summary, the conversation discusses how to carry out a linear least squares fit to determine the slope and y-intercept of a set of data points. Various methods are suggested, with the most direct being to minimize the total square error between the calculated values and the true values. Ultimately, it is concluded that for the given data, the line y= x+ 5 would be the best fit.
  • #1
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
  • #2
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?
 
  • #3
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 [itex](m+ b- 6)^2[/itex]. Similarly, for x= 2 the "calculated value" would be y= 2m+ b while the true value is 7. The "square error" is [itex](2m+b- 7)^2[/itex]. Repeating that for all given values, the "total square error" would be [itex](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.

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.
 

FAQ: Confused on Linear Least Square Fits very basic.

1) What is a linear least square fit?

A linear least square fit is a statistical method used to determine the best-fit line for a set of data points. It involves finding the line that minimizes the sum of the squared distances between the data points and the line.

2) How is a linear least square fit different from other regression methods?

A linear least square fit is specifically used for linear models, where the relationship between the independent and dependent variables is assumed to be linear. Other regression methods, such as polynomial regression, allow for non-linear relationships between variables.

3) What is the purpose of a linear least square fit?

The purpose of a linear least square fit is to find the best-fit line that represents the relationship between two variables in a dataset. This line can then be used to make predictions and analyze the strength of the relationship between the variables.

4) How is the best-fit line determined in a linear least square fit?

The best-fit line is determined by minimizing the sum of the squared distances between the data points and the line. This is done using mathematical calculations and algorithms, such as the method of least squares.

5) What are the limitations of a linear least square fit?

One limitation of a linear least square fit is that it assumes a linear relationship between variables, which may not always be the case. It also does not take into account the influence of outliers in the dataset. Additionally, it may not be suitable for datasets with a small number of data points.

Back
Top