# Linear Regression Calculator with Residuals

**Regression Line:** y = + x

**Correlation coefficient (r):**

### Residuals:

## Understanding Residuals in Linear Regression

A residual is the difference between an observed value and a predicted value from a regression model. It tells us how far the prediction is from the observed value. A residual is calculated as follows:

Residual = observed value - predicted value

Or mathematically:

\[ r_{i}= y_{i} - \hat{y_{i}} \]Where the regression line has the equation:

\[ \hat{y_{i}} = a + bx_{i} \]Therefore, the residual of an observation is:

\[ r_{i}= y_{i} - \hat{y_{i}} = y_{i} - (a + bx_{i}) \]The aim of least squares linear regression is to find the regression parameters that minimize the sum of square residuals.

This calculator finds the residuals of a linear regression analysis for the predictor and response values provided.

### Further Reading

Suf is a senior advisor in data science with deep expertise in Natural Language Processing, Complex Networks, and Anomaly Detection. Formerly a postdoctoral research fellow, he applied advanced physics techniques to tackle real-world, data-heavy industry challenges. Before that, he was a particle physicist at the ATLAS Experiment of the Large Hadron Collider. Now, he’s focused on bringing more fun and curiosity to the world of science and research online.