Re: distributing data
- To: mathgroup at smc.vnet.net
- Subject: [mg41494] Re: [mg41479] distributing data
- From: Bobby Treat <drmajorbob+MathGroup3528 at mailblocks.com>
- Date: Thu, 22 May 2003 06:57:52 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
<< Statistics`DataManipulation` data = {2, 5, 7, 9, 23, 34, 56, 67, 81, 84, 92, 95, 98, 299, 304, 543, 9444, 20000 }; cutoffs = {0, 10, 50, 100, 500, 20000}; RangeLists[data, cutoffs] {{}, {2, 5, 7, 9}, {23, 34}, {56, 67, 81, 84, 92, 95, 98}, {299, 304}, {543, 9444}, {20000}} That gives a n+1 bins for n cutoffs and, for instance, 20000 is in the x >= 20000 bin. Each cutoff (if in the data) will be in the next higher bin. Another option is -Reverse@RangeLists[-data, -cutoffs] {{}, {2, 5, 7, 9}, {23, 34}, {56, 67, 81, 84, 92, 95, 98}, {299, 304}, {543, 9444, 20000}, {}} That puts cutoffs in the next lower bin. Individual bins are unsorted. That is, they're in the same order as in the data vector. data = {2, 5, 7, 9, 23, 34, 56, 67, 81, 84, 92, 95, 98, 299, 304, 543, 9444, 20000 , 1, 3}; cutoffs = {0, 10, 50, 100, 500, 20000}; RangeLists[data, cutoffs] {{}, {2, 5, 7, 9, 1, 3}, {23, 34}, {56, 67, 81, 84, 92, 95, 98}, {299, 304}, {543, 9444}, {20000}} If you want the bins sorted: Sort /@ RangeLists[data, cutoffs] {{}, {1, 2, 3, 5, 7, 9}, {23, 34}, {56, 67, 81, 84, 92, 95, 98}, {299,304}, {543, 9444}, {20000}} Bobby -----Original Message----- From: Sebnem Arslan <sarslan at teb.com.tr> To: mathgroup at smc.vnet.net Subject: [mg41494] [mg41479] distributing data hi all. I have a problem for two months.I couldn't find any answer yet. I have some values : 2 5 7 9 23 34 56 67 81 84 92 95 98 299 304 543 9444 20000 I want to research my values in suitable intervals. I mean, what is the intervals the values became dense? for example if the values between 0 and 10 10 and 50 50 and 100 100 and 500 500 and 20000 I want to find these numbers but dont know how. is there any algorithm or something like that? Sebnem Arslan