Enter equal numbers of X and Y values to calculate the best fit line.
Linear regression is a statistical method used to model the relationship between a dependent variable (Y) and one independent variable (X) by fitting a linear equation to observed data. The goal is to find the line that best fits the data points.
y = mx + b Where: m = slope (rate of change) b = y-intercept (value of y when x = 0)
The slope and y-intercept are calculated using the least squares method:
Slope (m) = (n * sum(xy) - sum(x) * sum(y)) / (n * sum(x^2) - (sum(x))^2) Y-intercept (b) = (sum(y) - m * sum(x)) / n Or equivalently: b = y_mean - m * x_mean
For data points: (1, 2), (2, 4), (3, 5), (4, 4), (5, 5)
n = 5
sum(x) = 15, sum(y) = 20
sum(xy) = 66, sum(x^2) = 55
x_mean = 3, y_mean = 4
Slope (m) = (5*66 - 15*20) / (5*55 - 225)
= (330 - 300) / (275 - 225)
= 30 / 50 = 0.6
Y-intercept (b) = 4 - 0.6*3 = 4 - 1.8 = 2.2
Equation: y = 0.6x + 2.2
Prediction: When x = 6
y = 0.6(6) + 2.2 = 3.6 + 2.2 = 5.8
R-squared measures how well the regression line fits the data. Values range from 0 to 1, where 1 indicates a perfect fit.
Sales forecasting, demand prediction, cost analysis.
Analyzing experimental data, predicting outcomes.
Modeling economic relationships, trend analysis.
Calibration curves, performance prediction.