7
$\begingroup$

I have a small question, given this:

fit <- vglm(cbind(R, N-R) ~ 1, betabinomial, lirat, trace=TRUE, subset=(N > 1))

Why should I do cbind(R, N-R)? Can someone explain this simple step to me? If I leave out that part, I get an error saying that I can only fit 0, 1. But in the example here, $Y$ can contain a lot of different values.

$\endgroup$
1
  • 2
    $\begingroup$ Although the question explicitly asks about R code, the real issue is understanding the nature of the beta binomial distribution--ie, a statistical issue. The issue & the answer would be the same for any software. This should be on topic here, IMO. $\endgroup$ Commented Jul 16, 2015 at 19:08

1 Answer 1

5
$\begingroup$

The binomial distribution is the distribution of the number of 'successes' out of a known, finite number of 'trials' (e.g., heads on a certain number of coin flips). With a fixed probability of success, $\pi$, and a fixed number of trials, $n$, the variance of the number of successes is fixed as well. A typical logistic regression scenario has Bernoulli data (a single coin flip) as its response, but when you have binomial data with $n>1$ per observation, you can find that the response data vary more than they ought to. In that case, the assumptions of a binomial GLiM will be violated.

The beta binomial distribution relaxes that assumption. It contains three parameters, $n, \alpha, \& \beta$, which gives it additional flexibility to address the overdispersion in the situation described above. The important point here, though, is that the overdispersion / greater variance can only exist with data that are counts of successes out of $n>1$ trials. Thus, R (or any other software) needs the data to be in that form to fit the model. SAS, for example, uses events/trials; R uses cbind(successes, failures), which is equivalent. (For what it's worth, in the documentation page you link to, I see only cbind(successes, failures) in the examples listed.)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.