source: trunk/test/test_regression_linear.cc @ 238

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

* empty log message *

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 654 bytes
Line 
1// $Id: test_regression_linear.cc 238 2005-02-21 16:42:00Z peter $
2
3// C++ tools include
4////////////////////
5#include "RegressionLinear.h"
6#include "vector.h"
7
8
9// Standard includes
10////////////////////
11#include <gsl/gsl_fit.h>
12#include <iostream>
13
14
15using namespace std;
16
17int main()
18
19{ 
20  bool ok=true;
21
22  theplu::gslapi::vector x(4);
23  x(0)=1970;
24  x(1)=1980;
25  x(2)=1990;
26  x(3)=2000;
27  theplu::gslapi::vector y(4);
28  y(0)=12;
29  y(1)=11;
30  y(2)=14;
31  y(3)=13;
32  theplu::gslapi::vector w(4);
33  w(0)=0.1;
34  w(1)=0.2;
35  w(2)=0.3;
36  w(3)=0.4;
37
38  theplu::statistics::RegressionLinear r;
39  r.fit(x,w,y);
40  double y_predicted=0;
41  double y_predicted_err=0;
42  r.predict(0,y_predicted,y_predicted_err);
43
44  if (ok)
45    return 0;
46  return -1;
47}
Note: See TracBrowser for help on using the repository browser.