Sum of Squared Error
sum_squares(x, y = x)
x | numeric vector |
---|---|
y | optional, numeric vector, same length as |
either the sum of squared errors for x
(if y
is left out),
or the cross-product of two vectors x
with y
The sum of squared errors for a length \(n\) vector \(x\) will equal
$$S_{xx} = \sum_i^n(x - \overline{x})^2,$$
where \(\overline{x}\) is the mean of \(x\).
The cross-product is
$$S_{xy} = \sum_i^n (x - \overline{x})(y - \overline{y})$$
#> [1] 6.209723#> [1] 3.532127