Least Squares Linear Regression Calculator

100% Client-Side Engine Instant Output

Simple Linear Regression Slope & Correlation Coefficient (r) Solver

Calculate best-fit linear regression slope (m), intercept (b), Pearson correlation coefficient (r), and coefficient of determination (R²).

Best-Fit Line (y = mx + b)

y = 2.01x - 0.03

Pearson Correlation (r) & R²

r = 0.999 (R² = 0.998)

Predictive Modeling: Ordinary Least Squares Regression

The Least Squares Linear Regression Calculator models linear bivariate trends ($y = mx + b$) across paired data points. Essential for economics econometrics, laboratory calibration, machine learning baselines, and trend forecasting.

Core Mathematical Relationships

Formulate optimal least-squares line parameters:

  • Slope Formulation: $m = \frac{n\sum xy - \sum x \sum y}{n\sum x^2 - (\sum x)^2} = r \frac{s_y}{s_x}$.
  • Y-Intercept: $b = \bar{y} - m \bar{x}$.
  • Pearson Correlation: $r = \frac{n\sum xy - \sum x \sum y}{\sqrt{[n\sum x^2 - (\sum x)^2][n\sum y^2 - (\sum y)^2]}}$.
  • Coefficient of Determination: $R^2 = r^2$.

How to Use the Calculator

  1. Enter paired (x, y) coordinates or paste spreadsheet columns.
  2. Click Compute Linear Regression to inspect slope $m$, intercept $b$, $r$, and $R^2$.
  3. Input test $x$ values to evaluate fitted prediction $y$ outcomes.

Frequently Asked Questions

A mathematical approach that finds the best-fitting straight line through data points by minimizing the sum of squared vertical residuals.

The coefficient of determination R-squared measures the proportion of total variance in the dependent variable y that is predictable from independent variable x.

Correlation r measures the strength and direction of linear association (-1 to +1), while slope m indicates the rate of change in y per unit change in x.

Yes, by plugging custom x values into the generated equation y = mx + b, you can forecast predicted y values.


Fast review — stays on this site

Chat with us on Messenger