MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: TransformedDistribution, for a sum of M iid variables

On 7/22/11 at 3:42 AM, paulvonhippel at (Paul von Hippel)

>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.

  • Prev by Date: Re: Producing an image that only contains its interior and boundary but, no exterior.
  • Next by Date: Re: FinancialData still broken
  • Previous by thread: Re: TransformedDistribution, for a sum of M iid variables
  • Next by thread: Re: TransformedDistribution, for a sum of M iid variables