![]() |
|
select count(x), stddev(x), avg(x), var(x), variance(x), skew(x), kurt(x), kurtosis(x), std(x), stddev_samp(x), stddev_pop(x), var_samp(x), var_pop(x) from table group by whatever
select sqrt(x), pow(x,0.5), exp(x), log(x),
sin(x), cos(x), tan(x), asin(x), acos(x), atan(x)
from table
The SQL standard includes the count(x) and avg(x) aggregators, but statisticians are usually interested in higher moments as well---at least the variance. Therefore, SQL queries using the Apophenia library may include any of the moments above.
var and variance; kurt and kurtosis do the same thing. Choose the one that sounds better to you. var, var_samp, stddev and stddev_samp give sample variance/standard deviation; variance, var_pop std and stddev_pop give population standard deviation. The plethora of variants are for mySQL compatibility.
The var/skew/kurtosis functions calculate sample moments, so if you want the population moment, multiply the result by (n-1)/n .
For bonus points, there are the sqrt(x), pow(x,y), exp(x), log(x), and trig functions. They call the standard math library function of the same name to calculate
,
,
,
,
,
, et cetera.