In base R if I have a vector of probabilities p, I can calculate the deviance as
-2 * sum(p * log(p) + (1-p) * log(1-p))
How would you write that in magrittr pipes?
In base R if I have a vector of probabilities p, I can calculate the deviance as
-2 * sum(p * log(p) + (1-p) * log(1-p))
How would you write that in magrittr pipes?