source: trunk/test/regression_linear_test.cc @ 301

Last change on this file since 301 was 301, checked in by Peter, 17 years ago

modified includes in tests

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