Regression Calculator
Perform linear regression analysis with slope, intercept, and R-squared.
By Konstantin Iakovlev · Updated April 2026 · Source: Khan Academy
R-Squared
0.9985
Predicted Y
11.89
Regression Results
| Slope | 1.9700 |
| Intercept | 0.0700 |
| Equation | y = 1.97x + 0.07 |
| r | 0.9992 |
| R-Squared | 0.9985 |
Use the Regression Calculator above to calculate your results. Enter your values and see instant results — all calculations run in your browser.
Disclaimer: This calculator is for informational purposes only and does not constitute tax, financial, or legal advice. Results are estimates based on the information you provide and current rates. Always consult a qualified tax professional or financial advisor for advice specific to your situation.
How It Works
Linear regression turns a scatter of paired observations into a single line you can use to forecast and compare. Feed in your data points and the calculator returns the fitted equation along with the statistics that tell you how trustworthy it is. Whether you are weighing marketing spend against sales or tracking how interest rates move alongside loan defaults, that relationship is the kind of signal businesses lean on as they sharpen decisions heading into 2026.
The fit comes from the least squares method, which positions the line so the sum of the squared vertical distances between the points and the line is as small as possible. From that, the slope (b) is computed as Cov(x,y) / Var(x) and the intercept (a) as mean(y) - b * mean(x). The R-squared (R²) value then reports the share of variation in the dependent variable that the independent variable accounts for.
A handful of outliers can drag the line and inflate or deflate R² out of proportion to the bulk of your data, so it pays to inspect extreme points before trusting the output. Watch the interpretation, too: a strong R² confirms that two variables move together, not that one drives the other. Small or narrow datasets compound the problem, so the more observations and the wider their range, the more dependable the line becomes.
Example: Predicting 2026 Q3 Sales Based on Q2 Marketing Spend
- 1 Input Q2 2026 marketing spend (X) and corresponding sales (Y) for the past 5 quarters: (50000, 1200000), (65000, 1450000), (70000, 1550000), (55000, 1300000), (80000, 1700000).
- 2 The calculator processes these data points to find the linear relationship: Slope (b) = 17.5, Intercept (a) = 325000, R-squared (R²) = 0.96.
- 3 Assuming a Q2 2026 marketing spend of $75,000, the predicted sales (Y) would be: Y = 325000 + 17.5 * 75000.
- 4 The predicted sales for Q3 2026, based on a $75,000 marketing spend in Q2 2026, are $1,637,500. The high R² of 0.96 suggests this prediction is quite reliable within the observed data range.
Source: Khan Academy · Last updated: April 2026
Frequently Asked Questions
What does R-squared mean in regression?
What is the difference between correlation and regression?
When should I use linear regression?
You might also need
Percentage Calculator
Calculate percentages three ways: what is X% of Y, X is what % of Y, and percentage change from X to Y.
Fraction Calculator
Add, subtract, multiply, and divide fractions. Results shown as fraction, mixed number, and decimal.
Standard Deviation Calculator
Calculate mean, variance, and standard deviation (population and sample) from a data set.