Code to re-initiate mode estimation using the estimated_param_init block

I paste below some code to create an excel file to take the estimated mode from a failed estimation run, and then re-start the estimation using the estimated mode as the new initial values.
After the excel file is produced, just copy and paste the contents into the estimated_params_init section in the mod file.

Cheers
Reuben

load([M_.fname '_mode']);   
xlswrite([M_.fname 'PosteriorMode.xlsx'], cellstr(repmat('stderr',estim_params_.nvx,1)), 'PosteriorMode','A1');  
xlswrite([M_.fname 'PosteriorMode.xlsx'], parameter_names, 'PosteriorMode','B1');  
xlswrite([M_.fname 'PosteriorMode.xlsx'], repmat(',',estim_params_.nvx +estim_params_.np,1), 'PosteriorMode','C1');  
xlswrite([M_.fname 'PosteriorMode.xlsx'], xparam1, 'PosteriorMode','D1');  
xlswrite([M_.fname 'PosteriorMode.xlsx'], repmat(';',estim_params_.nvx +estim_params_.np,1), 'PosteriorMode','E1');
2 Likes

hi!
it is a very useful code, thanks!
but I don’t know how to load the mode to the estimated_params_init section?
can you show me how to do this ? thanks a lot

Hi Chris
You just need to copy-paste the material in the xlsx file back to the dynare mod file into the section

estimated_params_init;
COPYPASTEFROMEXCEL
end;

I usually paste this section after a section declaring priors…
Reuben

1 Like