FunctionMean and variance with weights
Syntax C/C++#include <VFmath.h>
float VF_meanvarwW( float *Var, fVector X, fVector Wt, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::meanvarwW( T *Var, const vector<T>& Wt );
Pascal/Delphiuses VFmath;
function VF_meanvarwW( var variance:Single; X, Wt:fVector; size:UIntSize ): Single;
Descriptionmean = (1 / sum( Wti )) * sum( Xi * Wti )
var = (1 / sum( Wti )) * sum( Wti * (Xi - mean)2 )
The weighted 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_meanwW,   VF_varianceCwW,   VF_varianceVwW,   VF_linregress

VectorLib Table of Contents  OptiVec home