OpenMS
LinearRegressionWithoutIntercept.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Lars Nilse $
6 // $Authors: Lars Nilse $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
12 
13 #include <cmath>
14 #include <vector>
15 
16 namespace OpenMS
17 {
18  namespace Math
19  {
26  {
27  public:
28 
31 
38  void addData(double x, double y);
39 
46  void addData(std::vector<double>& x, std::vector<double>& y);
47 
51  double getSlope() const;
52 
53  private:
57  double sum_xx_;
58 
62  double sum_xy_;
63 
67  int n_;
68 
69  };
70 
71  } // namespace Math
72 } // namespace OpenMS
73 
74 
This class offers functions to perform least-squares fits to a straight line model,...
Definition: LinearRegressionWithoutIntercept.h:26
double sum_xy_
sum of products
Definition: LinearRegressionWithoutIntercept.h:62
double sum_xx_
total variation in x
Definition: LinearRegressionWithoutIntercept.h:57
double getSlope() const
returns the slope of the estimated regression line.
int n_
number of observations
Definition: LinearRegressionWithoutIntercept.h:67
void addData(double x, double y)
adds an observation (x,y) to the regression data set.
void addData(std::vector< double > &x, std::vector< double > &y)
adds observations (x,y) to the regression data set.
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19