Infrequently Drawing from Estimated Posterior

Hello,

I am trying to replicate this 2022 paper by Stephanie Schmitt-Grohé and Martín Uribe.

The .dyn and data files I use are attached at the bottom of this post.

My question is this: the authors’ results “are based on random subsamples from the 50-million draws of length either 1 million or 100 thousand.” Is there a way to replicate this solely using Dynare and its estimation command?

As I understand it, they want to generate an MCMC chain of N = 1e6 or 1e5, while at the same time drawing 50 million times from the posterior. If I were to write this up in pure Matlab, I would write the posterior sampling block as

N = 1e6; % length of chain; could be 1e5, too
M = 50e6; % number of draws to force

n_kept = 0; % number of draws that have been added to chain

while n_kept <= N
    %
    % evaluate likelihood at proposed parameters
    %

    if rand() <= N/M
        %
        % save parameter vector, the indicator of whether or not it was accepted in the above block, etc.
        %
        n_kept = n_kept + 1;
    end
end

I know this would not guarantee exactly 50 million draws are taken, but on average one would be quite close to that goal. I additionally know I could use Dynare to estimate the model, and then use its M_, oo_, and other outputs as inputs to pure Matlab files, but it would be quite convenient to do this entirely in the .dyn file.

I’ll be the first to admit I’m not an expert at Bayesian statistics. Is what they are doing in this paper “thinning,” in the context of that field? If so, the Dynare documentation does not mention that topic by that name.

Thank you to anyone who can help with this.
Best regards,
Logan

long_data_dynare.csv (5.0 KB)
rstar_ssgmu.dyn (9.1 KB)

From what I can see, it’s an instance of

mh_replic=50000000, sub_draws=1000000

That is: you pick 1 million random draws out of the 50 million MCMC draws.

I see, thank you Professor Pfeifer!

Just for my own edification, this would be equivalent to:

  1. Calling the estimation command without the sub_draws=1000000 option,
  2. Draw 1 million indices via randi(50e6, 1e6),
  3. Accessing the draws corresponding to those indices in the rstar_ssgmu/metropolis directory, and then
  4. Computing any desired posterior objects from that subset,

Correct? Or is there something that would distinguish the two processes?

Thank you again,
Logan

Yes, that is correct.

1 Like