# Fixed time sampling

**URL:** <https://forum.dynare.org/t/fixed-time-sampling/18191>\
**Category:** ML/Bayesian estimation\
**Created:** [28 May 2021 21:38 UTC](https://forum.dynare.org/t/fixed-time-sampling/18191 "2021-05-28T21:38:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpfiffer](https://forum.dynare.org/user_avatar/forum.dynare.org/cpfiffer/32/11649_2.png) [@cpfiffer](https://forum.dynare.org/u/cpfiffer)\
**Post date:** [28 May 2021 21:38 UTC](https://forum.dynare.org/t/fixed-time-sampling/18191/1 "2021-05-28T21:38:03Z")

</div>

Hey folks,

Is there a way to sample a chain for a fixed amount of time, i.e. 15 minutes or so? Hacky ways are fine. We mostly have a fixed amount of time to run chains and just need to be able to safely abort after some pre-determined time period.

Cameron

---

<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:** [29 May 2021 18:10 UTC](https://forum.dynare.org/t/fixed-time-sampling/18191/2 "2021-05-29T18:10:17Z")

</div>

There currently is no way to do so. You could only time a few draws and then extrapolate how many draws are feasible within a given amount of time.

---

<div class="post-metadata">

**Author:** ![cpfiffer](https://forum.dynare.org/user_avatar/forum.dynare.org/cpfiffer/32/11649_2.png) [@cpfiffer](https://forum.dynare.org/u/cpfiffer)\
**Post date:** [29 May 2021 18:27 UTC](https://forum.dynare.org/t/fixed-time-sampling/18191/3 "2021-05-29T18:27:46Z")

</div>

Okay, thanks. No way to stream results to disk and then have an external process terminate sampling after a timer?

---

<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:** [30 May 2021 15:40 UTC](https://forum.dynare.org/t/fixed-time-sampling/18191/4 "2021-05-30T15:40:35Z")

</div>

It depends on what you are trying to do. The main problem will be that Dynare does not know how to handle a chain with an a-priori unknown number of draws.

---

<div class="post-metadata">

**Author:** ![cpfiffer](https://forum.dynare.org/user_avatar/forum.dynare.org/cpfiffer/32/11649_2.png) [@cpfiffer](https://forum.dynare.org/u/cpfiffer)\
**Post date:** [30 May 2021 18:50 UTC](https://forum.dynare.org/t/fixed-time-sampling/18191/5 "2021-05-30T18:50:57Z")

</div>

Hm. Alright. We’ll just use an approximation and extrapolate, thank you!

Also, good to meet another fi-fur. Not a lot of us around.

---

<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:** [31 May 2021 07:15 UTC](https://forum.dynare.org/t/fixed-time-sampling/18191/6 "2021-05-31T07:15:55Z")

</div>

In Germany, the name is not that uncommon and has been immortalized in a very old movie [https://www.youtube.com/watch?v=h19YjALZQ\_g](https://www.youtube.com/watch?v=h19YjALZQ_g)

---

<div class="post-metadata">

**Author:** ![cpfiffer](https://forum.dynare.org/user_avatar/forum.dynare.org/cpfiffer/32/11649_2.png) [@cpfiffer](https://forum.dynare.org/u/cpfiffer)\
**Post date:** [31 May 2021 15:51 UTC](https://forum.dynare.org/t/fixed-time-sampling/18191/7 "2021-05-31T15:51:50Z")

</div>

I wasn’t aware! Perhaps the Pfeiffers all stayed in Germany to take advantage of the great joke.
