measure_r_squared function

Estimate R-squared