3 #ifndef MYGSL_LINEAR_REGRESSION_H 4 #define MYGSL_LINEAR_REGRESSION_H 1 11 #include <boost/serialization/base_object.hpp> 12 #include <boost/serialization/nvp.hpp> 14 #include <datatools/i_serializable.ipp> 105 void eval_err(
double x_,
double & y_,
double & yerr_)
const;
110 virtual double _eval(
double x_)
const;
142 const double * w_ = 0);
146 const std::vector<double> & y_,
147 const std::vector<double> & w_);
151 const std::vector<double> & y_);
157 void init(
const std::vector<datapoint> & p_);
160 void init(
size_t npoints_,
163 const double * w_ = 0);
166 void init(
const std::vector<double> & x_,
167 const std::vector<double> & y_,
168 const std::vector<double> & w_);
171 void init(
const std::vector<double> & x_,
172 const std::vector<double> & y_);
203 #endif // MYGSL_LINEAR_REGRESSION_H int32_t status
Number of fitted points.
Definition: linear_regression.h:75
bool is_valid() const
Check if the fit data are valid.
bool is_weighted() const
Check if the fit was weighted.
linear_regression()
Default constructor.
double get_constant() const
Return the constant parameter.
double get_constant_err() const
Return the error on the constant.
const fit_data & get_fit_data() const
Return the fit data.
void init(const std::vector< datapoint > &p_)
Initialize from an array of datapoints (x,y,w) triplets.
double cov00
Constant parameter.
Definition: linear_regression.h:80
void eval_err(double x_, double &y_, double &yerr_) const
Evaluate the Y value and associated error for a given X from the result of the fit.
The serializable result data of the linear regression algorithm.
Definition: linear_regression.h:28
virtual double _eval(double x_) const
Evaluate the Y value for a given X.
bool fit_weighted_linear()
Perform the linear weighted fit.
double get_chisq() const
Return the chi squared.
double get_slope() const
Return the slope parameter.
void set_fit_data(const fit_data &)
Set the fit fata.
virtual ~fit_data()
Destructor.
#define DATATOOLS_SERIALIZATION_DECLARATION()
Definition: i_serializable.h:266
double cov11
Covariance coefficient.
Definition: linear_regression.h:82
double cov01
Covariance coefficient.
Definition: linear_regression.h:81
double c1
Flag for a linear fit with a constant.
Definition: linear_regression.h:78
bool weighted
Status of the fit 0 == fit results; no fit otherwise.
Definition: linear_regression.h:76
static const unsigned int MINIMUM_NUMBER_OF_DATA_POINTS
Minimum number of data points to perform the linear regression fit.
Definition: linear_regression.h:121
bool has_constant() const
Check if the linear fit uses a constant parameter.
bool fit_linear()
Perform the linear unweighted fit.
Abstract interface for unary functions : R -> R.
Definition: i_unary_function.h:44
double sumsq
Covariance coefficient.
Definition: linear_regression.h:83
const fit_data & get_fit_data() const
Return the result of the fit.
bool fit_linear_no_constant()
Perform the linear unweighted fit without constant parameter.
bool is_initialized() const
Check initialization flag.
size_t get_ndof() const
Return the number of degrees of freedom.
The linear regression algorithm.
Definition: linear_regression.h:23
void reset()
Reset the fit data.
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
double get_sumsq() const
Return the sum of squared residuals.
bool can_weighted() const
Check if a weighted fit can pe performed.
bool fit_weighted_linear_no_constant()
Perform the linear weighted fit without constant parameter.
double c0
Slope parameter.
Definition: linear_regression.h:79
double chisq
Sum of squared residuals.
Definition: linear_regression.h:84
uint32_t n
Definition: linear_regression.h:74
A linear regression fit function.
Definition: linear_regression.h:91
virtual ~linear_regression()
Destructor.
double get_slope_err() const
Return the error on the slope.
bool with_constant
Flag for a weighted fut.
Definition: linear_regression.h:77