Least Squares Line Calculator
Paste your X and Y data points to find the best-fit line that minimizes the squared residuals.
Result
How to use
- Enter your values in the fields above.
- Press Calculate to see your result instantly.
- Use the Share button to copy a link to your result.
About this calculator
Ordinary least squares fits the straight line through a set of X-Y data points that minimizes the sum of the squared vertical distances (residuals) between each point and the line — the reason it's called 'least squares.' The slope and intercept have closed-form solutions (slope = Σ(x−x̄)(y−ȳ) ÷ Σ(x−x̄)², intercept = ȳ − slope×x̄), and the correlation coefficient r indicates how well the line actually captures the relationship in the data, from -1 (perfect negative) to +1 (perfect positive).
This calculator takes pasted X and Y data pairs and returns the fitted line's equation, slope, intercept, and correlation coefficient. Statistics and science students learning regression, researchers doing a quick trend analysis, and analysts checking a correlation before committing to a full statistical model use it as a fast way to quantify a linear relationship in a data set without opening a spreadsheet or stats package.
Was this helpful?
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
No calculators found
Comments (0)