MLpp
ml::LinearRegression::UnivariateOLSResult Struct Reference

Result of 1D Ordinary Least Squares regression (with or without intercept). More...

#include <LinearRegression.hpp>

Inheritance diagram for ml::LinearRegression::UnivariateOLSResult:
Collaboration diagram for ml::LinearRegression::UnivariateOLSResult:

Public Member Functions

std::string to_string () const
 Formats the result as string.
 
Eigen::VectorXd predict (Eigen::Ref< const Eigen::VectorXd > x) const
 Predicts Y given X. More...
 
double predict (double x) const
 Predicts Y given X. More...
 
- Public Member Functions inherited from ml::LinearRegression::Result
double var_y () const
 Estimated variance of observations Y, equal to rss / dof.
 
double r2 () const
 R2 coefficient. More...
 
double adjusted_r2 () const
 Adjusted R2 coefficient. More...
 

Public Attributes

double slope
 
double intercept
 
double var_slope
 
double var_intercept
 
double cov_slope_intercept
 
- Public Attributes inherited from ml::LinearRegression::Result
unsigned int n
 
unsigned int dof
 
double rss
 
double tss
 

Detailed Description

Result of 1D Ordinary Least Squares regression (with or without intercept).

The following members are calculated assuming independent Gaussian error terms:

Member Function Documentation

◆ predict() [1/2]

Eigen::VectorXd ml::LinearRegression::UnivariateOLSResult::predict ( Eigen::Ref< const Eigen::VectorXd >  x) const

Predicts Y given X.

Parameters
xVector of independent variable values.
Returns
Vector of predicted Y(X) with size X.cols().

◆ predict() [2/2]

double ml::LinearRegression::UnivariateOLSResult::predict ( double  x) const
inline

Predicts Y given X.

Parameters
xIndependent variable value.
Returns
Predicted Y(X).

Member Data Documentation

◆ slope

double ml::LinearRegression::UnivariateOLSResult::slope

Coefficient multiplying X values when predicting Y.

◆ intercept

double ml::LinearRegression::UnivariateOLSResult::intercept

Constant added to slope * X when predicting Y.

◆ var_slope

double ml::LinearRegression::UnivariateOLSResult::var_slope

Estimated variance of the slope.

◆ var_intercept

double ml::LinearRegression::UnivariateOLSResult::var_intercept

Estimated variance of the intercept.

◆ cov_slope_intercept

double ml::LinearRegression::UnivariateOLSResult::cov_slope_intercept

Estimated covariance of the slope and the intercept.


The documentation for this struct was generated from the following file: