Sum of squared deviations formula