Re: TransformedDistribution, for a sum of M iid variables

*To*: mathgroup at smc.vnet.net*Subject*: [mg120457] Re: TransformedDistribution, for a sum of M iid variables*From*: Bill Rowe <readnews at sbcglobal.net>*Date*: Sat, 23 Jul 2011 19:53:55 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com

On 7/22/11 at 3:42 AM, paulvonhippel at yahoo.com (Paul von Hippel) wrote: >Thanks for the neat proof. Sorry I wasn't clear about my goals. I >want to include a sum of iid variables in a TransfornedDistribution, >and then calculate the Mean and Variance of the distribution. >The iid variables need not be normal, and the TrasformedDistribution >will contain other variables besides the iid sum. While it is possible to do this using TransformedDistribution, I think it is far easier to to what you want with the various generating functions built into Mathematica. Use the exponential distribution as an example. For the exponential distribution: In[2]:= mg = CumulantGeneratingFunction[ExponentialDistribution[a], t] Out[2]= Log[a/(a - t)] Cumulants sum. So, the cumulant generating function for the sum n exponential deviates is simply n times the cumulant generating function of the original exponential distribution. And the mean is the first derivative of the cumulant generating function evaluated at t = 0. So, the mean of the sum of n exponential deviates is: In[3]:= D[n mg, t] /. t -> 0 Out[3]= n/a And the variance is given by the second derivative. So, the desired variance is: In[4]:= D[n mg, {t, 2}] /. t -> 0 Out[4]= n/a^2 And to check the validity of the above, note: In[5]:= MomentGeneratingFunction[ExponentialDistribution[a], t] Out[5]= a/(a - t) In[8]:= MomentGeneratingFunction[GammaDistribution[n, 1/a], t] Out[8]= (1 - t/a)^(-n) That is, the sum of n exponential deviates is distributed as a gamma distribution with parameters n, 1/a. So, In[9]:= Mean[GammaDistribution[n, 1/a]] Out[9]= n/a In[10]:= Variance[GammaDistribution[n, 1/a]] Out[10]= n/a^2 which verifies the earlier result using the cumulant generating function. Note, this technique of using generating functions does not require the sum to be of identically distributed values. I could just as easily find the mean and variance of say the sum of an exponential deviate and the sum of a normal deviate using this technique.

**Follow-Ups**:**Re: TransformedDistribution, for a sum of M iid variables***From:*Robert Rosenbaum <robertr@math.uh.edu>