Isn't there a mistake in the deviance of the Bernoulli distribution? The deviance should be ... log(y_i/mu_i) ... log((1-y_i) / (1 - mu_i))