# Re: two queries on distribution

Sat, 10 Jan 1998 14:28:33 +1030

> 1) Why does the Gamma distribution only have 1 parameter (the
> shape parameter) in Splus, when the usual Gamma is a two
> parameter distribution?

Because one of the parameters in the usual form is a scale
parameter and you can incorporate it by multiplying by a suitable
quantity.

(There is a curious inconsistency here. By the same reasoning
only the standard normal distribution needs to be provided since
the mean and standard deviation are merely location and scale
parameters, an yet the pnorm function allows you to specify both.)

> 2) I'm really confused about the Negative binomial:
>
> - Venables & Ripley provided a function rnegbin that takes two
> parameters: the mean and the shape parameter.
>
> - Splus 4 has a function for the negative binomial called rnbinom
> that takes two parameters (size, and probability). What is the
> relationship between the two? can I use the new rnbinom like I
> use the rnegbin - to generate overdisperesed poisson data (by
> specifying the shape parameter)?

The function rnbinom has parameters size and prob.
The function rnegbin has parameters theta and mu.

The relationship between them and its inverse are:

theta = size size = theta
mu = size * prob/(1 - prob) prob = mu/(theta + mu)

So, why did V&R bother with a new function? Two reasons

1. rnbinom only works for integer values of size.

2. If you are using the negative binomial as a modelling
distribution, (as opposed to `the number of failures before
the nth success in Bernoulli trials' kind of distribution),
then we regard the parameters theta (often called k) and the
mean, mu, as more natural than size and prob.

You can, of course, use rnbinom to generate data overdispersed
relative to the Poisson, but you will have to put up with the
very unnatural restriction of integer values for size.

(Obligatory quibble with the world: The now standard phrase
`overdispersed poisson data' does not make a lot of sense.)

```--
Bill Venables, Head, Dept of Statistics,    Tel.: +61 8 8303 5418
University of Adelaide,                     Fax.: +61 8 8303 3696