# Linear regression calculator

> Fit paired data and show residuals and correlation.

[Open tool](https://www.toolcabana.com/ms/linear-regression-calculator) · [Statistics and analysis](https://www.toolcabana.com/ms/category/statistics-and-analysis)

Tool ID: linear-regression-calculator. Requested language: ms. Description language: en. Complete guide translation: no; untranslated sections use English.

## Overview (en)

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.

## Supported tasks (en)

Fit paired data and show residuals and correlation.

## Steps (en)

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.

## Settings

No additional settings.

## Limitations (en)

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 input

```text
1,2
2,4
3,5
4,8
```

## Privacy and connections (en)

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

## Questions (en)

### 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.

## Related tools

- [Descriptive statistics calculator](https://www.toolcabana.com/ms/descriptive-statistics-calculator)
- [Confidence interval calculator](https://www.toolcabana.com/ms/confidence-interval-calculator)
- [Sample size calculator](https://www.toolcabana.com/ms/sample-size-calculator)
- [Probability distribution explorer](https://www.toolcabana.com/ms/probability-distribution-explorer)
