R^2 = 1 - (SS_res / SS_tot)
Where:
- `SS_res` (Sum of Squares of Residuals) is the sum of the squared differences between the observed values and the predicted values from the model.
- `SS_tot` (Total Sum of Squares) is the sum of the squared differences between the observed values and their mean.
In formula terms:
SS_res = Σ (y_i - ŷ_i)²
SS_tot = Σ (y_i - ȳ)²
Where:
- `y_i` is an observed value.
- `ŷ_i` is a predicted value from the model.
- `ȳ` is the mean of the observed values.
By substituting these values into the formula, you calculate R-squared, which indicates how well the model explains the variability in the data.
No comments:
Post a Comment