Multiple Coefficient of Determination
The coefficient of determination of a multiple 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:
Find the coefficient of determination for the multiple linear regression model of the data set stackloss.
We apply the lm function to a formula that describes the variable stack.loss by the variables Air.Flow, Water.Temp and Acid.Conc. And we save the linear regression model in a new variable stackloss.lm.
Then we extract the coefficient of determination from the r.squared attribute of its summary.
The coefficient of determination of the multiple linear regression model for the data set stackloss is 0.91358.
Further detail of the r.squared attribute can be found in the R documentation.