% This program solves the model and runs the simulation
clear;
% modified 24.8. CK
% modified 24.10.08 CK



global model_num; 
global model_name;
%--------------------------------------------------------------------------
% SIMULATION SETUP: 
initialdrop=200;    % number of observations to drop  
horizon= 180        % length of simulation after droppping `dropinitial' observations  
n=1000;             % no. of simulations
model_num=4;        % specifies the model: 
                    % 1 KP benchmark model  
                    % 2 KP w indivisible labor 
                    % 3 KP w Frisch E. 0.63
                    % 4 CKM benchmark model
                    % 5 CKM w indivisble labor
                    % 6 CKM w Frisch E. 0.63
                    % 7 CKM w sigma_l/2
                    % 8 CKM w sigma_l/3

 save_d=0;          % 1 - save 0 - don't save
                    
%--------------------------------------------------------------------------
getmodelname; 
model_run;

j=1;
series_mat=[];

while j<n+1;
    [output,hours]=simulation(horizon,initialdrop);

    output_log=log(output);
    hours_log=log(hours);
    prod_log=output_log-hours_log;
    prod_log_d=diff(prod_log);

    series=[(prod_log_d');(hours_log(2:end,:)')];
    series_mat=[series_mat;series];

    j=j+1;
end

disp(model_name);


if save_d==1;
    
    name=['c:\christian\ownresearch\BCAandVARMA\programs_revision\series_' model_name num2str(horizon) '.dat'];
    save(name,'series_mat','-ascii');

end



















