| VF_meanvar | VD_meanvar | VE_meanvar |
|
| Function | Mean and variance of a one-dimensional distribution |
|
| Syntax C/C++ | #include <VFstd.h>
float VF_meanvar( float *Var, fVector X, ui size ); |
| C++ VecObj | #include <OptiVec.h>
T vector<T>::meanvar( T *Var ); |
| Pascal/Delphi | uses VFstd;
function VF_meanvar( var Variance:Single; X:fVector; size:UIntSize ): Single; |
|
| Description | mean = (1 / size) * sum( Xi )
var = (1 / (size-1)) * sum( (Xi - mean)2 )
Note that the denominator in the definition of var is size-1, whereas, in the routine VF_varianceC, it is simply size.The reason for that difference is that here the mean is calculated first and then the variance is determined using this value, whereas in VF_varianceC, the parameter C is pre-set. The mean is returned and the variance stored at the address passed as "Var" (C/C++), or in the variable "variance" (Pascal/Delphi). |
|
|
| Return value | mean of the vector elements. |
|
|