Calculator Inputs
Example Data Table
This sample shows advertising spend and sales response for a simple linear model.
| Point | X: Ad Spend | Y: Sales |
|---|---|---|
| 1 | 1 | 2 |
| 2 | 2 | 4 |
| 3 | 3 | 5 |
| 4 | 4 | 4 |
| 5 | 5 | 5 |
| 6 | 6 | 7 |
Formula Used
Slope: b = Σ[(x - x̄)(y - ȳ)] / Σ[(x - x̄)²]
Intercept: a = ȳ - b x̄
Regression line: ŷ = a + bx
Coefficient of determination: R² = 1 - SSE / SST
Residual sum of squares: SSE = Σ(y - ŷ)²
Root mean square error: RMSE = √(SSE / (n - 2))
Least squares regression finds the line that minimizes squared residuals. The slope measures change in Y for each unit of X. The intercept anchors the fitted line. R² estimates explained variation, while RMSE summarizes average model error in original Y units.
How to Use This Calculator
- Enter the X values in the first field.
- Enter matching Y values in the second field.
- Add a future or target X value for prediction.
- Choose a confidence level and decimal precision.
- Optionally force the line through the origin.
- Press Calculate Regression to display the report above the form.
- Review diagnostics, fitted values, and residual behavior.
- Export the computed report as CSV or PDF.
Frequently Asked Questions
1. What does least squares regression measure?
It estimates the straight line that best fits paired numeric data by minimizing the sum of squared residuals. This helps quantify direction, strength, and prediction behavior.
2. When should I force the model through the origin?
Use that option only when theory requires Y to be zero whenever X is zero. Otherwise, allowing an intercept usually gives a more reliable fit.
3. What is the difference between r and R²?
r is the correlation coefficient and shows direction plus linear strength. R² is the explained variance fraction and describes overall fit quality.
4. What does RMSE tell me?
RMSE summarizes typical prediction error in the same units as Y. Lower values generally indicate tighter fits, assuming the data scale stays comparable.
5. Can I use commas or new lines?
Yes. The calculator accepts commas, spaces, semicolons, and line breaks. It automatically parses them into numeric lists for both variables.
6. Why do my results show an error?
Errors usually happen when X and Y counts differ, values are nonnumeric, or X has no variation. Each case prevents a valid line fit.
7. Are prediction intervals the same as confidence intervals?
No. Confidence intervals estimate the mean response at a chosen X. Prediction intervals are wider because they include both model uncertainty and individual observation noise.
8. Is this calculator useful for quick forecasting?
Yes, for simple linear patterns. It works well for quick trend checks, sensitivity reviews, and baseline forecasts when one variable explains another approximately linearly.