Re: TransformedDistribution, for a sum of M iid variables
- To: mathgroup at smc.vnet.net
- Subject: [mg120483] Re: TransformedDistribution, for a sum of M iid variables
- From: Robert Rosenbaum <robertr at math.uh.edu>
- Date: Mon, 25 Jul 2011 07:29:17 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201107232353.TAA08706@smc.vnet.net>
>> 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. I know I'm pointing out the obvious here, but the mean and variance of a sum of independent variables is the sum of the means and variances. No need to use TransformedDistribution or CumulantGeneratingFunction or anything else. Perhaps you're trying to provide an illustration to a classroom or something along those lines and you want to plot the density of the sum, then find its mean and variance. You can achieve this by convolving the individual densities. On Jul 23, 2011, at 6:53 PM, Bill Rowe wrote: > 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. > > Best, Robert
- References:
- Re: TransformedDistribution, for a sum of M iid variables
- From: Bill Rowe <readnews@sbcglobal.net>
- Re: TransformedDistribution, for a sum of M iid variables