Changeset 1266
- Timestamp:
- 12/16/10 18:07:35 (14 years ago)
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/robust/main.cpp
r1254 r1266 16 16 17 17 emlig* emlig1 = new emlig(3); 18 19 emlig1->set_correction_factors(3); 18 20 19 21 //emlig1->step_me(0); -
applications/robust/robustlib.h
r1262 r1266 415 415 class emlig // : eEF 416 416 { 417 vector<set<ivec>> correction_factors;417 418 418 419 419 /// A statistic in a form of a Hasse diagram representing a complex of convex polyhedrons obtained as a result … … 628 628 public: 629 629 630 vector<set<ivec>> correction_factors; 631 630 632 int number_of_parameters; 631 633 … … 924 926 } 925 927 926 vector<list<ivec>> get_correction_factors(int order) 928 929 void set_correction_factors(int order) 927 930 { 928 931 for(int remaining_order = correction_factors.size();remaining_order>order;remaining_order++) … … 931 934 set<ivec> final_factors; 932 935 936 933 937 for(int i = 1;i==number_of_parameters-order+1;i++) 934 { 935 for(int j = 1;j==remaining_order;j++) 936 { 937 factor_templates.insert(zeros(number_of_parameters-order+2)); 938 938 { 939 ivec new_template = vec_2(1,i); 940 //new_template[0]=1; 941 //new_template[1]=i; 942 //factor_templates.insert(new_template); 943 944 945 for(int j = 1;j==remaining_order-1;j++) 946 { 947 939 948 for(set<ivec>::iterator fac_ref = factor_templates.begin();fac_ref!=factor_templates.end();fac_ref++) 940 949 { 941 950 ivec current_template = (*fac_ref); 942 951 943 952 current_template[0]+=1; 944 current_template[i]+=1; 945 953 current_template.ins(current_template.size(),i); 954 955 946 956 if(current_template[0]==remaining_order) 947 957 { 948 final_factors.insert(current_template.right(current_template.size()-1) ;958 final_factors.insert(current_template.right(current_template.size()-1)); 949 959 } 950 960 else … … 952 962 factor_templates.insert(current_template); 953 963 } 954 } 964 } 955 965 } 956 966 } 957 967 958 correction_factors.push_back(final_factors); 968 correction_factors.push_back(final_factors); 959 969 960 970 } … … 1276 1286 };*/ 1277 1287 1278 1288 bool ivec::operator>(const ivec &first, const ivec &second) 1289 { 1290 int size1 = first.size(); 1291 int size2 = second.size(); 1292 1293 int counter1 = 0; 1294 while(0==0) 1295 { 1296 if(first[counter1]==0) 1297 { 1298 size1--; 1299 } 1300 1301 if(first[counter1]!=0) 1302 break; 1303 } 1304 1305 int counter2 = 0; 1306 while(0==0) 1307 { 1308 if(second[counter2]==0) 1309 { 1310 size2--; 1311 } 1312 1313 if(second[counter2]!=0) 1314 break; 1315 } 1316 1317 if(size1!=size2) 1318 { 1319 return size1>size2; 1320 } 1321 else 1322 { 1323 for(int i = 0;i<size1;i++) 1324 { 1325 if(first[counter1+i]!=second[counter2+i]) 1326 { 1327 return first[counter1+i]>second[counter2+i] 1328 } 1329 } 1330 1331 return false; 1332 } 1333 } 1279 1334 1280 1335 -
applications/trading_models/trading_models_lib.cpp
r1260 r1266 1 #include " example_lib.h"1 #include "trading_models_lib.h" 2 2 -
applications/trading_models/trading_models_main.cpp
r1260 r1266 7 7 */ 8 8 9 #include "example_lib.h" 9 #include "trading_models_lib.h" 10 #include "estim/arx.h" 11 using namespace bdm; 10 12 11 using namespace bdm; 13 12 14 13 15 int main ( int argc, char* argv[] ) { 14 16 15 my_pdf mp; 16 return 0; 17 for(int i=0;i<10000;i++) 18 { 19 cout << i; 20 } 21 //prior 22 mat V0 = 0.00001 * eye ( 2 ); 23 V0 ( 0, 0 ) = 0.1; // 24 ARX Ar; 25 Ar.set_statistics ( 1, V0 ); //nu is default (set to have finite moments) 26 Ar.set_constant ( true ); 27 Ar.validate(); 28 // forgetting is default: 1.0 29 mat Data = concat_vertical ( randn ( 1, 100 ), ones ( 1, 100 ) ); 30 Ar.bayes_batch ( Data ); 31 32 17 33 } 18 34 -
library/bdm/estim/arx.h
r1192 r1266 61 61 ARX ( const ARX &A0 ) : BMEF ( A0 ), have_constant ( A0.have_constant ), dyad ( A0.dyad ),rgrlen(A0.rgrlen), est ( A0.est ), alter_est ( A0.alter_est ) { }; 62 62 63 ARX* _copy() const; 63 ARX* _copy() const; 64 64 65 65 void set_frg ( double frg0 ) {