Simple linear regression
Your data
Separate the two numbers with a space, a comma, a semicolon or a tab, whichever your spreadsheet pastes. Lines that make no sense are skipped.
Results
The line that fits those points
—
| How much y moves when x goes up by one | — |
| Where the line crosses the vertical axis | — |
| Share of the movement in y that the line accounts for | — |
| Correlation between the two | — |
| Points used | — |
Load the four sets in the box on the left, one after another, and watch the numbers instead of the picture. Every one of them gives the same averages, the same spread, the same correlation and the same line, agreeing to two decimal places all the way down.
Then watch the picture. The first is an ordinary cloud around a line. The second is a clean curve that a straight line has no business describing. The third is a perfect line with one point dragged far off it. The fourth has every x in the same place except one, and that single point decides the whole slope on its own.
Francis Anscombe built those four in nineteen seventy three to make exactly this point, and it has not aged: a summary is a summary, and the only way to know whether a line belongs on a set of points is to look at them.
One more thing the numbers will not tell you: a line through the points says nothing about one thing causing the other. It says the two moved together in this sample, which is a much smaller claim.
How is the line worked out?
By least squares: the line is the one that makes the total of the squared vertical gaps between the points and the line as small as it can be. The slope is the joint spread of x and y divided by the spread of x, and the line always passes through the average of both.
That gives a single answer for any set of points, which is convenient and also the trap: it gives one whether or not a line makes any sense there.
What does the coefficient of determination actually say?
It is the share of the up and down movement in y that the line accounts for. Two thirds means the line explains two thirds of the variation and something else explains the rest.
It says nothing about whether the shape is right. All four of the sets loaded from the box on the left land on the same two thirds, and only one of them is a set of points a straight line belongs on.
Why do the four example sets matter?
Because they have the same averages, the same spread, the same correlation and the same line, agreeing to two decimal places, and they look nothing alike. One is an ordinary cloud, one is a clean curve, one is a straight line with a single point dragged away, and one is a column of identical x values plus one lone point that decides the slope by itself.
Francis Anscombe built them in nineteen seventy three to show that summary numbers can agree while the data disagrees completely. Load them one after another and watch the picture change while the table does not.
Does a good fit mean one thing causes the other?
No. A line through the points says the two moved together in this sample, which is a much smaller claim than one causing the other.
Something else can drive both, the direction can run the other way, and with few points it can be luck. The arithmetic on this page cannot tell those apart and neither can any other.
Reactions
0
0 Comments
Be the first to comment