Changeset 1365 for applications/robust/robustlib.h
- Timestamp:
- 05/10/11 13:10:46 (13 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/robust/robustlib.h
r1362 r1365 1063 1063 /// A default constructor creates an emlig with predefined statistic representing only the range of the given 1064 1064 /// parametric space, where the number of parameters of the needed model is given as a parameter to the constructor. 1065 emlig(int number_of_parameters, bool is_proper,double soft_prior_parameter)1065 emlig(int number_of_parameters, double soft_prior_parameter) 1066 1066 { 1067 1067 this->number_of_parameters = number_of_parameters; 1068 1068 1069 1069 condition_order = number_of_parameters+2; 1070 1071 if(is_proper) 1072 condition_order++; 1073 1070 1074 1071 create_statistic(number_of_parameters, soft_prior_parameter); 1075 1072 … … 1078 1075 min_ll = numeric_limits<double>::max(); 1079 1076 1080 if(is_proper) 1081 { 1082 double normalization_factor = 0; 1083 int counter = 0; 1084 for(polyhedron* top_ref = statistic.rows[number_of_parameters];top_ref!=statistic.get_end();top_ref=top_ref->next_poly) 1085 { 1086 counter++; 1087 toprow* cur_toprow = (toprow*)top_ref; 1077 1078 double normalization_factor = 0; 1079 int counter = 0; 1080 for(polyhedron* top_ref = statistic.rows[number_of_parameters];top_ref!=statistic.get_end();top_ref=top_ref->next_poly) 1081 { 1082 counter++; 1083 toprow* cur_toprow = (toprow*)top_ref; 1088 1084 1089 1090 1091 1092 1093 log_nc = log(normalization_factor) + logfact(condition_order-number_of_parameters-2);1094 1095 1096 1097 1098 1099 1100 }1085 set<simplex*>::iterator cur_simplex = cur_toprow->triangulation.begin(); 1086 normalization_factor += cur_toprow->integrate_simplex(*cur_simplex,'X'); 1087 } 1088 1089 log_nc = log(normalization_factor) + logfact(condition_order-number_of_parameters-2)-(condition_order-number_of_parameters-2)*2; 1090 1091 /* 1092 cout << "part1: " << log(normalization_factor) << endl; 1093 cout << "part2: " << logfact(condition_order-number_of_parameters-2) << endl; 1094 pause(1); 1095 */ 1096 1101 1097 1102 1098 } … … 1884 1880 // cout << "Normalization factor: " << normalization_factor << endl; 1885 1881 1886 log_nc = log(normalization_factor) + logfact(condition_order-number_of_parameters-2) ;1887 1888 1882 log_nc = log(normalization_factor) + logfact(condition_order-number_of_parameters-2)-(condition_order-number_of_parameters-2)*2; 1883 1884 /* 1889 1885 cout << "part1: " << log(normalization_factor) << endl; 1890 1886 cout << "part2: " << logfact(condition_order-number_of_parameters-2) << endl; 1891 1887 pause(1); 1888 */ 1892 1889 1893 1890 … … 2608 2605 vec2.ins(0,soft_prior_parameter); 2609 2606 2610 vec1.ins(0, -1);2611 vec2.ins(0, -1);2612 } 2613 2614 cout << vec1 << endl;2615 cout << vec2 << endl;2607 vec1.ins(0,0); 2608 vec2.ins(0,0); 2609 } 2610 2611 // cout << vec1 << endl; 2612 // cout << vec2 << endl; 2616 2613 2617 2614 … … 2791 2788 this->has_constant = has_constant; 2792 2789 2793 posterior = new emlig(number_of_parameters, true,0.001);2790 posterior = new emlig(number_of_parameters,0.001); 2794 2791 2795 2792 this->window_size = window_size;