TeX source:
R^2 = \frac{\sum_i (\hat{y_i}-\mu_y)^2}{\sum_i (y_i-\mu_y)^2} = 1 - \frac{\mathrm{SS}_{\mathrm{res}}}{\mathrm{SS}_{\mathrm{tot}}}