Header file for Regression and FindFitParameters functions. More...
#include <iostream>#include <sstream>#include <vector>#include <string>Go to the source code of this file.
Functions | |
| void | Regression (int N, const vector< double > &x, const vector< double > &y, const vector< double > &y_sdev, double &A, double &B, double &A_sdev, double &B_sdev, double &chi2) |
| Linear Regression function. More... | |
| void | FindFitParameters (int N, const vector< double > &x, const vector< double > &y, const vector< double > &y_sdev, double &A, double &B) |
| Find Slope and Intersept of fit. More... | |
| string | __macro_method_name__ (string x) |
| this is for METHOD_NAME macro, extracting method name from PRETTY_FUNCTION More... | |
| string | wordwrap (string x, int w) |
| word-wrap a string More... | |
Header file for Regression and FindFitParameters functions.
| string __macro_method_name__ | ( | string | x | ) |
this is for METHOD_NAME macro, extracting method name from PRETTY_FUNCTION
| void FindFitParameters | ( | int | N, |
| const vector< double > & | x, | ||
| const vector< double > & | y, | ||
| const vector< double > & | y_sdev, | ||
| double & | A, | ||
| double & | B | ||
| ) |
Find Slope and Intersept of fit.
The method uses the Regression function.
| N | : Number of point to use for the regression |
| x | : vector of X axis (only the N first are taken into account) |
| y | : vector of Y axis value (only the N first are taken into account) |
| y_sdev | : vector of Y axis error value (only the N first are taken into account). if size=0 no weights are used |
| A | : the slope of the regression |
| B | : the intersept of the regression |
| void Regression | ( | int | N, |
| const vector< double > & | x, | ||
| const vector< double > & | y, | ||
| const vector< double > & | y_sdev, | ||
| double & | A, | ||
| double & | B, | ||
| double & | A_sdev, | ||
| double & | B_sdev, | ||
| double & | chi2 | ||
| ) |
Linear Regression function.
The method is taken from Numerical Recipes and converted in C++ form.
| N | : Number of point to use for the regression |
| x | : vector of X axis (only the N first are taken into account) |
| y | : vector of Y axis value (only the N first are taken into account) |
| y_sdev | : vector of Y axis error value (only the N first are taken into account). if size=0 no weights are used |
| A | : the slope of the regression |
| B | : the intersept of the regression |
| A_sdev | : the slope error of the regression |
| B_sdev | : the slope intersept of the regression |
| chi2,: | the chi square |
| string wordwrap | ( | string | x, |
| int | w | ||
| ) |
word-wrap a string
| x | : String to be wrapped |
| w | : Maximum width |