# [R] how to use R for Beta Negative Binomial

Nasser Abbasi nma at 12000.org
Sun Jan 6 15:36:56 CET 2008

```I think I should have posted this question here as well. I am posting my
question here since it is R related. Please see below. I originally posted
this to sci.stat.math

"Nasser Abbasi" <nma at 12000.org> wrote in message
news:Mm4gj.28843\$R92.4987 at newsfe16.phx...
>
> I think R documentation is a bit hard for me to sort out at this time.
>
> I was wondering if someone who knows R better than I do could please let
> me know the command syntax to find the mean of Beta Negative Binomial
> Distribution for the following parameters:
>
> n=3
> alpha=0.5
> beta=3
>
> Here is the documenation page for R which mentions this distribution
>
> http://rweb.stat.umn.edu/R/library/SuppDists/html/ghyper.html
>
> Using Mathematica, I get  (-18) for the mean and -150 for the variance,
> and wanted to verify this with R, since there is a negative sign which is
> confusing me.
>
> Mathematica says the formula for the mean is   n*beta/(alpha-1)  and that
> is why the negative sign comes up.
> alpha, beta, n can be any positive real numbers.
>
> If someone can just show me the R command for this, that will help, I have
> the R package SuppDists installed, I am just not sure how to use it for
> this distribution.
>
> thanks,
> Nasser
>

I thought I should show what I did, this is R 2.6.1:

tghyper(a=-1, k=-1, N=5)   %I think this makes it do Beta Negative Binomail

and now I used summary command, right?

sghyper(3, .5, 3)

But I do not think this is correct.Tried few other permitations. Hard for me
to see how to set the parameters correctly for this distribution.

thanks,
Nasser

```