MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Basic Stat Question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42633] Re: Basic Stat Question
  • From: Bill Rowe <listuser at earthlink.net>
  • Date: Fri, 18 Jul 2003 05:25:32 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 7/17/03 at 3:45 AM, Moranresearch at aol.com wrote:

> I have a list l1= {{xi,yi}}
> I want to find the Mean xi where s <y <  t
> for a series of s and t.

If you are using Mathematica 5.0 then

Mean[First/@Select[list, (s < Last@# && Last@# < t)&]]

will do what you want. If you are using a version earlier than 5.0 you will need to define the function Mean or load the package Statistics`DescriptiveStatistics`

> So say I have the height of a million children and I want to know the average 
> height at age 1, 2, 3...18. How do I do this?

> Also the data a field "Gender" how do I select the subset "Girls" or "Boys" 
> to analyze.

The answers to these depend on how you have organized your data. Suppose you have the data organized as a list of items structured as {height, age, gender} where height and age are numbers and gender is a string.

Then

Mean[First/@Select[data, #[[2]]==18&]]

will compute the average height at age 18

and

Mean[First/@Select[data,StringMatchQ[Last@#, "Girl"]&]]

will compute the average hieght of girl.


  • Prev by Date: Re: expanding a list
  • Next by Date: Re: Basic Stat Question
  • Previous by thread: Re: Basic Stat Question
  • Next by thread: Re: Basic Stat Question