Paul DuBois wrote:
At 16:02 -0700 5/7/04, Matthias Eireiner wrote:
Hi there,
I have a question regarding the STD()/STDDEV() function. In the manual it says, that STD() is the square root of VARIANCE() and for VARIANCE it says it is first implemented in 4.1. But when I look at the 4.1. changes it only says: "Added new VARIANCE(expr) function returns the variance of expr". It doesn't mention STD()/STDDEV() at all. so here is my question: is STD()/STDDEV() already implemented in 4.0.x or only in 4.1?
STD()/STDDEV() have been around for a long time. VARIANCE() was added later. Nevertheless, that doesn't change their mathematical relationship. :-)
Yes, but I'd have to agree that the manual is possibly misleading on this. It doesn't say that STD() and STDDEV() return the square root of the (mathematical/statistical) variance. It says, "Returns the standard deviation of expr (the square root of VARIANCE())." That is, it explicitly references the VARIANCE() function, which in turn is "first implemented in 4.1." I think STD() and STDDEV() first implemented in 4.1 is a *reasonable* (though incorrect) reading of the manual, as you can't return the square root of an undefined function.
The manual also fails to mention whether STD() and STDDEV return the population or sample standard deviation.
How about something like:
STD(expr) STDDEV(expr)
Returns the standard deviation (the square root of the variance) of expr (considering rows as the whole population, not as a sample; so it has the number of rows as denominator). The STDDEV() form of this function is provided for Oracle compatibility.
If you want to reference the new VARIANCE() function in the description of STD(), you could add something like, "Starting with MySQL 4.1, you can also calculate the variance directly with the VARIANCE() function" at the end.
Michael
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]