Show
Ignore:
Timestamp:
05/10/11 13:10:46 (13 years ago)
Author:
sindj
Message:

Cele rozkopano a znovu poskladano za ucelem spravne integrace a nic - jen se mi podarilo doplnit faktor 1/2n. Sakris. JS

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/robust/robustlib.h

    r1362 r1365  
    10631063        /// A default constructor creates an emlig with predefined statistic representing only the range of the given 
    10641064        /// 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) 
    10661066        {        
    10671067                this->number_of_parameters = number_of_parameters; 
    10681068 
    10691069                condition_order = number_of_parameters+2; 
    1070  
    1071                 if(is_proper) 
    1072                         condition_order++; 
    1073                  
     1070                                                 
    10741071                create_statistic(number_of_parameters, soft_prior_parameter); 
    10751072 
     
    10781075                min_ll = numeric_limits<double>::max();          
    10791076 
    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; 
    10881084                                 
    1089                                 set<simplex*>::iterator cur_simplex = cur_toprow->triangulation.begin(); 
    1090                                 normalization_factor += cur_toprow->integrate_simplex(*cur_simplex,'X'); 
    1091                         } 
    1092  
    1093                         log_nc = log(normalization_factor) + logfact(condition_order-number_of_parameters-2); 
    1094  
    1095                         /* 
    1096                         cout << "part1: " << log(normalization_factor) << endl; 
    1097                         cout << "part2: " << logfact(condition_order-number_of_parameters-2) << endl; 
    1098                         pause(1); 
    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                 
    11011097 
    11021098        } 
     
    18841880                // cout << "Normalization factor: " << normalization_factor << endl;     
    18851881 
    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                /* 
    18891885                cout << "part1: " << log(normalization_factor) << endl; 
    18901886                cout << "part2: " << logfact(condition_order-number_of_parameters-2) << endl; 
    18911887                pause(1); 
     1888                */ 
    18921889                 
    18931890 
     
    26082605                                                vec2.ins(0,soft_prior_parameter); 
    26092606 
    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; 
    26162613 
    26172614 
     
    27912788                this->has_constant = has_constant; 
    27922789                 
    2793                 posterior = new emlig(number_of_parameters,true,0.001); 
     2790                posterior = new emlig(number_of_parameters,0.001); 
    27942791 
    27952792                this->window_size = window_size;