Math problem: How do i find the slope of a best-fit-line (ie linear regression)?

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

BigJ

Lifer
Nov 18, 2001
21,330
1
81
Originally posted by: scott
Originally posted by: chuckywang
< words cut >
What? It's an essential question if he wants to solve this problem.
As you know, "best fit line" is a term of art in mathemagic land.

That is to say, it has a specially defined and very precise meaning.

His "best fit line" equation defines his entire situation exactly.

All he needs is to learn how to go about teasing the info he wants out of it.

He needs to create a best fit line, he doesn't have one already.

There are multiple regression techniques you can use for this. Or it could be as simple as placing a line through his first and last point.

It depends heavily on what his teacher wants in this situation. In physics, best fit line was connecting the first and last point. In statistics, I had to use bivariate regression.
 

cheezy321

Diamond Member
Dec 31, 2003
6,218
2
0
For statistics, we use the least squares regression

Or you could do rise over run like everyone else has said in here.

Or you could download minitab and try and do it.

Or you could download SAS and try and do it.

The programs cost money though.
 

WildHorse

Diamond Member
Jun 29, 2003
5,006
0
0
He needs to create a best fit line, he doesn't have one already.
From the OP I took it that he had his least squares line already fitted to his data.

Or it could be as simple as placing a line through his first and last point.
No that's invalid. FOr each point there's a probability distribution desribing where it may lie on either side of the overall trend line, and the endpoint(s) could very well be way out in the tails of the distribution, i.e. extreme cases atypical of the bulk of the data. abeal2, don't just draw a line between your two furthest points.

abeal2,
The way you fit a line to a scatterplot of data points in 2 dimensions (XY) is called "least squares". If your text doesn't explain how, then look in any stat book. It's very easy to do manually for a small number of points, but for a lot of points use a good calculator or computer. Easy as pie.

The resulting equation of the fittted line will directly tell you the slope that you seek. Y=mx+b, it's the m term.
Zest of life
 

BigJ

Lifer
Nov 18, 2001
21,330
1
81
Originally posted by: scott
He needs to create a best fit line, he doesn't have one already.
From the OP I took it that he had his least squares line already fitted to his data.

Or it could be as simple as placing a line through his first and last point.
No that's invalid. FOr each point there's a probability distribution desribing where it may lie on either side of the overall trend line, and the endpoint(s) could very well be way out in the tails of the distribution, i.e. extreme cases atypical of the bulk of the data. abeal2, don't just draw a line between your two furthest points.

abeal2,
The way you fit a line to a scatterplot of data points in 2 dimensions (XY) is called "least squares". If your text doesn't explain how, then look in any stat book. It's very easy to do manually for a small number of points, but for a lot of points use a good calculator or computer. Easy as pie.

The resulting equation of the fittted line will directly tell you the slope that you seek. Y=mx+b, it's the m term.
Zest of life

::Sigh::

Please tell me why, in the best case scenario, that there is no possible waythat the best fit line could be connecting the first and last point?

If for the most part, all the points except one already follow a linear equation, the best fit line is going to be a straight line between the first and last point.

Stop trying to sound like an elitist prick. Thanks for suggesting what everyone here already has in the least squares method.
 

WildHorse

Diamond Member
Jun 29, 2003
5,006
0
0
If for the most part, all the points except one already follow a linear equation, the best fit line is going to be a straight line between the first and last point.
Invalid. Dispersed data does not follow a linear equation.

You missed the whole point about the fact the location of each point on the fitted line is under a probability distribution. Please don't misinform, since you obviously know this basic stuff.
Stop trying to sound like an elitist prick.
Attitude expressed in crass unkind put down reflects on you, not me.
Thanks for suggesting what everyone here already has in the least squares method.
Actually I'm advanced in stat, use it in my work, and took 7 courses back in school, several in grad school. The OP was asking for help at the most basic level, and the purpose of this thread is to give HIM help at HIS level, so that it's useful to HIM.
Zest for life !