Linear Regression Calculator
Fit a straight line to x and y data with least squares and get the equation, slope, intercept, correlation coefficient r, R², standard error and p-value of the slope. Paste one x, y pair per line and optionally predict y for a new x.
Frequently asked questions
How do I enter data?
One pair per line, x first, separated by a comma, space, tab or semicolon. A header line at the top, such as x,y, is skipped. You can paste two columns from a spreadsheet.
What do r and R² mean?
r, the Pearson correlation coefficient, runs from -1 to 1 and measures how closely the points follow a straight line and in which direction. R² is its square: the share of the variation in y that the line explains.
What is the p-value?
The probability of seeing a slope at least this far from zero if x and y were unrelated, from a t-test with n - 2 degrees of freedom. Small values, such as below 0.05, suggest a real linear relationship.
What is the standard error?
The typical distance of the data points from the fitted line, in units of y.
How does prediction work?
Enter an x value and the tool returns the y the line predicts for it. Predictions far outside the range of your data are unreliable.
How many points can I enter?
Up to 10,000. You need at least two different x values, and three or more for the standard error and p-value.