Theoretica
A C++ numerical and automatic mathematical library
regression.h File Reference

Regression to a model. More...

#include "./statistics.h"
#include "../algebra/mat.h"

Go to the source code of this file.

Classes

class  theoretica::regression::linear_model
 structure for computation and storage of least squares linear regression results with model \(y = A + Bx\). More...
 

Namespaces

 theoretica
 Main namespace of the library which contains all functions and objects.
 
 theoretica::regression
 Regression to a model.
 

Functions

template<typename Dataset1 , typename Dataset2 >
void theoretica::regression::ols_linear (const Dataset1 &X, const Dataset2 &Y, real &intercept, real &slope)
 Compute the coefficients of the linear regression using Ordinary Least Squares.
 
template<typename Dataset1 , typename Dataset2 >
void theoretica::regression::ols_linear (const Dataset1 &X, const Dataset2 &Y, real sigma_Y, real &intercept, real &slope, real &sigma_A, real &sigma_B)
 Compute the coefficients of the linear regression using Ordinary Least Squares.
 
template<typename Dataset1 , typename Dataset2 >
void theoretica::regression::ols_linear (const Dataset1 &X, const Dataset2 &Y, real sigma_Y, real &intercept, real &slope, mat2 &covar_mat)
 Compute the coefficients of the linear regression using Ordinary Least Squares.
 
template<typename Dataset1 , typename Dataset2 , typename Dataset3 >
void theoretica::regression::wls_linear (const Dataset1 &X, const Dataset2 &Y, const Dataset3 &W, real &intercept, real &slope, mat2 &covar_mat)
 Compute the coefficients of the linear regression using Weighted Least Squares.
 
template<typename Dataset1 , typename Dataset2 >
void theoretica::regression::wls_linear (const Dataset1 &X, const Dataset2 &Y, real sigma_X, real sigma_Y, real &intercept, real &slope, mat2 &covar_mat)
 Compute the coefficients of the linear regression using Weighted Least Squares.
 
template<typename Dataset1 , typename Dataset2 >
void theoretica::regression::ols_linear_orig (const Dataset1 &X, const Dataset2 &Y, real sigma_Y, real &B, real &sigma_B)
 Compute the Ordinary Least Squares regression to a line passing through the origin.
 
template<typename Dataset1 , typename Dataset2 , typename Dataset3 >
void theoretica::regression::wls_linear_orig (const Dataset1 &X, const Dataset2 &Y, const Dataset3 &W, real &B, real &sigma_B)
 Compute the Weight Least Squares regression to a line passing through the origin.
 
template<typename Dataset1 , typename Dataset2 >
real theoretica::regression::ols_linear_error (const Dataset1 &X, const Dataset2 &Y, real intercept, real slope)
 Compute the error of the least squares linear regression from the X and Y datasets.
 
template<typename Dataset1 , typename Dataset2 >
real theoretica::regression::ols_linear_intercept (const Dataset1 &X, const Dataset2 &Y)
 Compute the intercept of the least squares linear regression from X and Y.
 
template<typename Dataset1 , typename Dataset2 >
real theoretica::regression::ols_linear_sigma_A (const Dataset1 &X, const Dataset2 &Y, real sigma_y)
 Compute the error on the intercept (A)
 
template<typename Dataset1 , typename Dataset2 >
real theoretica::regression::ols_linear_slope (const Dataset1 &X, const Dataset2 &Y)
 Compute the slope of the least squares linear regression from X and Y.
 
template<typename Dataset1 , typename Dataset2 >
real theoretica::regression::ols_linear_sigma_B (const Dataset1 &X, const Dataset2 &Y, real sigma_y)
 Compute the error on the slope coefficient (B)
 
template<typename Dataset1 , typename Dataset2 , typename Dataset3 >
real theoretica::regression::wls_linear_intercept (const Dataset1 &X, const Dataset2 &Y, const Dataset3 &W)
 Compute the intercept of the weighted least squares linear regression from X and Y.
 
template<typename Dataset1 , typename Dataset2 , typename Dataset3 >
real theoretica::regression::wls_linear_slope (const Dataset1 &X, const Dataset2 &Y, const Dataset3 &W)
 Compute the slope of the weighted least squares linear regression from X and Y.
 

Detailed Description

Regression to a model.