Re: Basic Statistics in Mathematica 3.0
- To: mathgroup@smc.vnet.net
- Subject: [mg12472] Re: [mg12439] Basic Statistics in Mathematica 3.0
- From: "Jrgen Tischer" <jtischer@pitagoras.univalle.edu.co>
- Date: Tue, 19 May 1998 13:31:38 -0400
Hi Massy, why not just change your data in a list with repetition and use the standard commands of Statistics`? Example: In[1]:= data=Table[{Random[],Random[Integer,{1,20}]},{100}]; In[2]:= data1=Join@@(Table[#[[1]],{#[[2]]}]&/@data); Of course if you find it too ugly to produce such a wasteful data structure, you can define the mean and variance. Example: Mean1[d_] := With[{d1 = Transpose[d]}, Dot @@ d1/Plus @@ d1[[2]]] Variance1[d_] := With[{d1= Transpose[d]}, (d1[[1]] - Mean1[d])^2 . d1[[2]]/(Plus @@ d1[[2]] - 1)] Jrgen -----Original Message----- From: Jo Ann CAHN <jcahn@sworldnet.fr> To: mathgroup@smc.vnet.net Subject: [mg12472] [mg12439] Basic Statistics in Mathematica 3.0 >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 diifferent 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. > > >Massy Soedirman >jcahn@worldnet.fr > >