Re: Mean of Geometric and Negative Binomial distributions
- To: mathgroup at smc.vnet.net
- Subject: [mg24092] Re: [mg24066] Mean of Geometric and Negative Binomial distributions
- From: BobHanlon at aol.com
- Date: Fri, 23 Jun 2000 02:27:00 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 6/22/2000 1:18:29 AM, russell at cerc.columbia.edu writes: >Can anyone tell me why Mathematica returns (1-p)/p for >Mean[GeometricDistribution[p]] and n(1-p)/p for >Mean[NegativeBinomialDistribution[p]], when all sources I have to hand >(such >as CRC Standard Mathematical Formulae) give these as 1/p and n/p >respectively? > >The variance expressions agree with CRC, it's just the means that are >different. I don't have the CRC tables; however, Mathematica's results agree with Abramowitz and Stegun Needs["Statistics`DiscreteDistributions`"]; distr = GeometricDistribution[p]; PDF[distr, x] (1 - p)^n*p As stated in the on-line documentation, the geometric distribution GeometricDistribution[p] is the distribution of the total number of trials BEFORE the first success occurs,where the probability of success in each trial is p. Note that there are (n+1) trials: n failures BEFORE a success and the success. Consequently, the Domain of the distribution includes zero. Domain[distr] Range[0, Infinity] Verifying validity of the distribution Sum[PDF[distr, n], {n, 0, Infinity}] == 1 True Verifying the Mean Sum[n*PDF[distr, n], {n, 0, Infinity}] == Mean[distr] // Simplify True If, however, we look at the TOTAL number of trials, that is the failures plus the one success, then the distribution is p*(1-p)^(n-1) and Sum[p*(1 - p)^(n - 1), {n, 1, Infinity}] == 1 True Sum[n*p*(1 - p)^(n - 1), {n, 1, Infinity}] // Simplify 1/p I suspect that you are working with this second definition. As stated in the on-line documentation, the negative binomial distribution NegativeBinomialDistribution[n, p] is the distribution of the number of failures that occur in a sequence of trials before n successes have occurred,where the probability of success in each trial is p. distr = NegativeBinomialDistribution[n, p]; PDF[distr, m] (1 - p)^m*p^n*Binomial[m + n - 1, n - 1] Verifying validity of the distribution Sum[PDF[distr, x], {x, 0, Infinity}] == 1 True Verifying the Mean Sum[x*PDF[distr, x], {x, 0, Infinity}] == Mean[distr] // Simplify True Again, if the distribution you are dealing with is describing the TOTAL number of trials then Sum[(1 - p)^(m - n) * p^n * Binomial[m - 1, n - 1], {m, n, Infinity}] == 1 True Sum[m * (1 - p)^(m - n) * p^n * Binomial[m - 1, n - 1], {m, n, Infinity}] n/p In general, you need to verify that you are working with the same definitions. Bob Hanlon