source: trunk/src/Regression.h @ 216

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

RegressionLocal? added

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.4 KB
Line 
1// $Id: Regression.h 216 2004-12-29 09:29:54Z peter $
2
3#ifndef _theplu_statistics_regression_
4#define _theplu_statistics_regression_
5
6// C++ tools include
7/////////////////////
8#include "vector.h"
9
10// Standard C++ includes
11////////////////////////
12
13
14namespace theplu {
15namespace statistics { 
16
17 
18  ///
19  /// Virtual Class for Regression.   
20  ///
21 
22  class Regression
23  {
24 
25  public:
26    ///
27    /// Default Constructor.
28    ///
29    Regression();
30
31    ///
32    /// Destructor
33    ///
34    virtual ~Regression(void) {};
35         
36    virtual void estimate(const double x, double& y, double& y_err) const=0;
37
38    ///
39    /// This function computes the best-fit given a model (see
40    /// specific class for details) by minimizing \f$
41    /// \sum{(\hat{y_i}-y_i)^2} \f$, where \f$ \hat{y} \f$ is the fitted value.
42    ///
43    virtual int fit(const gslapi::vector& x, const gslapi::vector& y)=0; 
44   
45    ///
46    /// This function computes the best-fit given a model (see
47    /// specific class for details) by minimizing \f$
48    /// \sum{w_i(\hat{y_i}-y_i)^2} \f$, where \f$ \hat{y} \f$ is the
49    /// fitted value. The weight \f$ w_i \f$ is should be proportional
50    /// to the inverse of the variance for \f$ y_i \f$
51    ///
52    virtual int fit_weighted(const gslapi::vector& x, const gslapi::vector& y, 
53                             const gslapi::vector& w)=0;
54
55    inline double sumsq() const { return sumsq_; }
56         
57  protected:
58    double sumsq_;
59
60  };
61
62}} // of namespace statistics and namespace theplu
63
64#endif
65
Note: See TracBrowser for help on using the repository browser.