Collect the observed values and the predicted values
Compute the total sum of squares, SST = Σ(y – ȳ)²
Compute the residual sum of squares, SSE = Σ(y – ŷ)²
Calculate the coefficient of determination, R² = 1 – (SSE / SST)
Alternatively, calculate R² = SSR / SST, where SSR = Σ(ŷ – ȳ)²
Verify that R² is between 0 and 1 for standard linear regression with an intercept
