source: trunk/c++_tools/statistics/OneDimensional.h @ 586

Last change on this file since 586 was 586, checked in by Peter, 15 years ago

closes #23 redesign of regression classes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.5 KB
Line 
1// $Id: OneDimensional.h 586 2006-06-19 09:56:04Z peter $
2
3#ifndef _theplu_statistics_regression_onedimensioanl_
4#define _theplu_statistics_regression_onedimensioanl_
5
6#include <c++_tools/statistics/AveragerPair.h>
7
8#include <ostream>
9
10namespace theplu {
11namespace gslapi {
12  class vector;
13}
14
15namespace statistics {
16namespace regression {
17 
18  ///
19  /// Abstract Base Class for One Dimensional fitting.   
20  ///
21  /// @todo document
22  ///
23  class OneDimensional
24  {
25 
26  public:
27    ///
28    /// Default Constructor.
29    ///
30    inline OneDimensional(void) {}
31
32    ///
33    /// Destructor
34    ///
35    virtual ~OneDimensional(void) {};
36         
37    ///
38    /// This function computes the best-fit given a model (see
39    /// specific class for details) by minimizing \f$
40    /// \sum{(\hat{y_i}-y_i)^2} \f$, where \f$ \hat{y} \f$ is the fitted value.
41    ///
42    virtual void fit(const gslapi::vector& x, const gslapi::vector& y)=0; 
43   
44    ///
45    /// function predicting in one point
46    ///
47    virtual double predict(const double x) const=0;
48
49    ///
50    /// @return expected prediction error for a new data point in @a x
51    ///
52    virtual double prediction_error(const double x) const=0;
53
54    std::ostream& print(std::ostream& os,const double min, 
55                        double max, const u_int n) const;
56
57    ///
58    /// @return error of model value in @a x
59    ///
60    virtual double standard_error(const double x) const=0;
61
62  protected:
63    ///
64    /// Averager for pair of x and y
65    ///
66    AveragerPair ap_;
67
68    double msd_; // mean squared deviation (model from data points)
69  };
70
71}}} // of namespaces regression, statisitcs and thep
72
73#endif
Note: See TracBrowser for help on using the repository browser.