Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add statistical fucntions (as agreg.?) [CORE638] #1002

Open
firebird-automations opened this issue Sep 17, 2003 · 8 comments
Open

Add statistical fucntions (as agreg.?) [CORE638] #1002

firebird-automations opened this issue Sep 17, 2003 · 8 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pcisar

Votes: 4

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)

@firebird-automations
Copy link
Collaborator Author

Modified by: Alice F. Bird (firebirds)

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))/((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)

=>

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)

@firebird-automations
Copy link
Collaborator Author

Commented by: Umberto Masotti (umasotti)

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.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Workflow: jira [ 10662 ] => Firebird [ 15013 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: ramengo (ramengo)

When will be implemented these statistical functions ?
Is there any probability to see them in 2.5 ?

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Definitely, not in v2.5.

@firebird-automations
Copy link
Collaborator Author

Commented by: Dietrich Streifert (level420)

It would be definitely a benefit to have stddev and median as internal agregate functions.

@firebird-automations
Copy link
Collaborator Author

Commented by: Ivan (patuljak)

I think is be better if this support in UDF.

CORE1326

@firebird-automations
Copy link
Collaborator Author

Commented by: Firebird User unter Windows7 (winfire)

I would prefer a internal implementation in V3 like other databases does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant