Linear Regression Calculator

Enter X and Y pairs, set your options, then press Calculate to fit Y = b0 + b1X — coefficients, R², an F-test, effect size, and confidence/prediction intervals for every row.

Use the tabs below to move between the calculator, the charts, the significance tests, predictions for new X values, and a full step-by-step walkthrough with R code. Nothing leaves your browser.

Linear regression fits the straight line Ŷ = b0 + b1X that sits as close as possible to your data points. b1 (the slope) tells you how much Test Score changes for every 1-unit increase in Study Time; b0 (the intercept) is where the line crosses X = 0.

Once you Calculate, the tabs above fill in: Charts shows the fitted line and how well it matches; Tests answers "is this relationship real, or could it be chance?"; Predictions lets you estimate new Y values with a margin of error; Learn walks through every formula by hand, with your own numbers.

Data

Type your own values directly into the table — click a column name to rename it, use "+ Add row" for more data, and leave a row's Test Score cell empty to get a prediction for that Study Time once you calculate. Nothing recalculates automatically — edit as much as you like, then press Calculate below. Your table is saved automatically in this browser so it's still here next time you reload.

#
1
2
3
4
5
6
7
8
9
10
11

Fill in your data above and press Calculate to see results — then use the tabs above for charts, tests, predictions and the walkthrough.

How this calculator works

The calculator fits the line Ŷ = b0 + b1X by ordinary least squares, minimizing the sum of squared residuals between the actual and predicted Y values. The slope's standard error, t-statistic, and p-value test whether X has a real linear relationship with Y; the F-test does the same at the level of the whole model, which for one predictor gives the same p-value as the slope's t-test.

The confidence interval at each X is a range for the true average of Y at that X; the prediction interval is wider because it also accounts for the spread of individual observations around that average. Nothing is calculated until you press Calculate.

Common questions