Skip to content
Prev 725 / 885 Next

Calculation with R

Might be clearer if some variables are created first::

values <- data[, 1]
ok <- data[, 2] == 1
sum( (values[ok] - 7)^2 )

On the other hand if you prefer obsfucation replace the last line with:

deviance(lm(values-7 ~ 0, subset = ok))
On Thu, Jul 21, 2016 at 11:27 AM, Tim Appelhans <tim.appelhans at gmail.com> wrote: