MathCalcLab
Language

Linear Regression

Perform linear regression analysis with correlation and prediction

Format: Enter x,y pairs (one per line)

Example: 1, 2 or 1 2 (comma or space separated)

Results

Enter values and click Calculate to see the result.

Linear Regression

Linear regression finds the best-fitting straight line through a set of data points using the least-squares method.

  • Slope (m): The slope of the regression line; how much y changes per unit change in x.
  • Intercept (b): The y-value where the line crosses the y-axis (when x = 0).
  • : Coefficient of determination; the proportion of variance in y explained by x (0 to 1).
  • Correlation (r): Pearson correlation coefficient measuring strength and direction of the linear relationship (−1 to +1).

The regression line is the straight line that minimizes the sum of squared vertical distances from the data points.

\(y = mx + b, m = \frac{n\sum xy - \sum x \sum y}{n\sum x^2 - (\sum x)^2}, b = \bar{y} - m\bar{x}\)

Worked Examples

Example 1

\(\text{Points: } (1,2), (2,4), (3,5), (4,4), (5,5) \rightarrow y = 0.6x + 2.2, R^2 = 0.64\)

Example 2

\(\text{Study hours vs test scores} \rightarrow \text{Find relationship and predict outcomes}\)
Linear Regression | MathCalcLab | MathCalcLab