Revision 306 trunk/contrib/qfclib/test/testfunction.tpl

testfunction.tpl (revision 306)
1 1
GLOBALS_SECTION
2
  #include "qfc_sim.cpp"
3
  #include "qfc_est.cpp"
2
  #include "qfclib.h"
4 3

  
5 4

  
6 5
DATA_SECTION
......
12 11
 //random_effects_vector tmp(1,3)
13 12
 objective_function_value nll
14 13

  
15
PRELIMINARY_CALCS_SECTION  
14
PRELIMINARY_CALCS_SECTION
15

  
16 16
  //following are testing for functions defined in qfc_sim.cpp file
17 17
  //================================================================
18 18
  random_number_generator rnd(12345);
......
25 25
  }
26 26

  
27 27
  cout<<endl<<"found all values for mu parameter from std file"<<endl;
28
  cout << __FILE__ << ':' << __LINE__ << endl;
29 28
  //cout<<findValFromFile("test1.std","mu",2)<<endl;//change filename if needed
30
  cout << __FILE__ << ':' << __LINE__ << endl;
31 29
  
32 30
 
33 31
  dvector v(1,10); 
......
37 35
  //cout<<"unique vlaues "<<endl<<v(unique(v))<<endl<<endl;
38 36

  
39 37

  
40
  cout << __FILE__ << ':' << __LINE__ << endl;
41 38
  cout<<"convert vector to matrix by row"<<endl<<vector2matrix(v,2,5)<<endl;  
42 39
  dmatrix m=vector2matrix(v,2,5);
43 40
  cout<<"convert matrix to vector by row"<<endl<< matrix2vector(m)<<endl<<endl;
44
  cout << __FILE__ << ':' << __LINE__ << endl;
45 41

  
46 42
  ivector idx=sample(v,5,1,rnd); //random sample size 5 from v with replacement
47 43
  cout<<"random sample index "<<endl<<idx<<endl;
48 44
  cout<<"actual random sample value"<<endl<<v(idx)<<endl<<endl;
49
  cout << __FILE__ << ':' << __LINE__ << endl;
50 45

  
51 46
  
52 47

  
53 48
PROCEDURE_SECTION
54
  ///*
55 49
  //following are testing for functions defined in qfc_est.cpp file
56 50
  //================================================================
57 51
  junk.fill("{1.2, 3, 5}");
......
67 61
  cout<<"old value "<<junk<<endl<<"new value "<<dv<<endl<<"penalty = "<<fpen<<endl;
68 62

  
69 63
  dvector obs(1,4); obs.fill("{12, 3, 5,20}");
70
  cout<<nllNegativeBinomial(1.2,3,junk(2))<<" "<<nllNegativeBinomial(junk(1),junk(2),3)<<endl;
71
  cout<<nllMultiNomial(dp,obs)<<endl;
72
  cout<<nllPoisson(dp(1),obs(1))<<endl;
73
  cout<<nllLognormal(junk(1),junk(2),obs)<<endl;
74
  cout<<nllGamma(junk(1),junk(2),obs)<<endl;
75
  //*/
76
  exit(0);
64
  cout<<nllNegativeBinomial(junk(2),1.2,3)<<" "<<nllNegativeBinomial(3,junk(1),junk(2))<<endl;
65
  cout<<nllMultiNomial(obs,dp)<<endl;
66
  cout<<nllPoisson(obs(1),dp(1))<<endl;
67
  cout<<nllLognormal(obs,junk(1),junk(2))<<endl;
68
  cout<<nllGamma(obs,junk(1),junk(2))<<endl;
77 69

  
70
  exit(8);

Also available in: Unified diff