liba 0.1.15
An algorithm library based on C/C++
Loading...
Searching...
No Matches
simple linear regression
Collaboration diagram for simple linear regression:

Data Structures

struct  a_regress_simple
 instance structure for simple linear regression More...
 

Typedefs

typedef struct a_regress_simple a_regress_simple
 

Functions

void a_regress_simple_init (a_regress_simple *ctx, double coef, double bias)
 initialize for simple linear regression
 
double a_regress_simple_eval (a_regress_simple const *ctx, double val)
 calculate predicted value for simple linear regression
 
double a_regress_simple_evar (a_regress_simple const *ctx, double val)
 calculate predicted value for simple linear regression
 
void a_regress_simple_ols_ (a_regress_simple *ctx, size_t n, double const *x, double const *y, double x_mean, double y_mean)
 ordinary least squares for simple linear regression
 
void a_regress_simple_olsx (a_regress_simple *ctx, size_t n, double const *x, double const *y, double x_mean)
 ordinary least squares for simple linear regression
 
void a_regress_simple_olsy (a_regress_simple *ctx, size_t n, double const *x, double const *y, double y_mean)
 ordinary least squares for simple linear regression
 
void a_regress_simple_ols (a_regress_simple *ctx, size_t n, double const *x, double const *y)
 ordinary least squares for simple linear regression
 
void a_regress_simple_zero (a_regress_simple *ctx)
 zeroing for simple linear regression
 

Detailed Description

Function Documentation

◆ a_regress_simple_eval()

double a_regress_simple_eval ( a_regress_simple const * ctx,
double val )

calculate predicted value for simple linear regression

Parameters
[in]ctxpoints to an instance of simple linear regression
[in]valindependent variable
Returns
predicted value

◆ a_regress_simple_evar()

double a_regress_simple_evar ( a_regress_simple const * ctx,
double val )

calculate predicted value for simple linear regression

Parameters
[in]ctxpoints to an instance of simple linear regression
[in]valdependent variable
Returns
predicted value

◆ a_regress_simple_init()

void a_regress_simple_init ( a_regress_simple * ctx,
double coef,
double bias )

initialize for simple linear regression

Parameters
[in,out]ctxpoints to an instance of simple linear regression
[in]coefregression coefficient
[in]biasintercept

◆ a_regress_simple_ols()

void a_regress_simple_ols ( a_regress_simple * ctx,
size_t n,
double const * x,
double const * y )

ordinary least squares for simple linear regression

Parameters
[in,out]ctxpoints to an instance of simple linear regression
[in]nnumber of samples, x[n], y[n]
[in]xpredictor data, specified as a numeric vector
[in]yresponse data, specified as a numeric vector

◆ a_regress_simple_ols_()

void a_regress_simple_ols_ ( a_regress_simple * ctx,
size_t n,
double const * x,
double const * y,
double x_mean,
double y_mean )

ordinary least squares for simple linear regression

Parameters
[in,out]ctxpoints to an instance of simple linear regression
[in]nnumber of samples, x[n], y[n]
[in]xpredictor data, specified as a numeric vector
[in]yresponse data, specified as a numeric vector
[in]x_meanmean of predictor data
[in]y_meanmean of response data

◆ a_regress_simple_olsx()

void a_regress_simple_olsx ( a_regress_simple * ctx,
size_t n,
double const * x,
double const * y,
double x_mean )

ordinary least squares for simple linear regression

Parameters
[in,out]ctxpoints to an instance of simple linear regression
[in]nnumber of samples, x[n], y[n]
[in]xpredictor data, specified as a numeric vector
[in]yresponse data, specified as a numeric vector
[in]x_meanmean of predictor data

◆ a_regress_simple_olsy()

void a_regress_simple_olsy ( a_regress_simple * ctx,
size_t n,
double const * x,
double const * y,
double y_mean )

ordinary least squares for simple linear regression

Parameters
[in,out]ctxpoints to an instance of simple linear regression
[in]nnumber of samples, x[n], y[n]
[in]xpredictor data, specified as a numeric vector
[in]yresponse data, specified as a numeric vector
[in]y_meanmean of response data

◆ a_regress_simple_zero()

void a_regress_simple_zero ( a_regress_simple * ctx)

zeroing for simple linear regression

Parameters
[in,out]ctxpoints to an instance of simple linear regression