Linear Regression Calculator

Enter your X (predictor) and Y (response) data points to compute a linear regression model. This calculator finds the slope (b1), intercept (b0), and R² value, giving you the line-of-best-fit equation Ŷ = b0 + b1·X. You also get the correlation coefficient (r) and standard error so you can judge model fit at a glance.

Label for your predictor (independent) variable

Label for your response (dependent) variable

Enter each X,Y pair on a new line separated by a comma or tab. Example: 1, 3

Optional: enter an X value to predict the corresponding Y

Results

Regression Equation

--

Slope (b1)

--

Intercept (b0)

--

R² (Coefficient of Determination)

--

Correlation Coefficient (r)

--

Standard Error of Estimate

--

Number of Data Points (n)

--

Predicted Y Value

--

Scatter Plot with Regression Line

Results Table

Frequently Asked Questions

What is a linear regression model?

A linear regression model describes the relationship between a predictor variable (X) and a response variable (Y) using a straight line: Ŷ = b0 + b1·X. The slope (b1) indicates how much Y changes for each one-unit increase in X, and the intercept (b0) is the predicted Y when X equals zero. It is one of the most widely used statistical techniques because it both explains relationships and enables prediction.

What do the slope and intercept tell me?

The slope (b1) quantifies the direction and magnitude of the relationship — a positive slope means Y increases as X increases, while a negative slope means the opposite. The intercept (b0) is the baseline value of Y when X is zero. Together they define the unique line that best fits your data.

What is R² and what does it mean?

R² (the coefficient of determination) measures the proportion of variance in Y that is explained by X, ranging from 0 to 1. An R² of 0.85, for example, means 85% of the variation in Y is accounted for by the linear relationship with X. Higher R² values indicate a better-fitting model, though context matters — some fields accept 0.5 as strong while others require 0.95+.

What are the assumptions of linear regression?

Simple linear regression assumes: (1) a linear relationship between X and Y, (2) independence of observations, (3) homoscedasticity — residuals have constant variance across all X values, (4) normally distributed residuals, and (5) no significant outliers. Violating these assumptions can lead to unreliable estimates and predictions.

How is the regression line calculated?

The line is fit using the Ordinary Least Squares (OLS) method, which minimises the sum of squared residuals (the vertical distances between each data point and the line). The slope is calculated as b1 = Σ[(Xi − X̄)(Yi − Ȳ)] / Σ[(Xi − X̄)²], and the intercept as b0 = Ȳ − b1·X̄, where X̄ and Ȳ are the sample means.

What is the standard error of the estimate?

The standard error of the estimate (SEE) measures the average distance that observed Y values fall from the regression line. A smaller SEE indicates that the model predictions are more precise. It is calculated as the square root of the mean squared residuals: √[Σ(Yi − Ŷi)² / (n − 2)].

What is the difference between correlation and regression?

Correlation (r) measures the strength and direction of the linear association between two variables but does not imply causation or provide a predictive equation. Regression goes further by fitting a line that can be used to predict Y from X. R² in regression is simply the square of the Pearson correlation coefficient r in simple linear regression.

How many data points do I need for linear regression?

You need a minimum of 3 data points for the calculation to work, but reliable estimates generally require at least 10–20 observations. More data points reduce sampling error, improve the stability of the slope and intercept estimates, and increase the statistical power to detect a true linear relationship.

More Statistics Tools