1.4.0
CCC
 
Regression.cpp File Reference
#include "Stats/Regression.hpp"
#include "Db/Db.hpp"
#include "Model/Model.hpp"

Functions

bool _regressionCheck (Db *db1, int icol0, const VectorInt &icols, int mode, Db *db2, const Model *model)
 
bool _regressionLoad (Db *db1, Db *db2, int iech, int icol0, const VectorInt &icols, int mode, int flagCst, const Model *model, double *value, VectorDouble &x)
 
VectorDouble regressionDeming (const VectorDouble &x, const VectorDouble &y, double delta)
 
Regression regression (Db *db1, const String &nameResp, const VectorString &nameAux, int mode, bool flagCst, Db *db2, const Model *model)
 

Function Documentation

◆ _regressionCheck()

bool _regressionCheck ( Db db1,
int  icol0,
const VectorInt icols,
int  mode,
Db db2,
const Model model 
)

◆ _regressionLoad()

bool _regressionLoad ( Db db1,
Db db2,
int  iech,
int  icol0,
const VectorInt icols,
int  mode,
int  flagCst,
const Model model,
double *  value,
VectorDouble x 
)

◆ regression()

Regression regression ( Db db1,
const String nameResp,
const VectorString nameAux,
int  mode,
bool  flagCst,
Db db2,
const Model model 
)

Evaluate the regression

Returns
Error return code
Parameters
[in,out]db1Db descriptor (for target variable)
[in]nameRespName of the target variable
[in]nameAuxVector of names of the explanatory variables
[in]modeType of calculation
  • 0 : standard multivariate case
  • 1 : using external drifts
  • 2 : using standard drift functions (in 'model')
[in]flagCstThe constant is added as explanatory variable
[in]db2Db descriptor (for auxiliary variables)
[in]modelModel (only used for Drift functions if mode==2)
Remarks
The flag_mode indicates the type of regression calculation:
0 : V[icol] as a function of V[icols[i]]
1 : Z1 as a function of the different Fi's

◆ regressionDeming()

VectorDouble regressionDeming ( const VectorDouble x,
const VectorDouble y,
double  delta 
)

Calculate the coefficients of the Deming regression (with 2 variables)

Parameters
xVector for the first variable
yVector for the second variable
deltaratio of error variances (s_y^2 / s_x^2)
Returns
Vector of coefficients for the equation
y = beta[0] + beta[1] * x
Remarks
Both input vectors are assumed to contain valid values
From: https://en.wikipedia.org/wiki/Deming_regression