STATISTICAL REGRESSION

Linear Regression Calculator

Fit a straight line to paired X and Y observations using ordinary least squares. Inspect the equation, graph, R-squared, RMSE and residuals before exporting your results.

Least squaresBrowser-basedNo sign-in

YOUR DATA

Enter paired observations

Paste or upload two or more numeric columns. Use a comma, tab or semicolon between columns and a period as the decimal mark. The first non-empty line is treated as a header by default. The tool accepts up to 5,000 observations.

The file is read locally by your browser; it is not sent to this website.

One observation per line; X and Y must be numeric.

How to use this calculator

  1. Paste paired X and Y values, or load the sample data.
  2. Choose which columns represent X and Y. The tool reports invalid rows instead of silently dropping them.
  3. Calculate the line, then review its equation, plot, R², RMSE and residuals.
  4. Download the result summary as JSON for your own notes.

Formula and calculation method

The calculator fits ŷ = a + bx using ordinary least squares, where b = Σ((x − x̄)(y − ȳ)) / Σ((x − x̄)²) and a = ȳ − bx̄. It then calculates R² as 1 − SSE/SST and RMSE as the square root of SSE divided by the number of observations.

R² describes fit to these observations. It does not prove that X causes Y or that the model will predict new data accurately.

Assumptions and limitations

Worked example

Use the example button to load study hours and exam scores. The plotted observations and fitted line let you see how the calculator turns paired data into a trend. Your own input remains in the page only while it is open; it is not saved to an account.

Return to all tool areas