Statistics calculator

Linear Regression Calculator

Fit a simple linear model with one predictor X and one response Y, then inspect its equation, r, and R².

Enter values

Enter values and select Calculate.

Formula and methodology

The least-squares line is ŷ = a + bx, where b = Σ[(xᵢ−x̄)(yᵢ−ȳ)] / Σ[(xᵢ−x̄)²] and a = ȳ − bx̄. Centered online sums reduce avoidable cancellation.

Worked example

For X = 1, 2, 3 and Y = 2, 4, 6, slope = 2, intercept = 0, r = 1, and R² = 1.

Assumptions and interpretation

  • Datasets and results stay in this browser and are not sent to analytics.
  • This educational tool performs mathematical computation; it does not establish causation, choose a study design, or validate scientific conclusions.
  • Check assumptions, sampling methods, and context before interpreting an inferential result.
  • Keep full precision for decisions; displayed values are rounded for readability.