RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
Math.MeanAndStdDev Function

Calculates the mean and standard deviation of array elements.

Pascal
procedure MeanAndStdDev(const Data: array of Double; var Mean: Extended; var StdDev: Extended);
C++
MeanAndStdDev(const array of Double Data, Extended Mean, Extended StdDev);

Math

MeanAndStdDev calculates Mean and standard deviation in one pass. Using this is twice as fast as calculating them separately. Precision may be lost when the Mean is very large (> 10e7) or the variance is very small. 

Data specifies the data to be summarized. In C++, Data_Size is the index of the last element in the Data array (one less than the number of elements). The mean is returned as Mean and the standard deviation is returned as StdDev.

Note: If the sample size is 1 (that is, if Data contains only one entry), StdDev returns the value of Data[0] and not zero.
 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!