[Gambas-user] Proposed "gb.statistics" component - volunteer(s) requested

Benoît Minisini g4mba5 at gmail.com
Thu Feb 11 15:04:45 CET 2021


Le 11/02/2021 à 10:51, Bruce a écrit :
> 
> Thanks for your interest Benoît.I have had a look through the gb.gsl 
> additions as best I can. I have about 30% of my eyesight left and reaing 
> C+ is very hard at best. This message is being typed by my helper, so 
> excuse any technical oddities.

No problem. I usually forget your constraints, sorry for that!

> 
> As you indicted before, gsl does provide a lot of the stats functions. 
> So why not use them? Indeed.
> 
> One of the goals I had was a consistent interface, that was also 
> "sensible towards a casual user of the functions. So the "X" parameter 
> wasalways the X axis and "Y" was always the values at the X point. Of 
> course with single variable data sets "x" is all that is required. Frome 
> memory some of the gsl routines expect the data for multivariate 
> analysis in different orders. Nevertheless.

All gsl statistic functions work on one-dimension array of floats.

> 
> As regards the 'missing functions" some are very important. I don't 
> recall a "weighted mean" function in gsl nor do I recall the ranking 
> functions. Weighted means are important when doing time series analysis 
> and either the most recent sample is more impoetant than the least 
> recent.

As there is no optional argument in C functions, there is usually one 
function for each case : one for the mean, one for the weighted mean, 
and so on.

But in Gambas, I have optional arguments, so I can merge everything in 
one function. So the weights became an optional array argument of the 
statistics function.

For example :

Dim A As Float[]
Dim Weights As Float[]
...
' Returns the mean
A.Mean()
' Returns the weighted mean, provided that both arrays have the
' same number of elements
A.Mean(Weights)

The automatic completion should make that clear, as there is no 
documentation written yet.

> The ranking functions are not really tatistics but are very 
> handy to geta rank value when the sample array is deliberately not sorted.

You can get the lower and greater value of the array.

Otherwise, there is one function I didn't implement that returns the 
n-th minimum element. Maybe this is what you are talking about?

> 
> One other observation, if stats were done entirely in Gambas then it 
> would be of gsl interface changes. (Not a biggy.)

Sorry, I didn't understand that sentence.

Regards,

-- 
Benoît Minisini


More information about the User mailing list