# source:trunk/lib/statistics/OneDimensional.h@389

Last change on this file since 389 was 389, checked in by Peter, 18 years ago

moved kernel to regression namespace and tried to fix some dox issues

• Property svn:eol-style set to native
• Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
Line
1// $Id: OneDimensional.h 389 2005-08-15 11:37:07Z peter$
2
3#ifndef _theplu_statistics_regression_onedimensioanl_
4#define _theplu_statistics_regression_onedimensioanl_
5
6#include <ostream>
7
8namespace theplu {
9namespace gslapi {
10  class vector;
11}
12
13namespace statistics {
14namespace regression {
15
16  ///
17  /// Abstract Base Class for One Dimensional fitting.
18  ///
19  /// @todo document
20  ///
21  class OneDimensional
22  {
23
24  public:
25    ///
26    /// Default Constructor.
27    ///
28    inline OneDimensional(void) : x_(0.0), y_(0.0), y_err_(0.0) {}
29
30    ///
31    /// Destructor
32    ///
33    virtual ~OneDimensional(void) {};
34
35    ///
36    /// This function computes the best-fit given a model (see
37    /// specific class for details) by minimizing \f$38 /// \sum{(\hat{y_i}-y_i)^2} \f$, where \f$\hat{y} \f$ is the fitted value.
39    ///
40    virtual void fit(const gslapi::vector& x, const gslapi::vector& y)=0;
41
42    ///
43    /// This function computes the best-fit given a model (see
44    /// specific class for details) by minimizing \f$45 /// \sum{w_i(\hat{y_i}-y_i)^2} \f$, where \f$\hat{y} \f$ is the
46    /// fitted value. The weight \f$w_i \f$ is should be proportional
47    /// to the inverse of the variance for \f$y_i \f$
48    ///
49    virtual void fit(const gslapi::vector& x, const gslapi::vector& y,
50                    const gslapi::vector& w)=0;
51    ///
52    /// function predicting in one point
53    ///
54    virtual void predict(const double x, double& y, double& y_err,
55                         const double w=1) =0;
56    ///
57    /// @return prediction value and parameters
58    ///
59    virtual std::ostream& print(std::ostream&) const=0;
60
61    ///
62    /// @return header for print()
63    ///
64    virtual std::ostream& print_header(std::ostream& s) const=0;
65
66  protected:
67    ///
68    /// x for predicted point
69    ///
70    double x_;
71    ///
72    /// y for predicted point
73    ///
74    double y_;
75    ///
76    /// estimated error of predicted point (in y).
77    ///
78    double y_err_;
79  };
80
81}}} // of namespaces regression, statisitcs and thep
82
83#endif
Note: See TracBrowser for help on using the repository browser.