Linear Regression Calculator
Slope and intercept form calculator using least square fitting — find the best-fit line through any set of data points and predict values with the linear regression equation.
Slope and intercept form calculator using least square fitting
Find the best-fit line through any set of data points and predict values with the linear regression equation.
Formula
How to Use?
- Enter X and Y values as comma‑separated lists (e.g., 1,2,3 and 2,4,6).
- Optionally, provide an X value to predict the corresponding Y.
- The calculator will show the regression equation, slope, intercept, Pearson r, R², and predicted Y.
Worked Examples
Example: Linear fit for (1,2), (2,4), (3,6)
Least Squares Method
The line of best fit is calculated by minimizing the sum of squared residuals between observed and predicted values.
Interpreting R²
R² indicates how well the regression line fits the data. A value close to 1 means the model explains most of the variability.
Table: Example Linear Regression Data
| X | Y |
|---|---|
| 1 | 2.1 |
| 2 | 3.9 |
| 3 | 6.2 |
| 4 | 7.8 |
| 5 | 10.1 |
FAQs
What is linear regression?
A statistical method to model the relationship between a dependent variable and one or more independent variables using a linear equation.
What does R² tell me?
R² measures how well the regression line fits the data; higher values indicate a better fit.