Since the most general definition of the coefficient of determination is also known as the Nash – Sutcliffe model efficiency coefficient, this last notation is preferred in many fields, because denoting a goodness-of-fit indicator that can vary from −∞ to 1 (i.e., it can yield negative values) with a squared letter is confusing. One class of such cases includes that of simple linear regression where r2 is used instead of R2. The creation of the coefficient of determination has been ascribed to the geneticist Sewall Wright and was first published in 1921.

COMING SOON!

```
ols<-function(y,x){
x<-as.matrix(x)
x<-cbind(intercept=1,x)
return(solve(t(x) %*% x) %*% t(x) %*% y)
}
ols(y=diamonds$price,x=diamonds %>% select(-price)) %>% print()
```