Revision 306

trunk/contrib/qfclib/test/testfunctionre.tpl (revision 306)
1
// testing for neg. log. likelihood functions defined in qfc_est.cpp file
2 1
GLOBALS_SECTION
3
  #include "qfc_sim.cpp"
4
  #include "qfc_est.cpp"
2
  #include "qfclib.h"
3
 
5 4
  
6 5

  
7 6

  
......
23 22

  
24 23
PROCEDURE_SECTION
25 24
  random_number_generator rnd(12345);
25
  cout<<ad_comm::adprogram_name<<endl;
26
  cout<<M_PI<<endl;
26 27

  
27 28
  dvector tmp1(1,4);
28 29
  tmp1.fill_randu(rnd);
29
  tmp2=9;
30
  cout<<tmp1<<endl;
31
  cout<<tmp<<endl; //don't know why the random effect variable not being initialized here ???
32
  cout<<tmp2<<endl<<endl;
30
  tmp2=3;
31
  cout<<tmp1<<endl<<tmp<<endl<<tmp2<<endl<<endl;
33 32

  
34
  dvector obs(1,4); obs.fill("{12, 3, 5,20}");
33
  dvector obs(1,4); obs.fill("{12, 33, 15,20}");
35 34

  
36
  cout<<nllNegativeBinomial(1.2,3,junk)<<endl;
37
  cout<<nllNegativeBinomial(tmp2(1),tmp2(2),3)<<endl;
35
  cout<<nllNegativeBinomial(junk,1.2,3)<<endl;
36
  cout<<nllNegativeBinomial(3,tmp2(1),tmp2(2))<<endl;
38 37

  
39
  cout<<nllMultiNomial(tmp1,obs)<<endl;
38
  cout<<nllMultiNomial(obs,tmp1)<<endl;
40 39

  
41
  cout<<nllGamma(tmp2(1),tmp2(2),obs)<<endl;
40
  cout<<nllGamma(obs,tmp2(1),tmp2(2))<<endl;
42 41

  
43
  cout<<nllInverseGamma(2.2,2.2,tmp2)<<endl;
44
  cout<<nllInverseGamma(junk,junk,tmp2)<<endl;
42
  cout<<nllInverseGamma(tmp2,2.2,2.2)<<endl;
43
  cout<<nllInverseGamma(tmp2,junk,junk)<<endl;
45 44

  
46 45
  cout<<nllPoisson(junk,junk)<<endl;
47
  cout<<nllPoisson(tmp1(1),junk)<<endl;
46
  cout<<nllPoisson(junk,tmp1(1))<<endl;
48 47

  
49
  cout<<nllLognormal2(junk,junk,tmp2)<<endl;
50
  cout<<nllLognormal(junk,junk,tmp2)<<endl;
48
  cout<<nllLognormal2(tmp2,junk,tmp1(3))<<endl;
49
  cout<<nllLognormal(tmp2,junk,junk)<<endl;
51 50

  
52
  cout<<nllBinomial(tmp2(1),tmp1(4),junk)<<endl;
53
  cout<<nllBinomial(tmp2,tmp1(3),tmp2)<<endl;
51
  cout<<nllBinomial(junk,obs(1),tmp1(4))<<endl;
52
  cout<<nllBinomial(tmp2,obs(1,3),tmp1(1))<<endl;
54 53

  
55
  exit(0);
54
  exit(88);
55
 
56

  
trunk/contrib/qfclib/test/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;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff