Issue Details (XML | Word | Printable) Key: CORE-638 Type: New Feature Status: Open Priority: Major Assignee: Unassigned Reporter: Pavel Cisar Votes: 4 Watchers: 2
 Operations If you were logged in you would be able to see more operations.
Firebird Core

### Add statistical fucntions (as agreg.?)

Created: 17/Sep/03 12:00 AM   Updated: 31/Jan/14 09:33 AM
Component/s: UDF
Affects Version/s: None
Fix Version/s: None

 SF_ID: 807974

 Description « Hide
 SFID: 807974# Submitted By: pcisar May be implemented in Firebird some statistical functions? - computing of Median - computing of Standard deviation (StdDev) - computing of Skew - computing of Kurtosis - common and central statistical moments How can be computed: Median - sort by values and get central value PHP example:     \$this->int_get_sorted_data();     \$count = \$this->data_count;     \$data = \$this->data_sorted;     if (\$count % 2){       \$mediane = \$data[(\$count - 1) / 2];     } else {       \$mediane = (\$data[\$count/2] + \$data[\$count/2 - 1]) / 2;     } standard deviation = = sqrt(1/(count(X) - 1) * sum(Xi - avg(x))) = sqrt((sum(Xi^2) - (sum(Xi)^2)/(count(X) - 1)) Skew = (count(X) * (sum((Xi - avg(X))^3))) / ((count(X)-1)*(count(X)-2)*stddev(X)^3)) Kurtosis = (n*(n+1)*sum((Xi - avg(X))^4))/((n-1)*(n-2)*(n-3) *stddev^4 - (3*(n-1)^2)/((n-2)*(n-3)) n = count(X) Standard deviation, Kurtosis and Skew not teoretical but selective (select). r-th common moment: MU'r(X) = avg(Xi^r) r-th central moment: MUr(X) = avg((Xi - avg(X))^r)

 All Comments Change History Subversion Commits Sort Order: Umberto Masotti added a comment - 20/Sep/06 02:03 AM
these functions are aggregates, and need a result set to give a singleton answer.

How can be passed a vector of results to a UDF?

Thay can be implemented simpler as internal function, as SUM(), COUNT(), AVG() are.

ramengo added a comment - 23/Sep/08 08:02 AM
When will be implemented these statistical functions ?
Is there any probability to see them in 2.5 ?

Dmitry Yemanov added a comment - 23/Sep/08 08:53 AM
Definitely, not in v2.5.

Dietrich Streifert added a comment - 07/Oct/09 12:07 AM
It would be definitely a benefit to have stddev and median as internal agregate functions.

Ivan added a comment - 24/Oct/09 07:38 PM
I think is be better if this support in UDF.

http://tracker.firebirdsql.org/browse/CORE-1326

Firebird User unter Windows7 added a comment - 31/Jan/14 09:33 AM
I would prefer a internal implementation in V3 like other databases does.