Re: Mean of Geometric and Negative Binomial distributions
- To: mathgroup at smc.vnet.net
- Subject: [mg24087] Re: [mg24066] Mean of Geometric and Negative Binomial distributions
- From: "Richard Finley" <rfinley at medicine.umsmed.edu>
- Date: Fri, 23 Jun 2000 02:26:55 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Gareth, With the geometric distribution it is because there is a BUG...with the negative binomial, it is a misunderstanding. Your reference formulae are correct. Clearly the problem with Mathematica's implementation of the Geometric Distribution is that they have neglected the fact that you cannot have a success if there are no trials (ie if n=0) but in their case PDF[GeometricDistribution[p],0] = p instead of DF[GeometricDistribution[p],1] = p. So since it is off by one you can get the correct mean by calculating Sum[ n PDF[GeometricDistribution[p], n-1], {n,1,Infinity}] which gives 1/p as it should. For the negative binomial distribution, there is no bug ...but only appears so in the sense that they calculate a nonstandard result....that is the mean of the total number of "failures" to get r successes rather than the number of "trials" to get r successes. You can see this by calculating the results yourself directly rather than using Mean.... "mean number of trials to get r successes".... Sum[ (n+r) PDF[NegativeBinomialDistribution[r,p], n] , {n,0,Infinity}] = r/p "mean number of failures before getting r successes".... Sum[ n PDF[NegativeBinomialDistribution[r,p], n], {n, 0, Infinity}] = r (1-p)/p (Note that I use r for the number of successes and n is the number of failures as opposed to the n in your post which is the number of successes). regards, RF >>> "Gareth J. Russell" <russell at cerc.columbia.edu> 06/21/00 11:01PM >>> Dear Group, 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. Thanks, Gareth ================================================== Dr. Gareth J. Russell NEW ADDRESS and E-MAIL FROM 1ST SEPTEMBER, 1999 Center for Environmental Research and Conservation MC 5556 Columbia University 1200 Amsterdam Avenue New York, NY 10027, U.S.A. Phone: ++1 212 854 5094 Fax: ++1 212 854 8188 E-mail: russell at cerc.columbia.edu WWW: http://web.utk.edu/~grussell (NO CHANGE) OLD ADDRESS (AND STILL MY EMPLOYERS) Department of Ecology and Evolutionary Biology University of Tennessee 569 Dabney Hall Knoxville, TN 37996-1610, USA ==================================================