Till wrote:
Hey,
I have corrections ;-)
the histogram example should be something like
<snip>
to allow arbitrary numbers of bins and to disallow the ability to
take another minValue than the maxValue.neg... (which doesn't makes
sense).
the arbitrary number of bins may also be added to the other histogram
examples...
i tried to keep the examples as simple as possible; of course a general
histogram/plot utility should scale to any number of bins.
I have written this and some other statistics utilities as methods:
sumFloat, geoMean, harmMean, variance, stdDev, skew, zTable,
corr(elation).
Let me know if you need them.
Q: is histo (and the rest?) generally useful enough to put in
the main distribution?
+Collection {
histo { arg min=0, max=1, steps=100;
var freqs, freqIndex, lastIndex, range, outliers = 0;
freqs = Array.fill(steps, 0);
lastIndex = steps - 1;
range = max - min;
this.do({ arg el;
freqIndex = ((el - min) / range * steps).round(1).asInteger;
if (freqIndex.inclusivelyBetween(0, lastIndex), {
freqs[freqIndex] = freqs[freqIndex] + 1;
}, { outliers = outliers + 1 });
});
if (outliers > 0, {
inform("histo:" + outliers + "out of histo range values.");
});
^freqs;
}
}
a = Array.rand(200, 0.0, 100.0);
b = a.histo(0, 100, 50);
b.plot;
best,
adc
--
--
Alberto de Campo
Bergstrasse 59/33
A-8020 Graz, Austria
e-mail : decampo@xxxxxx
--
_______________________________________________
sc-users mailing list
sc-users@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-users