in reply to build a distribution

Depends. Does your data still fit into memory? Do you need the distributions more than once or do you just stuff them into some statistics package or chart generator? Do you need the individual numbers in a bin or only the count? Do you know the different distributions you want beforehand or do you want interactivly change the lengths? Do you need more than one distribution simultaneously or is only the last distribution relevant?

The following code deals with the simplest case:

sub finddistribution { my ($length, $numref)= @_; my @counts; foreach my $num (@$numref) { $counts[$num/$length]++; } return @counts; } ... my @dezimaldistri= finddistribution(10,\@nums);

Replies are listed 'Best First'.
Re^2: build a distribution
by Grig (Novice) on Aug 07, 2010 at 14:28 UTC
    Dear jethro,

    I'll try to answer your questions:

    1) I indeed need the distributions more than once.

    2) The individual numbers are not not required, only the count matters.

    3) Unfortunately I don't know all the lengths of intervals beforehand. First of all I would like to get more general distribution with quite large interval just to see the whole picture and to divide it into smaller bins afterwards.

    4) I would prefer to get only one distribution simultaneosly to analyse it carefully and then set another bin length if it is nesessary.

    Thank you!