E_loo function in loo package, type = "var"

Oops. It’s no computing what we originally intended. It’s not just the r_eff part (which by default has no effect as by default it’s 1), but the sum(w^2 * r) part is clearly from the variance for the mean part. .wvar should return

(sum(.wmean(x^2, w))-sum(.wmean(x, w)^2))/(1-1/length(w))

Which would match base R var() in case of equal weights.

We could also add support for type="sd" which would be just a square root of that.

@charlesm93 thanks for reporting this