Linear Regression Calculator
Linear Regression is evaluated from X Values, Y Values and Predict Y at x =. The calculation reports Slope, Y-Intercept and R^2.
Results
About the Linear Regression Calculator
The calculator uses a multi formula configuration. Each reported value is read as a direct evaluation of the stored rules with the declared field formats and units.
Formula basis:
m = (n x Sigmaxy - Sigmax x Sigmay) / (n x Sigmax^2 - (Sigmax)^2)
b = ȳ - m x x̄
ŷ = mx + b
Interpret the outputs in the order shown by the result fields. Optional inputs affect only the outputs that depend on those variables.
Formula & How It Works
The calculation applies the following relations exactly as recorded in the metadata: m = (n x Sigmaxy - Sigmax x Sigmay) / (n x Sigmax^2 - (Sigmax)^2) b = ȳ - m x x̄ ŷ = mx + b Each output field is produced by substituting the supplied inputs into the relevant relation and then applying the declared rounding or text format.
Worked Examples
Example 1: Hours Studied vs. Exam Score
Inputs
With X Values = 1, 2, 3, 4, 5, 6, 7, 8, Y Values = 50, 55, 60, 65, 70, 75, 80, 85 and Predict Y at x = = 9 as the stated inputs, the result is Slope = 5, Y-Intercept = 45 and R^2 = 1. Each value corresponds to the declared output fields.
Example 2: House Size vs. Price
Inputs
With X Values = 1000, 1200, 1400, 1600, 1800, 2000, 2200, Y Values = 180000, 210000, 235000, 260000, 290000, 315000, 345000 and Predict Y at x = = 2,500 as the stated inputs, the result is Slope = 135.714286, Y-Intercept = 45,000 and R^2 = 0.999308. Each value corresponds to the declared output fields.
Example 3: Ad Spend vs. Revenue
Inputs
With X Values = 500, 1000, 1500, 2000, 2500, 3000, Y Values = 5000, 9500, 13000, 17500, 21000, 26000 and Predict Y at x = = 3,500 as the stated inputs, the result is Slope = 8.228571, Y-Intercept = 933.333333 and R^2 = 0.997963. Each value corresponds to the declared output fields.
Example 4: Temperature vs. Ice Cream Sales
Inputs
With X Values = 65, 70, 75, 80, 85, 90, 95, Y Values = 120, 145, 170, 200, 235, 270, 310 and Predict Y at x = = 100 as the stated inputs, the result is Slope = 6.321429, Y-Intercept = -298.571429 and R^2 = 0.992178. Each value corresponds to the declared output fields.
Common Use Cases
- Find best-fit line through scatter plot data
- Predict sales based on advertising spend
- Model weight as function of height
- Forecast demand from historical data