Last change
on this file since 235 was
235,
checked in by Peter, 18 years ago
|
Major modifications
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
1.5 KB
|
Line | |
---|
1 | // $Id: Regression.h 235 2005-02-21 14:53:48Z peter $ |
---|
2 | |
---|
3 | #ifndef _theplu_statistics_regression_ |
---|
4 | #define _theplu_statistics_regression_ |
---|
5 | |
---|
6 | #include "vector.h" |
---|
7 | |
---|
8 | |
---|
9 | namespace theplu { |
---|
10 | namespace statistics { |
---|
11 | |
---|
12 | |
---|
13 | /// |
---|
14 | /// Virtual Class for Regression. |
---|
15 | /// |
---|
16 | |
---|
17 | class Regression |
---|
18 | { |
---|
19 | |
---|
20 | public: |
---|
21 | /// |
---|
22 | /// Default Constructor. |
---|
23 | /// |
---|
24 | Regression(); |
---|
25 | |
---|
26 | /// |
---|
27 | /// Destructor |
---|
28 | /// |
---|
29 | virtual ~Regression(void) {}; |
---|
30 | |
---|
31 | /// |
---|
32 | /// This function computes the best-fit given a model (see |
---|
33 | /// specific class for details) by minimizing \f$ |
---|
34 | /// \sum{(\hat{y_i}-y_i)^2} \f$, where \f$ \hat{y} \f$ is the fitted value. |
---|
35 | /// |
---|
36 | virtual void fit(const gslapi::vector& x, const gslapi::vector& y)=0; |
---|
37 | |
---|
38 | /// |
---|
39 | /// This function computes the best-fit given a model (see |
---|
40 | /// specific class for details) by minimizing \f$ |
---|
41 | /// \sum{w_i(\hat{y_i}-y_i)^2} \f$, where \f$ \hat{y} \f$ is the |
---|
42 | /// fitted value. The weight \f$ w_i \f$ is should be proportional |
---|
43 | /// to the inverse of the variance for \f$ y_i \f$ |
---|
44 | /// |
---|
45 | virtual void fit(const gslapi::vector& x, const gslapi::vector& y, |
---|
46 | const gslapi::vector& w)=0; |
---|
47 | /// |
---|
48 | /// |
---|
49 | /// |
---|
50 | virtual void predict(const double x, double& y, double& y_err, |
---|
51 | const double w=1) =0; |
---|
52 | /// |
---|
53 | /// @return prediction value and parameters |
---|
54 | /// |
---|
55 | virtual std::ostream& print(std::ostream&) const=0; |
---|
56 | |
---|
57 | /// |
---|
58 | /// @return header for print() |
---|
59 | /// |
---|
60 | virtual std::ostream& print_header(std::ostream& s) const=0; |
---|
61 | |
---|
62 | protected: |
---|
63 | double x_; |
---|
64 | double y_; |
---|
65 | double y_err_; |
---|
66 | }; |
---|
67 | |
---|
68 | }} // of namespace statistics and namespace theplu |
---|
69 | |
---|
70 | #endif |
---|
71 | |
---|
Note: See
TracBrowser
for help on using the repository browser.