Declaration: MeanVarVector (Data: TDoubleArray; First, Last: integer; var Mean, Variance: double): integer;
Calculates the mean and the variance of the data contained in the array Data, using all values from First to Last (the array Data has 0-based indices). If First is greater than Last then First and Last are automatically exchanged.

The function returns the following error codes:

 0 ... everything is OK
-1 ... First and/or Last are out of range
-2 ... the number of values is too low (minimum of 3 values required)