2
$\begingroup$

I have some Poisson data {${y_1,...,y_n}$} and a Gamma prior, and I wish to construct a predictive posterior distribution.

As I understand, if my Gamma hyperparameters are $\alpha$ (the prior number of occurrences) and $\beta$ (the prior number of observations), the predictive posterior is: ${y\space|\space y_1...y_n,\alpha,\beta}\space\tilde\space NegBin({\sum\limits_{i=1}^n y_i+\alpha}, \frac{1}{1+\beta+n})$

However, because of the multiple parametrizations of both Gamma and negative binomial, my attempts to actually implement this in R were so far futile.

Am I right that in the above formula $\alpha$ is shape and $\beta$ is rate in dgamma()? Am I right then that $\sum\limits_{i=1}^n y_i+\alpha$ is size in dnbinom()? And what is prob then? I thought it was $\frac{1}{1+\beta+n}$, but the resulting distribution doesn't seem to make sense.

$\endgroup$
1
  • $\begingroup$ Are you sure the posterior predictive is $NB(\sum_{i=1}^n y_i + \alpha, \frac{1}{n +\beta +1})$? I have just been watching the derivation at youtube.com/watch?v=iCxrimJzzDo In his notation he gets $NB(\sum_{i=1}^n y_i + \alpha, n +\beta)$ In your notation that's $NB(\sum_{i=1}^n y_i + \alpha, \frac{1}{n +\beta})$ $\endgroup$ Feb 23, 2018 at 16:59

1 Answer 1

2
$\begingroup$

For the 'NegBinomial' distribution in the R stats package ?NegBinomial, the parameter choice is different from the one appearing e.g. in Wikipedia. The R 'prob' parameter is $\text{prob} = 1 - p$ where $p$ is as in Wikipedia's notation and as in your notation. So in your case, use $\text{prob} = 1 - 1 / ( 1 + \beta + n)$ for the predictive distribution. The 'size' parameter is the same in the two notations, and your interpretation of it is good.

$\endgroup$
5
  • $\begingroup$ Great, it works, thanks very much! Is this because R parametrises this via the number of successes, while Wikipedia via the number of failures? $\endgroup$
    – a11msp
    Apr 6, 2014 at 10:19
  • $\begingroup$ Just to add that you probably meant ?NegBinomial, right? $\endgroup$
    – a11msp
    Apr 6, 2014 at 10:38
  • $\begingroup$ I've just realised that prob = 1-1/(1+$\beta$+n) is equivalent to mean $\mu$ = ($\alpha$+s)/($\beta$+n) [since prob=size/(size+$\mu$)], which makes perfect sense. $\endgroup$
    – a11msp
    Apr 6, 2014 at 10:54
  • $\begingroup$ I fixed the wrong Rhelp reference, thank you. Using the mean is appealing indeed, and noticing that 'beta' can be compared to a number of observations can be useful in choosing an informative prior. $\endgroup$
    – Yves
    Apr 6, 2014 at 11:25
  • $\begingroup$ And in fact R's NegBinomial functions can be parametrized with mu rather than prob. $\endgroup$
    – a11msp
    Apr 6, 2014 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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