# Code to re-initiate mode estimation using the estimated\_param\_init block

**URL:** <https://forum.dynare.org/t/code-to-re-initiate-mode-estimation-using-the-estimated-param-init-block/11678>\
**Category:** Dynare contributions and examples\
**Created:** [17 April 2018 04:17 UTC](https://forum.dynare.org/t/code-to-re-initiate-mode-estimation-using-the-estimated-param-init-block/11678 "2018-04-17T04:17:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![punnoosejacob](https://forum.dynare.org/user_avatar/forum.dynare.org/punnoosejacob/32/5976_2.png) [@punnoosejacob](https://forum.dynare.org/u/punnoosejacob)\
**Post date:** [17 April 2018 04:17 UTC](https://forum.dynare.org/t/code-to-re-initiate-mode-estimation-using-the-estimated-param-init-block/11678/1 "2018-04-17T04:17:18Z")

</div>

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

```auto
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');

```

---

<div class="post-metadata">

**Author:** ![2017000006](https://forum.dynare.org/letter_avatar_proxy/v4/letter/2/d6d6ee/32.png) [@2017000006](https://forum.dynare.org/u/2017000006)\
**Post date:** [27 April 2018 03:51 UTC](https://forum.dynare.org/t/code-to-re-initiate-mode-estimation-using-the-estimated-param-init-block/11678/2 "2018-04-27T03:51:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![punnoosejacob](https://forum.dynare.org/user_avatar/forum.dynare.org/punnoosejacob/32/5976_2.png) [@punnoosejacob](https://forum.dynare.org/u/punnoosejacob)\
**Post date:** [27 April 2018 04:13 UTC](https://forum.dynare.org/t/code-to-re-initiate-mode-estimation-using-the-estimated-param-init-block/11678/3 "2018-04-27T04:13:23Z")

</div>

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
