35 : m_slope(other.m_slope), m_intercept(other.m_intercept), m_data(other.m_data)
44 std::size_t size = data.size();
49 (std::accumulate(data.begin(),
52 [](
double a,
const DataPoint &
b) { return a + b.x; }) /
55 (
sumYTrace(data.begin(), data.end(), 0) / size);
59 for(
size_t i = 0; i < size; i++)
61 sx += std::pow((data[i].
x - x_vec_mean), 2);
62 sxy += (data[i].x - x_vec_mean) * (data[i].
y - y_vec_mean);
97 std::size_t size =
m_data.size();
102 for(
size_t i = 0; i < size; i++)
104 sum_square_deviation +=
107 return sqrt(sum_square_deviation / (
double)size);
122 std::size_t size =
m_data.size();
127 for(
size_t i = 0; i < size; i++)
129 sum_square_deviation +=
133 for(
size_t i = 0; i < size; i++)
135 sum_square_total += std::pow((
m_data[i].
y - meanY), 2);
137 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)