Statistical Analysis of Grouped Data

Arithmetic, Decimals and Fractions, Prealgebra, Algebra I, Algebra II, Geometry, Trigonometry, Precalculus, Calculus, Discrete Math, Probability and Statistics, etc.
Forum Rules
By using the Wolfram Faculty Program Forum, you agree not to post any abusive, obscene, vulgar, slanderous, hateful, threatening, or sexually oriented material. Wolfram Faculty Program Forum administrators have the right to remove, edit, move or close any topic at any time should we see fit.

Personal Information: Posts in this forum may be viewed by non-members; however, the forum prohibits non-members from viewing your profile. Although your email address is hidden from both non-members and members, your account is initially configured to allow members to contact you via email through the forum. If you wish to hide your profile, or prohibit others from contacting you directly, you may change these settings by updating your profile through the User Control Panel.

Attachments: Attachments are not currently enabled on this forum. To share a file with others on this site, simply upload your file to the online storage service of your choice and include a link to the file within your post. If your school does not offer an online file storage and sharing service, the following sites provide free basic online file storage and sharing: Mozy, FilesAnywhere, Adrive, and KeepandShare.

Statistical Analysis of Grouped Data

Postby Miles_Ford » Wed Feb 29, 2012 2:54 am

Hi all,

I'm trying to find out if there is a simple way in Mathematica to deal with grouped data. For example a table showing the number of children in different families and the frequency, 3 have 0 children, 5 have 1 child, 7 have 2, 6 have 3, 3 have 4 and 1 has 5. Which I'd write as a list as such:
Code: Select all
data={{0,3},{1,5},{2,7},{3,6},{4,3},{5,1}}


If I ask for the mean it just gives me two means, one for each column. I can't find anything under the help for Mean that'll let me treat it differently. Is there an existing function that can treat the second column as the frequencies? Or doI need to create functions to do this myself?
User avatar
Miles_Ford
 
Posts: 6
Joined: Thu Sep 08, 2011 2:48 am
Organization: St John's Anglican College
Department: Mathematics

Re: Statistical Analysis of Grouped Data

Postby Craig_Bauling » Sun Mar 04, 2012 10:47 pm

Miles,
Thanks for the great question.

In Mathematica, this type of frequency data is easily obtained by using the Tally function. Tally works for both numeric and non-numerica lists. Such data is very frequently used in Histograms and determining bin counts. One difficulty with such frequency data is that the order of the original data set is lost.

Now to your question. I've created a short Mathematica notebook that outlines a couple of ways to calculate the Mean for such frequency data. http://download.wolfram.com/?key=5QWR11

The best might be the use of a delay function like the following :

TallyMean[data_List] :=
Total[Table[data[[n, 1]]*data[[n, 2]], {n, 1, Length[data]}]]/
Total[Table[data[[n, 2]], {n, 1, Length[data]}]]

And then evaluate a data set using the delay function:

TallyMean[data_1 ]
Where data_1 is your frequency data set.

Hope that this helps,
Craig
User avatar
Craig_Bauling
 
Posts: 1
Joined: Fri Sep 11, 2009 10:01 pm
Organization: Wolfram Research, Inc.
Department: Sales


Return to Mathematics and Statistics (Primary/Secondary)

Who is online

Users browsing this forum: No registered users and 1 guest