Least squares fit to a straight line?

Click For Summary

Homework Help Overview

The discussion revolves around the computation of the least squares fit to a straight line, specifically focusing on fitting a line to a set of experimental data points represented as (xi, yi). Participants are exploring the mathematical formulation and implications of this fitting process.

Discussion Character

  • Mathematical reasoning, Problem interpretation

Approaches and Questions Raised

  • The original poster seeks clarification on how to compute the least squares fit. Another participant provides a detailed mathematical derivation involving partial derivatives and equations for the parameters a and b. The discussion also includes questions about plotting the resulting line and calculating additional parameters from the slope.

Discussion Status

Participants are actively engaging with the mathematical concepts and sharing insights. Some have successfully computed the parameters of the line, while others are exploring how to visualize the results and derive further information from the slope. There is a collaborative atmosphere with guidance being offered without reaching a final consensus.

Contextual Notes

Participants are working within the constraints of a homework assignment, which may limit the depth of exploration into the topic. There are indications of assumptions being questioned, particularly regarding the interpretation of the slope and its implications.

noname1
Messages
131
Reaction score
0
I was wondering if someone could explain how to compute the Least squares fit to a straight line
 
Physics news on Phys.org
You have N experimental points (xi,yi) and you want to fit a straight line y=ax+b across them so that the mean value of the square of the deviations y(xi)-yi is minimum with respect to the parameters a and b
.
[tex]S=\sum_1^N{(ax_i+b-y_i)^2} = minimum[/tex]

For that, the partial derivatives of S have to be zero. This condition yields two equations for a and b.

[tex]\partial S /\partial a=\sum_1^N{2(ax_i+b-y_i)x_i}=0[/tex]
[tex]\partial S /\partial b=\sum_1^N{2(ax_i+b-y_i)}=0[/tex]

Rearranging the equations:

[tex]a\sum_1^N{x_i^2}+b\sum_1^N{x_i}=\sum_1^N{x_i y_i}[/tex]

[tex]a\sum_1^N{x_i}+N b=\sum_1^N{y_i}[/tex]

Solve for a and b.

ehild
 
i have solved it and got this

y = 46.3x+(-61.8)

my question is now, i plotted my points on a table on paper but how do i make the straight line?
 
Just calculate two points of your equation, put them onto the plot and connect them with a straight line :)

ehild
 
how didnt i think of that duhhh lol, one more question now how do i calculate g from the slope?
 

Similar threads

  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 11 ·
Replies
11
Views
1K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
Replies
25
Views
3K
Replies
9
Views
2K