## What is R-squared?

R-squared, also known as the coefficient of determination, is a statistical measure that represents the proportion of the variance of a dependent variable that can be explained by the independent variables in a regression model. R-squared ranges from 0 to 1, with higher values indicating a better fit of the model to the data. An R-squared value of 1 signifies that the model perfectly explains the variance in the dependent variable, while an R-squared value of 0 indicates that the model does not explain any of the variance.

## How to calculate R-squared?

R-squared can be calculated using the following formula:

```
R² = 1 - (SSR / SST)
```

Where:

- SSR (Sum of Squared Residuals) is the sum of the squared differences between the actual dependent variable values and the predicted values from the model.
- SST (Total Sum of Squares) is the sum of the squared differences between the actual dependent variable values and the mean value of the dependent variable.