43 std::size_t size = data.size();
49 data.begin(), data.end(), 0, [](
double a,
const DataPoint &
b) { return a + b.x; }) /
55 for(
size_t i = 0; i < size; i++)
57 sx += std::pow((data[i].
x - x_vec_mean), 2);
58 sxy += (data[i].x - x_vec_mean) * (data[i].
y - y_vec_mean);
93 std::size_t size =
m_data.size();
98 for(
size_t i = 0; i < size; i++)
102 return sqrt(sum_square_deviation / (
double)size);
117 std::size_t size =
m_data.size();
122 for(
size_t i = 0; i < size; i++)
127 for(
size_t i = 0; i < size; i++)
129 sum_square_total += std::pow((
m_data[i].
y - meanY), 2);
131 return ((
double)1.0 - (sum_square_deviation / sum_square_total));
double getIntercept() const
std::size_t getSize() const
get data size
double getYfromX(double score) const
double getRmsd() const
get Root-Mean-Square Deviation
double getNrmsd() const
get Normalized Root-Mean-Square Deviation
LinearRegression(const Trace &data)
double getCoefficientOfDetermination() const
get Coefficient of determination (R2)
A simple container of DataPoint instances.
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
std::vector< DataPoint >::const_iterator maxYDataPoint(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
double pappso_double
A type definition for doubles.
double meanYTrace(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
calculate the mean of y value of a trace
double sumYTrace(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end, double init)
calculate the sum of y value of a trace
std::vector< DataPoint >::const_iterator minYDataPoint(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)