Re: calculating the distribution
- To: mathgroup at smc.vnet.net
- Subject: [mg20856] Re: calculating the distribution
- From: Takehiko SAITO <tksaito at cv.sony.co.jp>
- Date: Thu, 18 Nov 1999 01:09:34 -0500 (EST)
- Organization: Tokyo D.C., Sony corp.
- References: <80r0fa$l43@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
sandmann at mip.sdu.dk wrote: > > How can I calculate the distribution of data in a Interval ? > > For instance, if I have the list {1,3,6,9,12,17,19,21,22,25} and I would > like know the distribution i 5-intervals, so I get a list with a number > for each interval. So I would get a list like {2,2,1,2,3}. > Try below. << Statistics`DataManipulation` a = {1,3,6,9,12,17,19,21,22,25}; b = RotateLeft[ a ] ; diff = Drop[ b-a ,-1] ; d = Transpose[ Frequencies[diff] ] ; intvalList = d[[2]]; Print[ "intervals : ",intvalList ] countsList = d[[1]]; Print[ "counts : ",countsList ] Results are intervals : {1,2,3,5} counts : {1,3,4,1} ------------------------------- Best regards, Takehiko Saito