Home Statistics Linear Regression Calculator

Linear Regression Calculator

Fit the straight line that best follows your data, then use it to predict a value.

Advertisement

How it works

Paste your two lists of numbers, separated by commas or spaces, with the same count in both. Then enter the X value you want to predict. The page shows the slope, the starting point of the line, how well the line fits, the prediction and the number of pairs.

Advertisement

Formula

slope = sum of (x - mean x)(y - mean y) / sum of (x - mean x)^2
intercept = mean y - slope x mean x
R squared = 1 - sum of squared gaps / total squared gaps

Sources

Example

X value to predict: 6. Slope: 0.75

Frequently asked questions

How do I read the slope?

It is how much the Y value changes when X goes up by one. A slope of 0.75 means each extra unit of X adds 0.75 to the predicted Y.

What is a good R squared?

Near one means the line follows the points closely, near zero means it explains little. With 1 to 5 and 2.2, 2.8, 3.6, 4.5, 5.1 the line is 1.39 + 0.75x, R squared is 0.9952, and at x = 6 it predicts 5.89.

Advertisement

Related calculators

Percent Error Calculator

How far a measured value is from the true value, as a percent.

Mean, Median, Mode and Range Calculator

Type a list of numbers and get the mean, median, mode, range, sum, smallest and largest.

Standard Deviation Calculator

Sample and population standard deviation and variance for a list of numbers.

Z-Score Calculator

How many standard deviations a value is from the mean, with the share of values below and above it.