Linear Regression Calculator
Calculate linear regression using your data.
Loading calculator…
What this tool does
Calculate linear regression using your data. Least-squares fit of a straight line. It describes association in the entered pairs — it does not establish that X causes Y, and it is sensitive to outliers.
How to use the Linear Regression Calculator
- Enter or select x values (comma or whitespace separated).
- Enter or select y values (same order as x).
- Enter or select predict y at x =.
- Read the calculated result; change any measurement to compare alternatives.
Formula
least squares: slope b = Σ(x−x̄)(y−ȳ)/Σ(x−x̄)²; intercept a = ȳ − b·x̄; R² = r²
- x
- X values (comma or whitespace separated)
- y
- Y values (same order as X)
- x0
- Predict Y at X =
Least-squares fit of a straight line. It describes association in the entered pairs — it does not establish that X causes Y, and it is sensitive to outliers.
Worked example
For linear regression calculator, the following measurements illustrate the exact method: X values (comma or whitespace separated): 1,2,3,4,5; Y values (same order as X): 2,4,5,4,5; Predict Y at X =: 6.
Inputs
- X values (comma or whitespace separated)1,2,3,4,5
- Y values (same order as X)2,4,5,4,5
- Predict Y at X =6
Result
- Slope (b)0.6
- Intercept (a)2.2
- Correlation (r)0.77
- R²0.6
- Predicted Y at the entered X5.8
Results explained
- Slope (b)
- Slope (b) from the formula above. Least-squares fit of a straight line. It describes association in the entered pairs — it does not establish that X causes Y, and it is sensitive to outliers.
- Intercept (a)
- Intercept (a) from the formula above. Least-squares fit of a straight line. It describes association in the entered pairs — it does not establish that X causes Y, and it is sensitive to outliers.
- Correlation (r)
- Correlation (r) from the formula above. Least-squares fit of a straight line. It describes association in the entered pairs — it does not establish that X causes Y, and it is sensitive to outliers.
- R²
- R² from the formula above. Least-squares fit of a straight line. It describes association in the entered pairs — it does not establish that X causes Y, and it is sensitive to outliers.
- Predicted Y at the entered X
- Predicted Y at the entered X from the formula above. Least-squares fit of a straight line. It describes association in the entered pairs — it does not establish that X causes Y, and it is sensitive to outliers.
Frequently asked questions
least squares: slope b = Σ(x−x̄)(y−ȳ)/Σ(x−x̄)²; intercept a = ȳ − b·x̄; R² = r²
Least-squares fit of a straight line. It describes association in the entered pairs — it does not establish that X causes Y, and it is sensitive to outliers.
Enter numbers only, in the units and format each label describes. Remove missing values rather than substituting zero, unless zero is a real observation.
No. Results describe the numbers you entered. Statistical inference also depends on sampling design, independence, model fit and interpretation; a p-value is not the probability that a hypothesis is true.
No. Every calculation, including the distribution algorithms, runs entirely in your browser.