FunctionLinear regression with weights
Syntax C/C++#include <VFstd.h>
void VF_linregresswW( fVector Param, fVector X, fVector Y, fVector InvVar, ui size );
C++ VecObj#include <OptiVec.h>
void vector<T>::linregresswW( const vector<T>& X, const vector<T>& Y, const vector<T>& InvVar );
Pascal/Delphiuses VFstd;
procedure VF_linregresswW( Param, X, Y, InvVar:fVector; size:UIntSize );
CUDA function C/C++#include <cudaVFstd.h>
int cudaVF_linregresswW( fVector h_Param, fVector d_X, fVector d_Y, fVector d_InvVar, ui size );
int cusdVF_linregresswW( fVector d_Param, fVector d_X, fVector d_Y, fVector d_InvVar, ui size );
void VF_linregresswW( fVector h_Param, fVector h_X, fVector h_Y, fVector h_InvVar, ui size );
CUDA function Pascal/Delphiuses VFstd;
function cudaVF_linregresswW( h_Param, d_X, d_Y, d_InvVar:fVector; size:UIntSize ): IntBool;
function cusdVF_linregresswW( d_Param, d_X, d_Y, d_InvVar:fVector; size:UIntSize ): IntBool;
procedure VFcu_linregresswW( h_Param, h_X, h_Y, h_InvVar:fVector; size:UIntSize );
DescriptionThe X-Y data are weighted with the inverse of their variances and fitted to a straight line y = ax + b; the parameters a and b are determined in such a way as to minimize the merit function
c2 = sum( (1 / Vari) * (Yi - y(x=Xi) )2 )
(see also VF_chi2). The inverse of the variance of each data point has to be passed to the function in the vector InvVar. Uncertainties da and db are also determined. On output, Param is filled with the 5 elements {a, da, b, db, c2} in the order indicated.
Error handlingnone
Return valuenone
See alsoVF_linregress,   VF_corrcoeff,   VF_chi2

VectorLib Table of Contents  OptiVec home