Coefficient of Determination
The coefficient ofdetermination of a linear regression model is thequotient of the variances of the fitted values and observedvalues of the dependent variable. If we denote yi as theobserved values of the dependent variable, as itsmean, and as thefitted value, then the coefficient of determination is:
Problem
Find the coefficient of determination for thesimple linear regression model of the data set faithful.
Solution
We apply the lmfunction to a formula that describes the variable eruptions by the variable waiting, and save the linear regression model ina new variable eruption.lm.
>eruption.lm=lm(eruptions~waiting,data=faithful)Then we extract thecoefficient of determination from the r.squared attribute of its summary.
>summary(eruption.lm)$r.squared[1]0.81146只要改动括号里的模型名称,你就可以得到任意一个简单线性回归模型的决定系数。
Answer
The coefficient ofdetermination of the simple linear regression model for the dataset faithful is 0.81146.