Re: Statistics on Matrices
- To: mathgroup at smc.vnet.net
- Subject: [mg28335] Re: [mg28323] Statistics on Matrices
- From: BobHanlon at aol.com
- Date: Thu, 12 Apr 2001 02:18:00 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Needs["Statistics`DescriptiveStatistics`"];
mat[i_] :=
Partition[ToExpression[# <> ToString[i]]& /@ {"a", "b", "c", "d"}, 2];
Combine the matrices into a three dimensional array
data = Table[mat[i], {i, 5}];
positionStat[func_, data_List] :=
Partition[func /@ Transpose[Flatten /@ data], 2];
positionStat[Mean, data]
{{(1/5)*(a1 + a2 + a3 + a4 + a5),
(1/5)*(b1 + b2 + b3 + b4 + b5)},
{(1/5)*(c1 + c2 + c3 + c4 + c5),
(1/5)*(d1 + d2 + d3 + d4 + d5)}}
Similarly,
positionStat[HarmonicMean, data]
positionStat[GeometricMean, data]
positionStat[LocationReport, data][[2, 1]]
positionStat[DispersionReport, data][[1, 2]]
Bob Hanlon
In a message dated 2001/4/11 2:18:23 AM, Moranresearch at aol.com writes:
>I have a series of 2x2 matrices
>How can I get a LocationReport on each element
>{{ai,bi},{ci,di}} , {i,1,n}
>or even simpler a mean for each element
>{{Mean[a],Mean[b]},{Mean[c],Mean[d}}
>I prefer to use the Location Report, DistributionReport etc if possible