Key: 
CORE638

Type: 
New Feature

Status: 
Open

Priority: 
Major

Assignee: 
Unassigned

Reporter: 
Pavel Cisar

Votes: 
4

Watchers: 
2

If you were logged in you would be able to see more operations.



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))/((n1)*(n2)*(n3)
*stddev^4  (3*(n1)^2)/((n2)*(n3))
n = count(X)
Standard deviation, Kurtosis and Skew not teoretical
but selective (select).
rth common moment:
MU'r(X) = avg(Xi^r)
rth central moment:
MUr(X) = avg((Xi  avg(X))^r)

Description

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))/((n1)*(n2)*(n3)
*stddev^4  (3*(n1)^2)/((n2)*(n3))
n = count(X)
Standard deviation, Kurtosis and Skew not teoretical
but selective (select).
rth common moment:
MU'r(X) = avg(Xi^r)
rth central moment:
MUr(X) = avg((Xi  avg(X))^r) 
Show » 

How can be passed a vector of results to a UDF?
Thay can be implemented simpler as internal function, as SUM(), COUNT(), AVG() are.