1 | // $Id: RegressionLocal.h 216 2004-12-29 09:29:54Z peter $ |
---|
2 | |
---|
3 | #ifndef _theplu_statistics_regression_local_ |
---|
4 | #define _theplu_statistics_regression_local_ |
---|
5 | |
---|
6 | // C++ tools include |
---|
7 | ///////////////////// |
---|
8 | #include "Regression.h" |
---|
9 | #include "RegressionKernel.h" |
---|
10 | #include "vector.h" |
---|
11 | |
---|
12 | // Standard C++ includes |
---|
13 | //////////////////////// |
---|
14 | |
---|
15 | |
---|
16 | namespace theplu { |
---|
17 | namespace statistics { |
---|
18 | |
---|
19 | |
---|
20 | /// |
---|
21 | /// Class for Locally-weighted regression. |
---|
22 | /// |
---|
23 | |
---|
24 | class RegressionLocal |
---|
25 | { |
---|
26 | |
---|
27 | public: |
---|
28 | /// |
---|
29 | /// Default Constructor. |
---|
30 | /// |
---|
31 | RegressionLocal(void); |
---|
32 | |
---|
33 | /// |
---|
34 | /// Constructor loading the object with data, type of regressor |
---|
35 | /// and type kernel. |
---|
36 | /// |
---|
37 | RegressionLocal(const gslapi::vector& x, const gslapi::vector& y, |
---|
38 | Regression& r, RegressionKernel& k, |
---|
39 | const gslapi::vector&); |
---|
40 | |
---|
41 | /// |
---|
42 | /// Copy Constructor. (Not implemented) |
---|
43 | /// |
---|
44 | RegressionLocal(const RegressionLocal&); |
---|
45 | |
---|
46 | /// |
---|
47 | /// Destructor |
---|
48 | /// |
---|
49 | virtual ~RegressionLocal(void) {}; |
---|
50 | |
---|
51 | inline gslapi::vector estimated_x(void) const { return estimated_x_; } |
---|
52 | inline gslapi::vector estimated_y(void) const { return estimated_y_; } |
---|
53 | inline gslapi::vector estimated_y_err(void) const {return estimated_y_err_;} |
---|
54 | |
---|
55 | /// |
---|
56 | /// Function |
---|
57 | /// |
---|
58 | void fit(const double fraction); |
---|
59 | |
---|
60 | private: |
---|
61 | std::vector<std::pair<double, double> > data_; |
---|
62 | gslapi::vector data_y_; |
---|
63 | RegressionKernel* kernel_; |
---|
64 | Regression* regression_; |
---|
65 | gslapi::vector estimated_x_; |
---|
66 | gslapi::vector estimated_y_; |
---|
67 | gslapi::vector estimated_y_err_; |
---|
68 | |
---|
69 | |
---|
70 | }; |
---|
71 | |
---|
72 | /// |
---|
73 | /// The output operator for Local Regression Class. |
---|
74 | /// |
---|
75 | std::ostream& operator<< (std::ostream& s, const RegressionLocal&); |
---|
76 | |
---|
77 | }} // of namespace statistics and namespace theplu |
---|
78 | |
---|
79 | #endif |
---|
80 | |
---|