How to use this calculator
Enter your values in the fields above and click Calculate to see your results instantly. All calculations run in your browser — no data is sent to a server and results appear immediately. Click Clear to reset all fields and start over.
Understanding your inputs
Each input field is labeled with the specific value it expects. Hover over the ? hint icons (where present) for additional guidance on what each field means and what units to use. For best results, double-check that all your input values use consistent units before calculating.
Interpreting the results
Results are shown immediately after clicking Calculate. The highlighted result card shows the primary output — the value most people need. Additional cards show supporting calculations that provide context and help you verify the primary result makes sense. If results seem unexpected, re-check your inputs for typos or unit mismatches.
About this statistical calculator
This calculator implements standard statistical formulas used by professionals and students alike. The underlying math has been verified against reference implementations and textbook examples. For critical applications, always cross-reference results with authoritative sources or a qualified professional.
What Simple Linear Regression Measures
Simple linear regression fits a straight line, y = a + bx, through a set of paired (x, y) observations so that the sum of squared vertical distances between the line and the actual data points is as small as possible — the "least squares" criterion. It answers two related questions: how strongly two variables move together (via the correlation coefficient r and R²), and, if the relationship looks linear, what value of y to expect for a new x (the prediction). It's the right tool when you have one independent variable and one dependent variable, both numeric, and you suspect a roughly straight-line relationship — for example, hours studied vs. exam score, advertising spend vs. units sold, or temperature vs. energy usage.
This calculator fits a single predictor (bivariate regression). If you came here expecting to enter several independent variables at once — say, predicting sales from both price and advertising spend simultaneously — that's multiple regression, which requires matrix algebra (or software such as Python's statsmodels, R, or a spreadsheet's Data Analysis ToolPak) rather than the closed-form formulas below. You can still use this tool to check each predictor's individual relationship with the outcome one at a time before building a multi-variable model.
The Formulas Behind the Results
For n paired points (x, y), the calculator computes slope b = (nΣxy − ΣxΣy) / (nΣx² − (Σx)²) and intercept a = (Σy − bΣx) / n. The correlation coefficient r and the coefficient of determination R² = 1 − SSE/SST describe fit quality, where SSE is the sum of squared residuals (actual − predicted) and SST is the total sum of squared deviations from the mean of y. The standard error of the estimate is √(SSE/(n−2)), and the slope's own standard error is that value divided by √(Σ(x−x̄)²); dividing the slope by its standard error gives the t-statistic used to test whether the true slope differs from zero.
Worked Example
Enter x = 1, 2, 3, 4, 5 and y = 3, 5, 6, 8, 9. By hand: Σx = 15, Σy = 31, Σxy = 108, Σx² = 55, n = 5. Slope b = (5×108 − 15×31) / (5×55 − 15²) = (540 − 465) / (275 − 225) = 75 / 50 = 1.5. Intercept a = (31 − 1.5×15) / 5 = 8.5 / 5 = 1.7, so the fitted line is y = 1.7 + 1.5x. The residuals give SSE = 0.30 and SST = 22.8, so R² = 1 − 0.30/22.8 ≈ 0.9868 and r ≈ 0.9934. The standard error of the estimate is √(0.30/3) ≈ 0.3162, the slope's standard error is 0.3162/√10 = 0.1, and the t-statistic is 1.5/0.1 = 15.0 with 3 degrees of freedom — comfortably significant. Entering 6 in the prediction field returns 1.7 + 1.5×6 = 10.7. Plug these numbers into the calculator above to confirm you get the same values.
Common Mistakes When Interpreting Regression Output
- Treating a high R² as proof of causation — a strong linear association can come from a shared underlying cause, coincidence, or a third confounding variable.
- Predicting far outside the range of x-values you fit (extrapolation). The line's behavior beyond your observed data isn't validated by the fit.
- Reporting the slope without checking R² — a "statistically significant" slope (large |t|) can still leave most of the variation in y unexplained if R² is low.
- Fitting a straight line to data that's visibly curved; check a scatter plot first, since R² alone won't reveal non-linearity.
Frequently Asked Questions
What does R² actually tell me about my regression line?
How do I use the t-statistic reported for the slope?
Can this calculator handle multiple independent variables (multiple regression)?
How many data points do I need for a reliable regression?
Related calculators: Correlation Coefficient (Pearson r), Standard Deviation Calculator, Confidence Interval Calculator, and Z-Score Calculator.