yat  0.21pre
MultiDimensional.h
1 #ifndef _theplu_yat_regression_multidimensional_
2 #define _theplu_yat_regression_multidimensional_
3 
4 // $Id: MultiDimensional.h 4207 2022-08-26 04:36:28Z peter $
5 
6 /*
7  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2009, 2017, 2022 Peter Johansson
9 
10  This file is part of the yat library, http://dev.thep.lu.se/yat
11 
12  The yat library is free software; you can redistribute it and/or
13  modify it under the terms of the GNU General Public License as
14  published by the Free Software Foundation; either version 3 of the
15  License, or (at your option) any later version.
16 
17  The yat library is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with yat. If not, see <http://www.gnu.org/licenses/>.
24 */
25 
26 #include "Multivariate.h"
27 
28 #include "yat/utility/Matrix.h"
29 #include "yat/utility/Vector.h"
30 
31 #include <gsl/gsl_multifit.h>
32 
33 namespace theplu {
34 namespace yat {
35 namespace regression {
36 
41  {
42  public:
43 
47  MultiDimensional(void);
48 
52  ~MultiDimensional(void);
53 
61  const utility::Matrix& covariance(void) const;
62 
75  void fit2(const utility::MatrixBase& X, const utility::VectorBase& y);
76 
81  void fit(const utility::Matrix& X, const utility::VectorBase& y);
82 
86  const utility::Vector& fit_parameters(void) const;
87 
91  double chisq(void) const;
92 
96  double predict(const utility::VectorBase& x) const;
97 
102  double prediction_error2(const utility::VectorBase& x) const;
103 
107  double standard_error2(const utility::VectorBase& x) const;
108 
109  private:
110  // no copy allowed
112  MultiDimensional& operator=(const MultiDimensional&);
113 
114  double chisquare_;
115  double s2_;
116  utility::Matrix covariance_;
117  utility::Vector fit_parameters_;
118  gsl_multifit_linear_workspace* work_;
119 
120  };
121 
122 }}} // of namespaces regression, yat, and theplu
123 
124 #endif
Definition: MatrixBase.h:54
void fit(const utility::Matrix &X, const utility::VectorBase &y)
double standard_error2(const utility::VectorBase &x) const
The Department of Theoretical Physics namespace as we define it.
void fit2(const utility::MatrixBase &X, const utility::VectorBase &y)
Function fitting parameters of the linear model by miminizing the quadratic deviation between model a...
const utility::Vector & fit_parameters(void) const
double predict(const utility::VectorBase &x) const
const utility::Matrix & covariance(void) const
covariance of parameters
double chisq(void) const
Summed Squared Error.
Linear MultiDimesional regression.
Definition: MultiDimensional.h:40
This is the yat interface to GSL vector.
Definition: Vector.h:59
MultiDimensional(void)
Default Constructor.
This is the yat interface to GSL vector.
Definition: VectorBase.h:55
double prediction_error2(const utility::VectorBase &x) const
Interface to GSL matrix.
Definition: Matrix.h:104
Definition: Multivariate.h:43

Generated on Wed Jan 25 2023 03:34:29 for yat by  doxygen 1.8.14