FunctionChi-square merit function.
Syntax C/C++#include <VFstd.h>
float VF_chi2( fVector X, fVector Y, fVector InvVar, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::chi2( const vector<T>& Y, const vector<T>& InvVar );
Pascal/Delphiuses VFstd;
function VF_chi2( X, Y, InvVar:fVector; size:UIntSize ): Single;
CUDA function C/C++#include <cudaVFstd.h>
int cudaVF_chi2( float *h_RetVal, fVector d_X, fVector d_Y, fVector d_InvVar, ui size );
int cusdVF_chi2( float *d_RetVal, fVector d_X, fVector d_Y, fVector d_InvVar, ui size );
float VFcu_chi2( fVector h_X, fVector h_Y, fVector h_InvVar, ui size );
CUDA function Pascal/Delphiuses VFstd;
function cudaVF_chi2( var h_RetVal:Single; d_X, d_Y, d_InvVar:fVector; size:UIntSize ): IntBool;
function cusdVF_chi2( d_RetVal:PSingle; d_X, d_Y, d_InvVar:fVector; size:UIntSize ): IntBool;
function VFcu_chi2( h_X, h_Y, h_InvVar:fVector; size:UIntSize ): Single;
Descriptionc2 = sum( 1/si2 * (Xi - Yi)2 ).
The c2 (chi-square) merit function is most often used to judge the quality of a fit. One vector (either X or Y) represents experimental values that are obtained with individual standard deviations sigmai, the other contains the values predicted on the basis of a theory or a model. If the experimental data are "normally" distributed, and if s (sigma) is the correct measure for the quality of these data, then c2 is a measure for the quality of the fit. Rather than the standard deviations themselves, the routine needs the inverse of their squares (i.e., the inverse of the variances) to be passed as the vector InvVar.
Error handlingnone
Return valuechi2 merit function.
See alsoVF_meanwW,   VF_varianceVwW,   VF_varianceV,   VF_varianceCwW,   VF_chiabs,   VF_square,   VF_inv,   VF_linregress

VectorLib Table of Contents  OptiVec home