source: trunk/c++_tools/statistics/Polynomial.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 Id
File size: 1.2 KB
Line 
1// $Id: Polynomial.h 586 2006-06-19 09:56:04Z peter $
2
3#ifndef _theplu_statistics_regression_polynomial_
4#define _theplu_statistics_regression_polynomial_
5
6#include <c++_tools/statistics/OneDimensional.h>
7#include <c++_tools/statistics/MultiDimensional.h>
8
9#include <c++_tools/gslapi/vector.h>
10
11#include <gsl/gsl_multifit.h>
12
13#include <cassert>
14
15
16namespace theplu {
17namespace statistics {
18namespace regression {
19
20  ///
21  /// @todo document
22  ///
23  class Polynomial : public OneDimensional
24  {
25  public:
26
27    ///
28    ///
29    ///
30    inline Polynomial(size_t power)
31      : OneDimensional(), power_(power) {}
32
33    ///
34    /// @brief Destructor
35    ///
36    inline ~Polynomial(void) {};
37
38    ///
39    ///
40    ///
41    void fit(const gslapi::vector& x, const gslapi::vector& y);
42
43    ///
44    ///
45    ///
46    gslapi::vector fit_parameters(void) { return md_.fit_parameters(); }
47
48    ///
49    /// @return value in @a x of model
50    ///
51    double predict(const double x) const;
52
53    ///
54    /// @return expected prediction error for a new data point in @a x
55    ///
56    double prediction_error(const double x) const; 
57
58    ///
59    /// @return error of model value in @a x
60    ///
61    double standard_error(const double x) const;
62
63  private:
64    MultiDimensional md_;
65    size_t power_;
66
67  };
68
69
70}}} // of namespaces regression, statisitcs and thep
71
72#endif
Note: See TracBrowser for help on using the repository browser.