VF_meanvarVD_meanvarVE_meanvar
FunctionMean 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/Delphiuses VFstd;
function VF_meanvar( var Variance:Single; X:fVector; size:UIntSize ): Single;
Descriptionmean = (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).
Error handlingnone
Return valuemean of the vector elements.
See alsoVF_mean,   VF_min_max_mean_stddev,   VF_varianceC,   VF_varianceV,   VF_sum,   VF_ssq,   VF_ssqdevC,   VF_linregress

VectorLib Table of Contents  OptiVec home