Re: TransformedDistribution, for a sum of M iid variables
- To: mathgroup at smc.vnet.net
- Subject: [mg120429] Re: TransformedDistribution, for a sum of M iid variables
- From: Paul von Hippel <paulvonhippel at yahoo.com>
- Date: Fri, 22 Jul 2011 03:42:45 -0400 (EDT)
- References: <20110721225621.9H9BM.1153349.imail@eastrmwml34>
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. Sent from my iPhone. Please excuse my brevity. On Jul 21, 2011, at 9:56 PM, Bob Hanlon <hanlonr at cox.net> wrote: > Clear[distSN] > > distSN[1] = NormalDistribution[0, 1]; > > Assume that > > distSN[n_] = NormalDistribution[0, Sqrt[n]]; > > Proof by induction > > distSN[n + 1] == > TransformedDistribution[ > x + y, {Distributed[x, distSN[n]], > Distributed[y, NormalDistribution[0, 1]]}] > > True > > More generally, > > Clear[distN] > > distN[1] = NormalDistribution[m, s]; > > Assume > > distN[n_] = NormalDistribution[n*m, Sqrt[n*s^2]]; > > Proof by induction > > distN[n + 1] == > TransformedDistribution[ > x + y, {Distributed[x, distN[n]], > Distributed[y, NormalDistribution[m, s]]}] // ExpandAll > > True > > More general forms cannot be as proved as readily; however, the extensions= are obvious. > > Clear[dist] > > dist[n_Integer?Positive] = > NormalDistribution[Sum[m[k], {k, n}], Sqrt[Sum[s[k]^2, {k, n}]]]; > > dist[m_List, s_List] := > > NormalDistribution[Total[m], Norm[s]] /; Length[m] == Length[s]; > > For example, > > dist[4] > > NormalDistribution[m[1] + m[2] + m[3] + m[4], > Sqrt[s[1]^2 + s[2]^2 + s[3]^2 + s[4]^2]] > > With[{n = RandomInteger[{10, 100}]}, > Simplify[ > dist[n] == dist[Table[m[k], {k, n}], Table[s[k], {k, n}]], > Thread[Table[s[k], {k, n}] > 0]]] > > True > > Testing consistency with the simpler cases: > > With[{n = RandomInteger[{10, 100}]}, > (dist[n] /. {m[_] -> m, s[_] -> s}) == distN[n]] > > True > > With[{n = RandomInteger[{10, 100}]}, > (dist[n] /. {m[_] -> 0, s[_] -> 1}) == distSN[n]] > > True > > > Bob Hanlon > > > > ---- paulvonhippel at yahoo <paulvonhippel at yahoo.com> wrote: > > ============= > Using the TransformedDistribution function it is easy to show that the > sum of two normal variables is normal, e.g., > > Input: > TransformedDistribution[Z1+Z2,{Z1\ > [Distributed]NormalDistribution[0,1],Z2\ > [Distributed]NormalDistribution[0,1]}] > > Output: > NormalDistribution[0, Sqrt[2]] > > > Likewise it wouldn't be hard to show that the sum of 3 normal > variables is normal, or 4. > > But how do I show that the sum of M normal variables is normal, where > M is an arbitrary positive integer. > > I'm thinking I should use the Sum function inside > TransformedDistribution, but I don't know how the notation would work. > I see that there's a UniformSumDistribution function, but that's > limited to uniform variables. > > Later I will want to do similar calculations for nonnormal > distributions. > > Thanks for any pointers. > > > -- > > Bob Hanlon >