# Mh\_tune\_jscale : How much does it slow down the chain compution?

**URL:** <https://forum.dynare.org/t/mh-tune-jscale-how-much-does-it-slow-down-the-chain-compution/15272>\
**Category:** Estimation\
**Created:** [24 February 2020 15:08 UTC](https://forum.dynare.org/t/mh-tune-jscale-how-much-does-it-slow-down-the-chain-compution/15272 "2020-02-24T15:08:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Romero](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/b782af/32.png) [@Romero](https://forum.dynare.org/u/Romero)\
**Post date:** [24 February 2020 15:08 UTC](https://forum.dynare.org/t/mh-tune-jscale-how-much-does-it-slow-down-the-chain-compution/15272/1 "2020-02-24T15:08:44Z")

</div>

Dear Dynare team,  
thank you very much for the new release and for integrating the mh\_tune\_jscale feature. I am currently working with a very long chain (1,500,000 draws) and so this feature might be very useful. I was wondering much longer will it take for the chain to complete if I use the mh\_tune\_jscale, instead of working with a fixed m\_jscale? Or is that really impossible to say in general?

When I tried with just 100 draws, it seemed that it took much longer to complete the chain with mh\_tune\_jscale. But I suspect that the costs of tuning in terms of time probably tend to be concentrated at the beginning of the chain? And that the further the algorithm is into the chain the smaller the additional tuning is necessary to hit the acceptance ratio target, because, for a given scaling parameter, the acceptance ratio usually tends to move less later in the chain?

Best,  
Ansgar

---

<div class="post-metadata">

**Author:** ![stepan-a](https://forum.dynare.org/user_avatar/forum.dynare.org/stepan-a/32/6652_2.png) [@stepan-a](https://forum.dynare.org/u/stepan-a)\
**Post date:** [25 February 2020 08:28 UTC](https://forum.dynare.org/t/mh-tune-jscale-how-much-does-it-slow-down-the-chain-compution/15272/2 "2020-02-25T08:28:28Z")

</div>

Dear Ansgar,

This option works basically as what is done with `mode_compute=6` (which has the “optimal” scale parameter as an output). We first run a MCMC (without keeping the draws) by regularly adjusting the scale parameter to achieve the targeted acceptance ratio. When the scale parameter is stable enough (across MCMC iterations) and the desired acceptance ratio attained, this MCMC is stopped, and we run the standard Metropolis Hastings algorithm. So clearly you will need more draws than if you start your Metropolis Hastings with the “good” scale parameter… But at least the procedure is automatic and you don’t have to search for the scale parameter (which would also require some time).

Best,  
Stéphane.

---

<div class="post-metadata">

**Author:** ![Romero](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/b782af/32.png) [@Romero](https://forum.dynare.org/u/Romero)\
**Post date:** [25 February 2020 08:39 UTC](https://forum.dynare.org/t/mh-tune-jscale-how-much-does-it-slow-down-the-chain-compution/15272/3 "2020-02-25T08:39:26Z")

</div>

Dear Stéphane,  
ah I see, many thanks for your quick responise. And is the scale parameter resulting from the tuning saved in the mh\_history file after the tuning, so I can use it later to calibrate mj\_scale? I didn’t find it there, but I aborted the MCMC run before it was completed (but after the tuning phase was finished). Knowing the value resulting from the tuning would be useful because it happened to me several times that the acceptance ratio drifted quite a bit over the course of the chain, so the tuning can obviously not be perfect, but the resulting scaling parameter could it least serve as an upper (or lower) bound…  
Best,  
Ansgar

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [25 February 2020 11:38 UTC](https://forum.dynare.org/t/mh-tune-jscale-how-much-does-it-slow-down-the-chain-compution/15272/4 "2020-02-25T11:38:01Z")

</div>

The `mh_history` contains it in `record.ProposalScaleVec`. Also, the log-file should have a display like

> mh\_jscale has been set equal to XXXX

---

<div class="post-metadata">

**Author:** ![Romero](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/b782af/32.png) [@Romero](https://forum.dynare.org/u/Romero)\
**Post date:** [25 February 2020 12:42 UTC](https://forum.dynare.org/t/mh-tune-jscale-how-much-does-it-slow-down-the-chain-compution/15272/5 "2020-02-25T12:42:10Z")

</div>

Thank you, but is it stored there directly after the tuning phase is over? Or only once the MCMC run is completed? I checked the mh\_history file after an aborted run because I wanted to know which parameter the tuning procedure had set, but I don’t think record.ProposalScaleVec was there.  
Best,  
Ansgar

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [25 February 2020 16:05 UTC](https://forum.dynare.org/t/mh-tune-jscale-how-much-does-it-slow-down-the-chain-compution/15272/6 "2020-02-25T16:05:09Z")

</div>

No, unfortunately it is only set after estimation. I proposed a change at [https://git.dynare.org/Dynare/dynare/-/merge\_requests/1717](https://git.dynare.org/Dynare/dynare/-/merge_requests/1717)

Your best hope is to look at the output in the log-file.

---

<div class="post-metadata">

**Author:** ![Romero](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/b782af/32.png) [@Romero](https://forum.dynare.org/u/Romero)\
**Post date:** [28 February 2020 13:04 UTC](https://forum.dynare.org/t/mh-tune-jscale-how-much-does-it-slow-down-the-chain-compution/15272/7 "2020-02-28T13:04:48Z")

</div>

Thank you, Johannes. I have always thought that great minds think alike ;). Have a nice weekend.
