SecreC 2 language 2.9.0 (2026.10)
Language and standard library reference
Loading...
Searching...
No Matches
Functions

Functions

template<domain D :shared3p >
D float32 linearRegression (D int32 variables, D int32 dependent, int64 method)
 
template<domain D :shared3p >
D float64 linearRegression (D int64 variables, D int64 dependent, int64 method)
 
template<domain D :shared3p >
D float32 linearRegression (D float32 variables, D float32 dependent, int64 method)
 
template<domain D :shared3p >
D float64 linearRegression (D float64 variables, D float64 dependent, int64 method)
 

Detailed Description

Fitting of linear models with multiple explanatory variables.

Note
D - shared3p protection domain
Supported types - int32 / int64 / float32 / float64
You can pass an empty matrix as the variables argument to specify a null model with just intercept.
Parameters
variables- a matrix where each column is a sample of an explanatory variable
dependent- sample vector of dependent variable
method- a constant indicating which algorithm to use (LINEAR_REGRESSION_INVERT, LINEAR_REGRESSION_LU_DECOMPOSITION or LINEAR_REGRESSION_GAUSS)
Returns
returns vector {β_1, β_1, …, β_n} such that y ≈ β_1 * x_1 + β_2 * x_2 + … + β_(n-1) * x_(n-1) + β_n where y is the dependent variable and x_i are the explanatory variables.
Leakage
None

Function Documentation

◆ linearRegression() [1/4]

template<domain D :shared3p >
D float32 linearRegression ( D float32  variables,
D float32  dependent,
int64  method 
)

◆ linearRegression() [2/4]

template<domain D :shared3p >
D float64 linearRegression ( D float64  variables,
D float64  dependent,
int64  method 
)

◆ linearRegression() [3/4]

template<domain D :shared3p >
D float32 linearRegression ( D int32  variables,
D int32  dependent,
int64  method 
)

◆ linearRegression() [4/4]

template<domain D :shared3p >
D float64 linearRegression ( D int64  variables,
D int64  dependent,
int64  method 
)