IP331.com | Online Tools
HomeStatistics ToolsLinear Regression Calculator

Linear Regression Calculator

Find Line of Best Fit with Step-by-Step Derivation

Enter X values (comma-separated)
Enter Y values (comma-separated)

Linear Regression Formula

ŷ = b₀ + b₁x
b₁ = Σ[(xᵢ - x̄)(yᵢ - ȳ)] / Σ(xᵢ - x̄)²
b₀ = ȳ - b₁x̄
R² = [Σ((xᵢ-x̄)(yᵢ-ȳ))²] / [Σ(xᵢ-x̄)² × Σ(yᵢ-ȳ)²]

Linear regression models the relationship between independent variable X and dependent variable Y.

Both datasets must have the same number of values. Outliers can significantly affect regression results.

What is Linear Regression?

Linear regression is a statistical method to model the relationship between a dependent variable (Y) and one or more independent variables (X). The goal is to find the line that minimizes the sum of squared differences between observed and predicted values.

Slope (b₁)

Measures the change in Y for a one-unit change in X. Positive slope means Y increases as X increases.

Intercept (b₀)

The predicted value of Y when X equals 0. May not have practical meaning if X=0 is outside the data range.

R-squared

Proportion of variance in Y explained by X. Ranges from 0 to 1.

Predicted Value

ŷ = b₀ + b₁x: estimated Y value for a given X using the regression line.

💡 Example: X=[1,2,3,4,5], Y=[2,4,5,4,5]. x̄=3, ȳ=4. b₁=0.6, b₀=2.2. Equation: ŷ = 2.2 + 0.6x.

Applications

Statistics Data Science Finance Economics Engineering

Frequently Asked Questions

What is linear regression?
Linear regression finds the best fitting straight line through data points using least squares method. Equation: ŷ = b₀ + b₁x, where b₀ is intercept and b₁ is slope.
What is least squares method?
Least squares minimizes the sum of squared differences between observed y values and predicted ŷ values. This gives the "best fit" line statistically.
How to interpret regression coefficients?
Slope (b₁): change in y per unit change in x. Intercept (b₀): predicted y when x=0. R²: proportion of variance explained by the model.
What is R-squared?
R² (coefficient of determination) ranges 0-1. 1 means perfect prediction, 0 means no predictive power. R² = r² where r is Pearson correlation.

More Statistics Tools

Free online calculators and tools covering mathematics, unit conversion, text processing, and daily life. Accurate, fast, mobile-friendly, and completely free to use.

© 2026 IP331.com — Free Online Tools. All rights reserved.

About · Contact · Privacy Policy · Cookie Policy · Terms of Use · Disclaimer · Sitemap