ToolCabana
Language preview: no interface translation is available for this language yet. Showing English. Use English

Linear regression calculator

Fit paired data and show residuals and correlation.

Favorites are saved in this browser. Find them in My favorites.

Linear regression calculator

Your input stays in this browser unless stated otherwise
Clear your input, files and result, and restore the default settings.
Load sample text to explore what this tool can do. This replaces your current input.
0 charactersClear the source text.

How to use Linear regression calculator

The Linear regression calculator fits a least-squares line to x,y pairs entered one per line and returns the slope, intercept, Pearson correlation and R². A residual table lists each observed y, the predicted y from the fitted line and the difference between them. At least 3 pairs are required, and up to 500 lines are accepted.

  1. Paste the source into the input editor, or load the built-in example.
  2. Check the source format before running the operation.
  3. Run linear regression calculator, review the output, then use the available copy or download controls.

What this tool supports

Fit paired data and show residuals and correlation.

Limits and processing

Local bounded calculations. Numeric inputs must be finite and within the visible ranges. Lists and tables have operation-specific limits. Models, estimates and supplied rates must be checked against your intended use.

Example source
1,2
2,4
3,5
4,8

Frequently asked questions

How are the slope and intercept calculated?

The calculator uses ordinary least squares. The slope is the sum of (x − mean x)(y − mean y) divided by the sum of (x − mean x)², and the intercept is mean y − slope × mean x, so the line is y = intercept + slope × x.

What do correlation and R² tell me?

Correlation r ranges from −1 to 1 and shows the direction and strength of the linear relationship. R² is r squared and gives the share of variation in y explained by the line. Both are reported as undefined when every y value is the same.

Why does the regression calculator say x values need variation?

If every x value is identical, the line's slope cannot be determined because the denominator becomes zero. Enter pairs with at least two different x values, and use a comma between x and y on each line.

Where is my input processed?

This operation processes its source in your browser. Copy and download are explicit actions; source input is not saved in an account or history.

What are the input limits?

Local bounded calculations. Numeric inputs must be finite and within the visible ranges. Lists and tables have operation-specific limits. Models, estimates and supplied rates must be checked against your intended use.