source: trunk/src/Regression.h @ 213

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

moving minor stuff to base class

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.3 KB
Line 
1// $Id: Regression.h 213 2004-11-04 19:58:08Z 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    ///
37    /// This function computes the best-fit given a model (see
38    /// specific class for details) by minimizing \f$
39    /// \sum{(\hat{y_i}-y_i)^2} \f$, where \f$ \hat{y} \f$ is the fitted value.
40    ///
41    virtual int fit(const gslapi::vector& x, const gslapi::vector& y)=0; 
42   
43    ///
44    /// This function computes the best-fit given a model (see
45    /// specific class for details) by minimizing \f$
46    /// \sum{(w_i\hat{y_i}-y_i)^2} \f$, where \f$ \hat{y} \f$ is the
47    /// fitted value. The weight \f$ w_i \f$ is should be proportional
48    /// to the inverse of the variance for \f$ y_i \f$
49    ///
50    virtual int fit_weighted(const gslapi::vector& x, const gslapi::vector& y, 
51                             const gslapi::vector& w)=0;
52
53    inline double sumsq() const { return sumsq_; }
54         
55  protected:
56    double sumsq_;
57
58  };
59
60}} // of namespace statistics and namespace theplu
61
62#endif
63
Note: See TracBrowser for help on using the repository browser.