Independent practice tool · free · runs in your browser

Linear Regression Calculator

Enter paired x and y values to fit the least-squares line y = a·x + b. You get the slope, intercept, correlation r, R², a residual table and a scatter plot with the fitted line. The tool keeps each x with its y, rejects lists of different lengths and warns when a prediction is outside the data range.

Fit a line y = a·x + b

Row k of x pairs with row k of y. Values are never sorted separately. Separate with commas, spaces or new lines.

    How to use it

    1. Type the x values and the y values in the same order, one pair per position.
    2. Press Fit line.
    3. Check the residual table: residuals scattered around 0 with no pattern support a straight-line model.
    4. Enter an x-value to predict y; the tool flags extrapolation outside your data.

    Worked example

    Three points (1, 3), (2, 5) and (3, 7) with the least-squares line y = 2x + 1 and R² = 1.
    Every value in this figure was produced by the same code that runs the tool above and is checked by automated tests.

    How it calculates

    The fit uses centered sums Sxx, Sxy and Syy for numerical stability: slope = Sxy/Sxx and intercept = ȳ − slope·x̄. r = Sxy/√(Sxx·Syy) and R² = r². When every x is the same, the slope is undefined and no line is reported. When every y is the same, the line is horizontal and r and R² are reported as undefined rather than invented.

    Limits

    • Straight-line (linear) fits only; no quadratic, exponential or power regression.
    • R² measures fit to these points, not cause and effect or forecast accuracy.
    • With two points the line always fits exactly; the tool says so.
    • Not a TI-84: there is no LinReg command, RESID list or DiagnosticOn setting.

    Doing this on a TI-84

    On a TI-84 you use lists L1 and L2, a Scatter Stat Plot and STAT ▸ CALC ▸ LinReg(ax+b), with diagnostics on for r and r². This page does not imitate those menus; the guides below give the verified key sequences.

    Questions

    What is the difference between r and R²?

    r (from −1 to 1) gives the direction and strength of a linear relationship. R² (from 0 to 1) is the proportion of the variation in y explained by the line; for simple linear regression it equals r².

    Why is r undefined?

    If all y-values are equal there is no variation to explain, so r = Sxy/√(Sxx·Syy) is 0/0.

    Can I trust a prediction far outside my data?

    Not automatically. The tool flags these extrapolations because the relationship may change outside the observed range.

    TI84 Calculator Guide is independently operated and is not affiliated with, sponsored by or endorsed by Texas Instruments. TI-84 Plus, TI-84 Plus CE and related names are used only to describe the calculators our guides cover.

    TI-84 lessons for the same task

    Three points (1, 3), (2, 5) and (3, 7) with the fitted line y = 2x + 1 passing through all of them.
    Statistics

    Scatter Plots and Linear Regression on a TI-84

    Plot paired data, fit a least-squares line with LinReg(ax+b), turn on r and r², store the equation in Y1, and read residuals before trusting a prediction.

    2 min readTI-84 Plus (TI guidebook)
    A two-column list editor with L1 = 1, 2, 3 and L2 = 3, 5, 7, each row highlighted as one (x, y) pair.
    Statistics

    Enter and Edit Statistical Lists on a TI-84

    Use the list editor to enter, correct, insert and clear data in L1–L6 without resetting memory, and keep x and y values paired row by row.

    3 min readTI-84 Plus (TI guidebook)