Skip to content
Prev 385480 / 398506 Next

How to obtain individual log-likelihood value from glm?

Briefly, you shouldn't. One way of seeing it is if you switch the model to y~1, you still get logLik==0.

The root cause is the rounding in binomial()$aic:
function (y, n, mu, wt, dev) 
{
    m <- if (any(n > 1)) 
        n
    else wt
    -2 * sum(ifelse(m > 0, (wt/m), 0) * dbinom(round(m * y), 
        round(m), mu, log = TRUE))
}

which, if wt is small enough ends up calculating dbinom(0, 0, p, log=TRUE) which is zero. 

(Not rounding gives you NaN, because you're trying to fit a model with a non-integer number of observations.)

-pd