| OpenMS 2.5.0

Public Member Functions | Private Attributes | List of all members
LinearRegressionWithoutIntercept Class Reference
Math

This class offers functions to perform least-squares fits to a straight line model, . More...

`#include <OpenMS/MATH/STATISTICS/LinearRegressionWithoutIntercept.h>`

## Public Member Functions

| LinearRegressionWithoutIntercept ()
| Constructor. More...
void | addData (double x, double y)
| adds an observation (x,y) to the regression data set. More...
void | addData (std::vector< double > &x, std::vector< double > &y)
| adds observations (x,y) to the regression data set. More...
double | getSlope ()
| returns the slope of the estimated regression line. More...

## Private Attributes

double | sum_xx_
| total variation in x More...
double | sum_xy_
| sum of products More...
int | n_
| number of observations More...

## Detailed Description

This class offers functions to perform least-squares fits to a straight line model, .

## Constructor & Destructor Documentation

## ◆ LinearRegressionWithoutIntercept()

LinearRegressionWithoutIntercept | ( |  | ) |

Constructor.

## Member Function Documentation

## ◆ addData() [1/2]

void addData | ( | double | x,
|  | double | y
| ) |  |

adds an observation (x,y) to the regression data set.

Parameters

  x | independent variable value
  y | dependent variable value

## ◆ addData() [2/2]

void addData | ( | std::vector< double > & | x,
|  | std::vector< double > & | y
| ) |  |

adds observations (x,y) to the regression data set.

Parameters

  x | vector of independent variable values
  y | vector of dependent variable values

## ◆ getSlope()

double getSlope | ( |  | ) |

returns the slope of the estimated regression line.

## Member Data Documentation

## ◆ n_

int n_

private

number of observations

## ◆ sum_xx_

double sum_xx_

private

total variation in x

## ◆ sum_xy_

double sum_xy_

private

sum of products