Linear Regression Calculator
Type in your X and Y values and get the line of best fit in one click. You will see each step too, so you can follow along.
Type the same count of X and Y values. The first X goes with the first Y, and so on.
Step by step working
| X | Y | X times Y | X squared |
|---|
What is linear regression?
Linear regression finds a straight line that fits your points best. You give it pairs of X and Y values, and it works out the line that sits closest to all of them. The line is written as y equals m x plus b.
The slope, m, tells you how steep the line is. The intercept, b, tells you where the line crosses the Y axis. Together they let you guess Y for any X.
What does the correlation r tell you?
The letter r tells you how close your points sit to the line. An r near 1 means the points sit close to a line that goes up. An r near minus 1 means they sit close to a line that goes down.
An r near 0 means the points do not follow a straight line. It does not mean there is no link at all. It only means a straight line is not a good fit.
How to use this calculator
- Type your X values in the first box and your Y values in the second box. Commas, spaces or new lines all work.
- Press Calculate. You get the slope, the intercept, the line, and the full working, step by step.
- Press Copy results if you want to paste the answers into your homework or notes.
Worked example
The mean of X is 3 and the mean of Y is 4.
The slope is 0.6 and the intercept is 2.2.
So the line is y = 0.6x + 2.2. The correlation r is 0.7746, so the points sit fairly close to the line.
Frequently asked questions
What is linear regression in simple words?
It is a way to draw the best straight line through a set of points. You give the calculator pairs of numbers, and it finds the line that sits closest to them. The line helps you see the trend and guess new values.
What is the slope?
The slope tells you how steep the line is. A slope of 0.6 means Y goes up by 0.6 when X goes up by 1. A minus slope means the line goes down as X grows.
What is the intercept?
The intercept is where the line crosses the Y axis. It is the value of Y when X is 0. It tells you where the line starts on the left side of the graph.
What is a good value for r?
An r close to 1 or close to minus 1 is strong. An r near 0 is weak, and the line is not a good fit. How good is good enough depends on your class and your data.
Is this calculator free?
Yes, it is free. There is no sign up and no limit. Use it as many times as you like.
More statistics calculators
Need a different tool? Try one of these.
