Coefficient of Determination
The coefficient of determination of a linear regression model is the quotient of the variances of the fitted values and observed values of the dependent variable. If we denote yi as the observed values of the dependent variable, as its mean, and as the fitted value, then the coefficient of determination is:
Problem
Find the coefficient of determination for the simple linear regression model of the data set faithful.
Solution
We apply the lm function to a formula that describes the variable eruptions by the variable waiting, and save the linear regression model in a new variable eruption.lm.
Then we extract the coefficient of determination from the r.squared attribute of its summary.
Answer
The coefficient of determination of the simple linear regression model for the data set faithful is 0.81146.
Note
Further detail of the r.squared attribute can be found in the R documentation.