Index: /applications/robust/main.cpp
===================================================================
--- /applications/robust/main.cpp (revision 1367)
+++ /applications/robust/main.cpp (revision 1370)
@@ -16,4 +16,5 @@
 #include "ddeml.h"
 #include "stdio.h"
+#include <time.h>
 
 //#include "DDEClient.h"
@@ -28,19 +29,43 @@
 
 const int max_model_order = 2;
-
-
-/*
+const int data_count      = 5;
+
+static vec avg_vec;
+
 HDDEDATA CALLBACK DdeCallback(
-	UINT uType,     // Transaction type.
-	UINT uFmt,      // Clipboard data format.
-	HCONV hconv,    // Handle to the conversation.
-	HSZ hsz1,       // Handle to a string.
-	HSZ hsz2,       // Handle to a string.
-	HDDEDATA hdata, // Handle to a global memory object.
-	DWORD dwData1,  // Transaction-specific data.
-	DWORD dwData2)  // Transaction-specific data.
+UINT uType,     // Transaction type.
+UINT uFmt,      // Clipboard data format.
+HCONV hconv,    // Handle to the conversation.
+HSZ hsz1,       // Handle to a string.
+HSZ hsz2,       // Handle to a string.
+HDDEDATA hdata, // Handle to a global memory object.
+DWORD dwData1,  // Transaction-specific data.
+DWORD dwData2)  // Transaction-specific data.
 {
-	return 0;
+	char  * pData;
+	DWORD   data_len;
+	
+	switch (uType)
+	{     
+	case XTYP_ADVDATA: 
+
+		if ( hdata == NULL )
+			cout << "No data in the message." << endl;
+		else
+		{
+			pData = (char*)DdeAccessData( hdata, &data_len );
+						
+			avg_vec.ins(0,atof(pData));
+			
+			cout << pData << endl;
+
+			DdeUnaccessData( hdata );
+		}
+	}		
+	return (HDDEDATA) NULL; 
+
 }
+
+
 
 void DDERequest(DWORD idInst, HCONV hConv, char* szItem)
@@ -64,5 +89,5 @@
     return 0;
 }
-*/
+
 
 class model
@@ -77,6 +102,10 @@
 
 	bool has_constant;
+	int  order;
 	int  window_size;
 	int  predicted_channel;
+	int  number_of_updates;
+	double prior_lognc;
+	vec  lognc_history;
 	mat* data_matrix;
 	
@@ -85,12 +114,22 @@
 		  bool has_constant, 
 		  int window_size, 
-		  int predicted_channel,
+		  int predicted_channel,		  
 		  mat* data_matrix)
 	{
 		this->ar_components.insert(this->ar_components.begin(),ar_components.begin(),ar_components.end());
-		this->has_constant      = has_constant;
-		this->window_size       = window_size;
-		this->predicted_channel = predicted_channel;
-		this->data_matrix       = data_matrix;
+		this->has_constant        = has_constant;
+		this->window_size         = window_size;
+		this->predicted_channel   = predicted_channel;		
+		this->data_matrix         = data_matrix;
+		number_of_updates = 0;
+
+		order = 0;
+		for(list<pair<int,int>>::iterator ar_ref = ar_components.begin();ar_ref!=ar_components.end();ar_ref++)
+		{
+			if((*ar_ref).second > order)
+			{
+				order = (*ar_ref).second;
+			}
+		}
 
 		if(robust)
@@ -106,4 +145,6 @@
 				my_arx  = NULL;
 			}
+
+			prior_lognc = my_rarx->posterior->log_nc;
 		}
 		else
@@ -116,5 +157,5 @@
 			{				
 				V0  = 0.001 * eye(ar_components.size()+2);
-				V0(0,0) = 0;
+				V0(0,0) = 1;
 				my_arx->set_constant(true);	
 				
@@ -124,5 +165,5 @@
 				
 				V0  = 0.001 * eye(ar_components.size()+1);
-				V0(0,0) = 0;
+				V0(0,0) = 1;
 				my_arx->set_constant(false);				
 				
@@ -132,4 +173,6 @@
 			my_arx->set_parameters(window_size);
 			my_arx->validate();
+
+			prior_lognc = my_arx->posterior().lognc();
 		}
 	}
@@ -137,20 +180,39 @@
 	void data_update(int time)
 	{
-		vec data_vector;
-		for(list<pair<int,int>>::iterator ar_iterator = ar_components.begin();ar_iterator!=ar_components.end();ar_iterator++)
-		{
-			data_vector.ins(data_vector.size(),(*data_matrix).get(ar_iterator->first,time-ar_iterator->second));
-		}
-
-		if(my_rarx!=NULL)
-		{
-			data_vector.ins(0,(*data_matrix).get(predicted_channel,time));
-			my_rarx->bayes(data_vector);
+		if(time > order)
+		{
+			vec data_vector;
+			for(list<pair<int,int>>::iterator ar_iterator = ar_components.begin();ar_iterator!=ar_components.end();ar_iterator++)
+			{
+				data_vector.ins(data_vector.size(),(*data_matrix).get(ar_iterator->first,time-ar_iterator->second));
+			}
+
+			// cout << "Update cond: " << data_vector << endl;
+
+			double cur_lognc;
+			if(my_rarx!=NULL)
+			{
+				data_vector.ins(0,(*data_matrix).get(predicted_channel,time));
+				my_rarx->bayes(data_vector);
+				cur_lognc = my_rarx->posterior->log_nc;
+			}
+			else
+			{
+				vec pred_vec;
+				pred_vec.ins(0,(*data_matrix).get(predicted_channel,time));
+				my_arx->bayes(pred_vec,data_vector);
+				cur_lognc = my_arx->posterior().lognc();
+			}
+
+			number_of_updates++;
+
+			if(number_of_updates>window_size)
+			{
+				lognc_history.ins(lognc_history.size(),cur_lognc-prior_lognc);
+			}
 		}
 		else
 		{
-			vec pred_vec;
-			pred_vec.ins(0,(*data_matrix).get(predicted_channel,time));
-			my_arx->bayes(pred_vec,data_vector);
+			lognc_history.ins(lognc_history.size(),0);
 		}
 	}
@@ -158,53 +220,67 @@
 	pair<vec,vec> predict(int sample_size, int time, itpp::Laplace_RNG* LapRNG)
 	{
-		vec condition_vector;
-		for(list<pair<int,int>>::iterator ar_iterator = ar_components.begin();ar_iterator!=ar_components.end();ar_iterator++)
-		{
-			condition_vector.ins(condition_vector.size(),(*data_matrix).get(ar_iterator->first,time-ar_iterator->second+1));
-		}
-
-		if(my_rarx!=NULL)
-		{
-			pair<vec,mat> imp_samples = my_rarx->posterior->importance_sample(sample_size);
-
-			//cout << imp_samples.first << endl;
+		if(time > order)
+		{
+			vec condition_vector;
+			for(list<pair<int,int>>::iterator ar_iterator = ar_components.begin();ar_iterator!=ar_components.end();ar_iterator++)
+			{
+				condition_vector.ins(condition_vector.size(),(*data_matrix).get(ar_iterator->first,time-ar_iterator->second+1));
+			}
+
+			// cout << "Prediction cond: " << condition_vector << endl;
+
+			if(my_rarx!=NULL)
+			{
+				pair<vec,mat> imp_samples = my_rarx->posterior->importance_sample(sample_size);
+
+				//cout << "Point estimate: " << (imp_samples.second*imp_samples.first)/(imp_samples.first*ones(imp_samples.first.size())) << endl;
+				
+				vec sample_prediction;			
+				for(int t = 0;t<sample_size;t++)
+				{
+					vec lap_sample = condition_vector;
+					
+					if(has_constant)
+					{
+						lap_sample.ins(lap_sample.size(),1.0);
+					}
+					
+					lap_sample.ins(0,(*LapRNG)());
+
+					sample_prediction.ins(0,lap_sample*imp_samples.second.get_col(t));				
+				}
+
+				return pair<vec,vec>(imp_samples.first,sample_prediction);
+			}
+			else
+			{
+				mat samples = my_arx->posterior().sample_mat(sample_size);
+
+				//cout << "Point estimate: " << (samples*ones(samples.cols()))/samples.cols() << endl;
+
+				// cout << samples.get_col(1) << endl;
+				
+				vec sample_prediction;
+				for(int t = 0;t<sample_size;t++)
+				{
+					vec gau_sample = condition_vector;
+					
+					if(has_constant)
+					{
+						gau_sample.ins(gau_sample.size(),1.0);
+					}
+					
+					gau_sample.ins(gau_sample.size(),randn());
+
+					sample_prediction.ins(0,gau_sample*samples.get_col(t));				
+				}
+
+				return pair<vec,vec>(ones(sample_prediction.size()),sample_prediction);
+			}
+		}
+		else
+		{
 			
-			vec sample_prediction;			
-			for(int t = 0;t<sample_size;t++)
-			{
-				vec lap_sample = condition_vector;
-				
-				if(has_constant)
-				{
-					lap_sample.ins(lap_sample.size(),1.0);
-				}
-				
-				lap_sample.ins(0,(*LapRNG)());
-
-				sample_prediction.ins(0,lap_sample*imp_samples.second.get_col(t));				
-			}
-
-			return pair<vec,vec>(imp_samples.first,sample_prediction);
-		}
-		else
-		{
-			mat samples = my_arx->posterior().sample_mat(sample_size);
-			
-			vec sample_prediction;
-			for(int t = 0;t<sample_size;t++)
-			{
-				vec gau_sample = condition_vector;
-				
-				if(has_constant)
-				{
-					gau_sample.ins(gau_sample.size(),1.0);
-				}
-				
-				gau_sample.ins(0,randn());
-
-				sample_prediction.ins(0,gau_sample*samples.get_col(t));				
-			}
-
-			return pair<vec,vec>(ones(sample_prediction.size()),sample_prediction);
+			return pair<vec,vec>(zeros(1),ones(1));
 		}
 	
@@ -261,11 +337,49 @@
 
 
+
+
+
 int main ( int argc, char* argv[] ) {	
 	
+	vec data_vec;
+	mat data_matrix;
+	DWORD Id;
+
+	char  szApp[]   = "MT4";
+	char  szTopic[] = "BID";	
+	char  szItem[]  = "EURUSD";
+	char* itRef     = &szItem[0];
+
+	char* file_string = "c:\\rtdata";
+
+	ofstream myfile;
+	char fstring[80];					
+	strcpy(fstring,file_string);
+	strcat(fstring,itRef);
+	strcat(fstring,"lognc.txt");
+
+	list<list<pair<int,int>>> model_types = model::possible_models_recurse(max_model_order,1);
+	
+	int max_window = 50;
+	int min_window = 1;
+
+	list<model*> models;
+	for(list<list<pair<int,int>>>::iterator model_type = model_types.begin();model_type!=model_types.end();model_type++)
+	{
+		for(int window_size = min_window;window_size < max_window;window_size++)
+		{			
+			//models.push_back(new model((*model_type),true,true,window_size,0,&data_matrix));
+			models.push_back(new model((*model_type),false,true,window_size,0,&data_matrix));			
+			//models.push_back(new model((*model_type),true,false,window_size,0,&data_matrix));
+			//models.push_back(new model((*model_type),false,false,window_size,0,&data_matrix));			
+		}
+	}
+	
+	mat result_lognc;
+	mat result_preds;
+	
 	/*
-	DWORD Id;
 	HANDLE hThrd = CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)ThrdFunc, (LPVOID)1, 0, &Id);
-  
-	if ( !hThrd )
+  	if ( !hThrd )
     {
         cout<<"Error Creating Threads,,,,.exiting"<<endl;
@@ -273,12 +387,10 @@
     }
     Sleep ( 100 );
-
-	
-	char szApp[] = "MT4";
-	char szTopic[] = "QUOTE";	
-	char szItem1[] = "EURUSD";  	
+	*/
+	
+	 	
 
 	//DDE Initialization
-	DWORD idInst=0;
+	DWORD idInst = 0;
 	UINT iReturn;
 	iReturn = DdeInitialize(&idInst, (PFNCALLBACK)DdeCallback, 
@@ -308,220 +420,228 @@
 	//Execute commands/requests specific to the DDE Server.
 	
-	DDERequest(idInst, hConv, szItem1); 		
-	
+	DDERequest(idInst, hConv, szItem); 		
+	
+	itpp::Laplace_RNG LapRNG = Laplace_RNG();
+
+	// time_t current_time = time(0);	
+
 	while(1)
 	{
-		MSG    msg;
-		BOOL   MsgReturn = GetMessage ( &msg , NULL , 0 , 0 );
-            
-		if(MsgReturn)
-		{
-			TranslateMessage(&msg);
-			DispatchMessage(&msg);			
-		}
-	}
-
+		while(avg_vec.size() < data_count)
+		{
+			MSG    msg;
+			BOOL   MsgReturn = GetMessage ( &msg , NULL , 0 , 0 );
+	            
+			if(MsgReturn)
+			{
+				TranslateMessage(&msg);
+				DispatchMessage(&msg);			
+			}
+			Sleep(500);
+		}
+
+
+		data_vec.ins(data_vec.size(),avg_vec*ones(avg_vec.size())/avg_vec.size());
+		data_matrix = mat(data_vec).T();
+		avg_vec.del(0,avg_vec.size()-1);				
+					
+		vector<double> test_lognc;
+		vec preds;
+
+		for(list<model*>::iterator model_ref = models.begin();model_ref!=models.end();model_ref++)
+		{
+			(*model_ref)->data_update(data_vec.size()-1);			
+
+			if((*model_ref)->lognc_history.size()==0)
+			{
+				test_lognc.push_back(0);
+			}
+			else
+			{
+				test_lognc.push_back((ones((*model_ref)->lognc_history.size())*(*model_ref)->lognc_history)/(*model_ref)->lognc_history.size()*(max_window/(*model_ref)->window_size));	
+			}
+
+			pair<vec,vec> predictions = (*model_ref)->predict(500,data_vec.size()-1,&LapRNG);
+
+			preds.ins(preds.size(),(predictions.first*predictions.second)/(predictions.first*ones(predictions.first.size())));
+			
+		}
+
+		//preds.ins(0,data_matrix.get(0,data_vec.size()));	
+		
+		result_preds.ins_col(result_preds.cols(),preds);							
+
+		myfile.open(fstring,ios::app);
+		
+		// myfile << my_rarx->posterior->minimal_vertex->get_coordinates()[0];
+		
+		for(int i = 0;i<test_lognc.size();i++)
+		{
+			myfile << test_lognc[i] << ',';
+		}
+
+		myfile << endl;				
+		
+		myfile.close();
+		
+	}
+	
 	//DDE Disconnect and Uninitialize.
 	DdeDisconnect(hConv);
 	DdeUninitialize(idInst);
-	*/
-
-	
-
-	/*
-	// EXPERIMENT: 100 AR model generated time series of length of 30 from y_t=0.95*y_(t-1)+0.05*y_(t-2)+0.2*e_t, 
-	// where e_t is normally, student(4) and cauchy distributed are tested using robust AR model, to obtain the 
-	// variance of location parameter estimators and compare it to the classical setup.
-	vector<vector<vector<string>>> string_lists;
-	string_lists.push_back(vector<vector<string>>());
-	string_lists.push_back(vector<vector<string>>());
-	string_lists.push_back(vector<vector<string>>());
-
-	char* file_strings[3] = {"c:\\ar_normal.txt", "c:\\ar_student.txt", "c:\\ar_cauchy.txt"};
-	
-
-	for(int i = 0;i<3;i++)
-	{	
-		ifstream myfile(file_strings[i]);
+
+	return 0;
+}
+
+		/*
+		// EXPERIMENT: A moving window estimation and prediction of RARX is tested on data generated from 
+		// y_t=0.95*y_(t-1)+0.05*y_(t-2)+0.2*e_t, where e_t is normally, student(4) and cauchy distributed. It
+		// can be compared to the classical setup.
+		
+		vector<vector<string>> strings;
+
+		char* file_string = "c:\\dataGCClosePercDiff"; 
+
+		char dfstring[80];
+		strcpy(dfstring,file_string);
+		strcat(dfstring,".txt");
+			
+		
+		mat data_matrix;
+		ifstream myfile(dfstring);
 		if (myfile.is_open())
-		{
-			while ( myfile.good() )
-			{
-				string line;
-				getline(myfile,line);
-				
-				vector<string> parsed_line;
+		{		
+			string line;
+			while(getline(myfile,line))
+			{			
+				vec data_vector;
 				while(line.find(',') != string::npos)
 				{
-					int loc = line.find(',');
-					parsed_line.push_back(line.substr(0,loc));
+					int loc2 = line.find('\n');
+					int loc  = line.find(',');
+					data_vector.ins(data_vector.size(),atof(line.substr(0,loc).c_str()));				
 					line.erase(0,loc+1);					
-				}				
-
-				string_lists[i].push_back(parsed_line);
-			}
-			myfile.close();
-		}
-	}
-
-	for(int j = 0;j<string_lists.size();j++)
-	{ 
-		
-		for(int i = 0;i<string_lists[j].size()-1;i++)
-		{
-			vector<vec> conditions;
-			//emlig* emliga = new emlig(2);
-			RARX* my_rarx = new RARX(2,30);
-
-			for(int k = 1;k<string_lists[j][i].size();k++)
-			{
-				vec condition;
-				//condition.ins(0,1);				
-				condition.ins(0,string_lists[j][i][k]);				
-				conditions.push_back(condition);
-
-				//cout << "orig:" << condition << endl;
-
-				if(conditions.size()>1)
-				{		
-					conditions[k-2].ins(0,string_lists[j][i][k]);
-					
 				}
 
-				if(conditions.size()>2)
+				data_matrix.ins_row(data_matrix.rows(),data_vector);
+			}		
+
+			myfile.close();	
+		}
+		else
+		{
+			cout << "Can't open data file!" << endl;
+		}
+		*/
+		
+		
+		// cout << "Updated." << endl;
+	
+		/*
+		// EXPERIMENT: 100 AR model generated time series of length of 30 from y_t=0.95*y_(t-1)+0.05*y_(t-2)+0.2*e_t, 
+		// where e_t is normally, student(4) and cauchy distributed are tested using robust AR model, to obtain the 
+		// variance of location parameter estimators and compare it to the classical setup.
+		vector<vector<vector<string>>> string_lists;
+		string_lists.push_back(vector<vector<string>>());
+		string_lists.push_back(vector<vector<string>>());
+		string_lists.push_back(vector<vector<string>>());
+
+		char* file_strings[3] = {"c:\\ar_normal.txt", "c:\\ar_student.txt", "c:\\ar_cauchy.txt"};
+		
+
+		for(int i = 0;i<3;i++)
+		{	
+			ifstream myfile(file_strings[i]);
+			if (myfile.is_open())
+			{
+				while ( myfile.good() )
 				{
-					conditions[k-3].ins(0,string_lists[j][i][k]);
-
-					//cout << "modi:" << conditions[k-3] << endl;
-
-					my_rarx->bayes(conditions[k-3]);
-
-					
-					//if(k>5)
-					//{
-					//	cout << "MaxLik coords:" << emliga->minimal_vertex->get_coordinates() << endl;
-					//}
-					
-				}				
+					string line;
+					getline(myfile,line);
+					
+					vector<string> parsed_line;
+					while(line.find(',') != string::npos)
+					{
+						int loc = line.find(',');
+						parsed_line.push_back(line.substr(0,loc));
+						line.erase(0,loc+1);					
+					}				
+
+					string_lists[i].push_back(parsed_line);
+				}
+				myfile.close();
+			}
+		}
+
+		for(int j = 0;j<string_lists.size();j++)
+		{ 
+			
+			for(int i = 0;i<string_lists[j].size()-1;i++)
+			{
+				vector<vec> conditions;
+				//emlig* emliga = new emlig(2);
+				RARX* my_rarx = new RARX(2,30);
+
+				for(int k = 1;k<string_lists[j][i].size();k++)
+				{
+					vec condition;
+					//condition.ins(0,1);				
+					condition.ins(0,string_lists[j][i][k]);				
+					conditions.push_back(condition);
+
+					//cout << "orig:" << condition << endl;
+
+					if(conditions.size()>1)
+					{		
+						conditions[k-2].ins(0,string_lists[j][i][k]);
+						
+					}
+
+					if(conditions.size()>2)
+					{
+						conditions[k-3].ins(0,string_lists[j][i][k]);
+
+						//cout << "modi:" << conditions[k-3] << endl;
+
+						my_rarx->bayes(conditions[k-3]);
+
+						
+						//if(k>5)
+						//{
+						//	cout << "MaxLik coords:" << emliga->minimal_vertex->get_coordinates() << endl;
+						//}
+						
+					}				
+					
+				}
+
+				//emliga->step_me(0);
+				/*
+				ofstream myfile;
+				myfile.open("c:\\robust_ar1.txt",ios::app);
+				myfile << my_rarx->minimal_vertex->get_coordinates()[0] << ";";
+				myfile.close();
+
+				myfile.open("c:\\robust_ar2.txt",ios::app);
+				myfile << emliga->minimal_vertex->get_coordinates()[1] << ";";
+				myfile.close();
 				
-			}
-
-			//emliga->step_me(0);
-			/*
+
+				cout << "MaxLik coords:" << emliga->minimal_vertex->get_coordinates() << endl;
+				cout << "Step: " << i << endl;
+			}
+
+			cout << "One experiment finished." << endl;
+
 			ofstream myfile;
 			myfile.open("c:\\robust_ar1.txt",ios::app);
-			myfile << my_rarx->minimal_vertex->get_coordinates()[0] << ";";
+			myfile << endl;
 			myfile.close();
 
 			myfile.open("c:\\robust_ar2.txt",ios::app);
-			myfile << emliga->minimal_vertex->get_coordinates()[1] << ";";
+			myfile << endl;
 			myfile.close();
-			
-
-			cout << "MaxLik coords:" << emliga->minimal_vertex->get_coordinates() << endl;
-			cout << "Step: " << i << endl;
-		}
-
-		cout << "One experiment finished." << endl;
-
-		ofstream myfile;
-		myfile.open("c:\\robust_ar1.txt",ios::app);
-		myfile << endl;
-		myfile.close();
-
-		myfile.open("c:\\robust_ar2.txt",ios::app);
-		myfile << endl;
-		myfile.close();
-	}*/    
-	
-	// EXPERIMENT: A moving window estimation and prediction of RARX is tested on data generated from 
-    // y_t=0.95*y_(t-1)+0.05*y_(t-2)+0.2*e_t, where e_t is normally, student(4) and cauchy distributed. It
-    // can be compared to the classical setup.
-	
-	itpp::Laplace_RNG LapRNG = Laplace_RNG();	
-
-	vector<vector<string>> strings;
-
-	char* file_string = "c:\\dataADClosePercDiff"; 
-
-	char dfstring[80];
-	strcpy(dfstring,file_string);
-	strcat(dfstring,".txt");
-		
-	
-	mat data_matrix;
-	ifstream myfile(dfstring);
-	if (myfile.is_open())
-	{		
-		string line;
-		while(getline(myfile,line))
-		{			
-			vec data_vector;
-			while(line.find(',') != string::npos)
-			{
-				int loc2 = line.find('\n');
-				int loc  = line.find(',');
-				data_vector.ins(data_vector.size(),atof(line.substr(0,loc).c_str()));				
-				line.erase(0,loc+1);					
-			}
-
-			data_matrix.ins_row(data_matrix.rows(),data_vector);
-		}		
-
-		myfile.close();	
-	}
-	else
-	{
-		cout << "Can't open data file!" << endl;
-	}
-	
-
-	list<list<pair<int,int>>> model_types = model::possible_models_recurse(max_model_order,data_matrix.rows());
-	
-	list<model*> models;
-	for(list<list<pair<int,int>>>::iterator model_type = model_types.begin();model_type!=model_types.end();model_type++)
-	{
-		for(int window_size = 30;window_size < 31;window_size++)
-		{
-			models.push_back(new model((*model_type),true,true,window_size,0,&data_matrix));
-			models.push_back(new model((*model_type),false,true,window_size,0,&data_matrix));
-			models.push_back(new model((*model_type),true,false,window_size,0,&data_matrix));
-			models.push_back(new model((*model_type),false,false,window_size,0,&data_matrix));
-		}
-	}
-	
-	mat result_lognc;
-	mat result_preds;
-
-	for(int time = max_model_order;time<data_matrix.cols();time++) //time<data_matrix.cols()
-	{ 	
-		vec cur_res_lognc;
-		vec preds;
-
-		for(list<model*>::iterator model_ref = models.begin();model_ref!=models.end();model_ref++)
-		{
-			(*model_ref)->data_update(time);			
-
-			if((*model_ref)->my_rarx!=NULL)
-			{
-				cur_res_lognc.ins(cur_res_lognc.size(),(*model_ref)->my_rarx->posterior->log_nc);
-			}
-			else
-			{
-				cur_res_lognc.ins(cur_res_lognc.size(),(*model_ref)->my_arx->posterior().lognc());
-			}
-
-			pair<vec,vec> predictions = (*model_ref)->predict(500,time,&LapRNG);
-
-			preds.ins(preds.size(),(predictions.first*predictions.second)/(predictions.first*ones(predictions.first.size())));
-		}
-
-		preds.ins(0,data_matrix.get(0,time+1));
-
-		result_lognc.ins_col(result_lognc.cols(),cur_res_lognc);
-		result_preds.ins_col(result_preds.cols(),preds);
-
-		// cout << "Updated." << endl;
-	
+		}*/    
+
 		/*
 		vector<vec> conditions;
@@ -735,23 +855,5 @@
 
 					
-					ofstream myfile;
-					char fstring[80];					
-					strcpy(fstring,file_string);
-					
-					strcat(fstring,"preds.txt");					
-
-					myfile.open(fstring,ios::app);
-					
-					// myfile << my_rarx->posterior->minimal_vertex->get_coordinates()[0];
-					
-					for(int i = 0;i<preds.size();i++)
-					{
-						myfile << preds[i] << ',';
-					}
-
-					myfile << endl;				
-					
-					myfile.close();
-			}
+					
 					/*
 					myfile.open(f2string,ios::app);
@@ -958,7 +1060,5 @@
 	*/
 
-	return 0;
-}
-
-
-
+	
+
+
