R-Squared
Study guides: Exam MAS-I, FIE-M1
R-Squared, R^2, also called the coefficient of determination, is the proportion of the total variation in the response that a regression explains. It is
R^2 = 1 - \frac{\text{RSS}}{\text{TSS}}
\text{RSS}is the residual sum of squares, the variation the model leaves unexplained.\text{TSS} = \sum (y_i - \bar{y})^2is the total sum of squares.
For a least squares fit with an intercept, R^2 lies between 0 and 1. In simple linear regression it equals r^2, the square of the sample correlation between x and y. R^2 is one summary over the whole data set, so it says nothing about how well the model fits in any part of the data.
A regression of claim severity on vehicle age has
\text = 10000and\text = 3500. What isR^2?
R^2 = 1 - 3{,}500/10{,}000 = 0.65.- Vehicle age explains 65% of the variation in claim severity.
Adjusted R-squared
R^2 never decreases when a predictor is added, even an irrelevant one, and it reaches 1 when the number of coefficients equals the number of observations. Adjusted R^2 divides each sum of squares by its degrees of freedom, so it penalizes the number of predictors p:
R^2_{\text{adj}} = 1 - \frac{\text{RSS}/(n - p - 1)}{\text{TSS}/(n - 1)}
nis the number of observations.
In terms of R^2, the same quantity is
R^2_{\text{adj}} = 1 - (1 - R^2)\,\frac{n - 1}{n - p - 1}
Adjusted R^2 penalizes only the predictors in the final model, not the search over all the candidates, so after selecting from many candidates it is still optimistic.
A regression with 5 predictors and an intercept, fitted to 50 observations, has
R^2 = 0.65. What is the adjustedR^2?
- The residual degrees of freedom are
n - p - 1 = 50 - 5 - 1 = 44.R^2_{\text{adj}} = 1 - 0.35(49/44), which is0.6102.
The F statistic in terms of R-squared
The overall F statistic of a regression with an intercept depends on the sums of squares only through \text{RSS}/\text{TSS}. Dividing its numerator and denominator by TSS gives
F = \frac{R^2/p}{(1 - R^2)/(n - p - 1)}
So F can be found from R^2, n and p alone, and solving for R^2 gives R^2 = pF/(pF + n - p - 1).
Software reports "F-statistic: 20 on 4 and 45 DF" for a regression with an intercept. What is
R^2?
- The numerator degrees of freedom give
p = 4, and the denominator degrees of freedom given - p - 1 = 45.R^2 = \frac{4(20)}{4(20) + 45} = \frac{80}{125} = 0.64.
Deviance R-squared of a generalized linear model
For a generalized linear model, the analogue of R^2 is based on the deviance:
R^2_D = 1 - \frac{D}{D_0}
Dis the deviance of the fitted model andD_0is the deviance of the model with only an intercept.
A Poisson model has deviance 120, and the intercept-only model has deviance 400. What is the deviance
R^2?
R^2_D = 1 - 120/400 = 0.70.
Comparing models of different sizes by R-squared Because
R^2never decreases as predictors are added, the larger of two models always has at least the sameR^2, and a smaller RSS. UseR^2only to compare models with the same number of parameters. Compare models of different sizes with adjustedR^2, AIC, BIC or cross-validation.
Practice questions
- CAS Exam MAS-I Fall 2018, Question 30
- CAS Exam MAS-I Fall 2018, Question 32
- CAS Exam MAS-I Fall 2018, Question 34
- CAS Exam MAS-I Spring 2018, Question 32
- CAS Exam MAS-I Spring 2018, Question 33
- CAS Exam MAS-I Spring 2019, Question 30
- CAS Exam MAS-I Spring 2019, Question 39
- Exam MAS-I Practice Question 108
- Exam MAS-I Practice Question 140
- Exam MAS-I Practice Question 141
- SOA Exam SRM Sample Question 18
- SOA Exam SRM Sample Question 24