Add calculation of R^2 code