ratio.

Find a tool

Browse all tools and categories ↗
STATISTICS

Linear Regression Calculator

Fit y=a+bx to 2–100 entered coordinate pairs. Inspect the regression equation, correlation, R², predictions, residuals and a scatter plot.

Enter your values

01 / INPUT
Calculated on your device

YOUR CALCULATION

Result

—

Calculation steps

Work through one step at a time or reveal the complete calculation. The steps use your current inputs.

    How to calculate

    Center x and y around their means. Divide the sum of centered cross-products by the centered x sum of squares for slope. Calculate intercept from the means and residuals from observed minus fitted y.

    b=Σ(x−x̄)(y−ȳ)/Σ(x−x̄)²; a=ȳ−bx̄; residual=y−ŷ; R²=1−SSE/SST

    Worked example

    For x=1,2,3,4,5 and y=2,4,5,4,5, the fitted line is y=2.2+0.6x. At x=6 it predicts 5.8. SSE is 2.4, Pearson r≈0.774596669 and R²=0.6.

    Assumptions and input details

    Enter separate equally sized lists of numbers, separated by spaces, commas or newlines; commas are not thousands separators. At least two x values must differ. Limits: 2–100 pairs, magnitude at most 1e12 per value. Constant y has a valid horizontal fitted line, but correlation and R² are undefined. Two points have no residual standard error estimate. The graph shows observed points without connecting them and the fitted line. Prediction outside the observed x range is labelled extrapolation; no confidence interval, causal claim or model-adequacy test is provided.

    References: OpenStax: correlation and linear regression

    Using this calculator

    Can I enter my own problem?

    Yes. Replace the example values with your own inputs. The result, calculation steps, tables and applicable diagrams update from those inputs. Blank or invalid values clear the result; example values are never silently substituted for missing inputs.

    Are the results exact?

    Results use floating-point arithmetic and displayed rounding. Read the formula, assumptions and any stated data precision before interpreting the result.

    Is my input uploaded?

    The calculation runs in your browser. No account, file upload or external AI service is required. Inputs are not saved between page reloads.

    RELATED TOOL · MATHEMATICSStatistics Calculator

    Enter a list of numbers to calculate mean, median, modes, quartiles, population and sample standard deviation, with a frequency histogram.

    RELATED TOOL · MATHEMATICSLinear Interpolation Calculator

    Enter two known points and a target x or y. Calculate the other coordinate, view the straight-line model and clearly distinguish interpolation from extrapolation.

    RELATED TOOL · STATISTICSNormal Distribution Calculator

    Calculate a normal probability below, above or between entered values. See standardized z scores, a probability breakdown and a bell curve with the selected region.

    ADVERTISEMENT

    Reserved advertising space.