Re: Basic Statistics in Mathematica 3.0
- To: mathgroup@smc.vnet.net
- Subject: [mg12489] Re: Basic Statistics in Mathematica 3.0
- From: "Allan Hayes" <hay@haystack.demon.cc.uk>
- Date: Tue, 19 May 1998 13:31:53 -0400
- References: <6jf6ev$4ao@smc.vnet.net>
Jo Ann CAHN wrote in message <6jf6ev$4ao@smc.vnet.net>...
>The calculation of, for example, the mean and the variance of a
>statistical series is staighforward in Mathematica but I don't know
>how to do it if, instead of having the complete list of values of the
>statistical variable I only have the set of different values that
>variable takes with their respective frequencies. I have trouble
>thinking Mathematica cannot handle such a basic task but I can't find
>a way to do it.
If the data is given in the form
{{2,3}, {1,1},{6,2}}
then we can use
Flatten[Apply[Table[#1,{#2}]&,{{2,3}, {1,1},{6,2}},1]]
{2,2,2,1,6,6}
--
Allan Hayes
Mathematica Training and Consulting
Leicester UK
http://www.haystack.demon.co.uk
hay@haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44(0)116 271 8642