00001
00002 #ifndef LREGRESS_H_
00003 #define LREGRESS_H_
00004
00005 #include <vector>
00006
00040 class lregress
00041 {
00042 private:
00043 lregress( const lregress &rhs );
00044
00045 public:
00046 lregress() {}
00047 ~lregress() {}
00048
00052 class point
00053 {
00054 private:
00055 double x_, y_;
00056 public:
00058 point( double xVal, double yVal ) { x_ = xVal; y_ = yVal; }
00060 point( const point &rhs ) { x_ = rhs.x_; y_ = rhs.y_; }
00062 ~point() {};
00063
00064 double x() { return x_; }
00065 void x(const double v) { x_ = v; }
00066 double y() { return y_; }
00067 void y(const double v) { y_ = v; }
00068 };
00069
00080 class lineInfo
00081 {
00082 private:
00084 double slope_;
00086 double intercept_;
00088 double stddev_;
00090 double slopeError_;
00092 double cor_;
00093 public:
00095 lineInfo()
00096 {
00097 slope_ = 0;
00098 intercept_ = 0;
00099 cor_ = 0;
00100 stddev_;
00101 slopeError_ = 0;
00102 }
00103 ~lineInfo() {}
00105 lineInfo( const lineInfo &rhs )
00106 {
00107 slope_ = rhs.slope_;
00108 intercept_ = rhs.intercept_;
00109 cor_ = rhs.cor_;
00110 stddev_ = rhs.stddev_;
00111 slopeError_ = rhs.slopeError_;
00112 }
00113
00114 double slope() { return slope_; }
00115 void slope( double s ) { slope_ = s; }
00116
00117 double intercept() { return intercept_; }
00118 void intercept( double a ) { intercept_ = a; }
00119
00120 double stddev() { return stddev_; }
00121 void stddev( double s ) { stddev_ = s; }
00122
00123 double corr() { return cor_; }
00124 void corr( double c ) { cor_ = c; }
00125
00126 double slopeErr() { return slopeError_; }
00127 void slopeErr(double e) { slopeError_ = e; }
00128 };
00129
00130 double meanX( std::vector<point> &data ) const;
00131 double meanY( std::vector<point> &data ) const;
00132
00137 void lr( std::vector<point> &data, lineInfo &info ) const;
00138
00139 };
00140
00141 #endif