Calculadora de Regressão Linear (5 pontos)
- Created by
- Renato Passos, Eng. de Software
- Reviewed by
- Renato Passos, Eng. de Software
Last updated: Apr 18, 2026
Formula
a = Σ(x−x̄)(y−ȳ)/Σ(x−x̄)² ; b = ȳ − a·x̄
About this calculator
This linear regression calculator for 5 points determines the line that best fits the provided data, following the model y = a·x + b. Using the least squares method, it automatically calculates the slope (a) and intercept (b). You need to enter five pairs of coordinates (x, y) representing the observed points. The result is the equation of the line that minimizes the sum of squared vertical distances between the points and the line.
The operation is simple: you input the x and y values for each of the five points. The calculator then computes the means of x and y, the deviations from those means, and applies the formulas: a = Σ(x−x̄)(y−ȳ)/Σ(x−x̄)² and b = ȳ − a·x̄. The coefficient a represents the slope, while b is the y-intercept. The result displays the full equation and the values of a and b.
This tool is useful in situations where you want to model a linear relationship between two variables, such as predicting sales based on advertising spending, estimating fuel consumption as a function of speed, or analyzing the relationship between study hours and grades. It is especially handy for students, teachers, and professionals who need a quick analysis without resorting to complex software.
Important precautions: verify that your data actually follow a linear pattern before using regression. Outliers can significantly distort results. Also, remember that correlation does not imply causation. For larger datasets, consider using more robust tools that provide confidence intervals and residual diagnostics.
Frequently asked questions
What does the slope a mean?
The slope a indicates the steepness of the line: for each one-unit increase in x, y changes by a units. If a is positive, y increases with x; if negative, y decreases.
How do I interpret the intercept b?
The intercept b is the value of y when x is zero. It represents the point where the line crosses the y-axis.
Can I use this calculator with more than 5 points?
No, this version is limited to exactly 5 points. For more points, look for a generic linear regression calculator.
What if the points do not appear to follow a straight line?
If the pattern is not linear, linear regression may not be appropriate. Consider transforming the data or using polynomial regression.
What formula is used to calculate a and b?
We use the least squares method: a = Σ(x−x̄)(y−ȳ)/Σ(x−x̄)² and b = ȳ − a·x̄, where x̄ and ȳ are the means of x and y.