Least squares fit to a straight line?

AI Thread Summary
To compute the least squares fit to a straight line, the goal is to minimize the sum of the squared deviations between the observed values and the values predicted by the line. This involves taking the partial derivatives of the sum of squared deviations with respect to the slope (a) and intercept (b), setting them to zero, and solving the resulting equations. The equations yield the relationships necessary to find the values of a and b based on the given data points. After determining the line's equation, it can be plotted by calculating two points and connecting them. Additionally, there is a query about calculating a specific value (g) from the slope, indicating further exploration of the relationship between slope and other variables.
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
.
S=\sum_1^N{(ax_i+b-y_i)^2} = minimum

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

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

Rearranging the equations:

a\sum_1^N{x_i^2}+b\sum_1^N{x_i}=\sum_1^N{x_i y_i}

a\sum_1^N{x_i}+N b=\sum_1^N{y_i}

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?
 
Thread 'Collision of a bullet on a rod-string system: query'
In this question, I have a question. I am NOT trying to solve it, but it is just a conceptual question. Consider the point on the rod, which connects the string and the rod. My question: just before and after the collision, is ANGULAR momentum CONSERVED about this point? Lets call the point which connects the string and rod as P. Why am I asking this? : it is clear from the scenario that the point of concern, which connects the string and the rod, moves in a circular path due to the string...
Back
Top