I am trying to estimate by SMM with the relatively new Dynare toolbox a model with two binomial draws (a couple of random draws into the model will do the job). In fact, the binomial parameters, say p and q, are those among I would like to be estimated. Nonetheless, to the best of my understanding Dynare only supports normal shocks for the estimations.
Is there a way to generate random draws as opposed to Normal ones for the estimation in the SMM toolbox?
Alternatively, I was thinking whether there is a Dynare-implementable method to transform normal to random shocks (into the model part of the code) so that I can proceed with the SMM estimation.
Any help will be highly appreciated!
First of all, I am not sure what you mean by
a model with two binomial draws (a couple of random draws into the model will do the job)
could you clarify what you want to achieve?
In general, Dynare does not have an interface for non-Gaussian shocks, so there is no easy way to achieve this. However, if you are willing to dive into the codes, you could in principle implement this yourself and adjust to your application.
The following parts of the codes would need to be adjusted and tweaked:
- you would need to add the additional shock parameters of your distribution to the
M_ structure and the
estimated_params_ structure. How you do this exactly is up to you and what is convenient.
matlab/+mom/run.m: lines 649ff starting with Get shock series for SMM and set variance correction factor: here we draw the Gaussian shocks from the standard normal distribution and we later rescale these in
objective_function.m with estimated standard errors. For SMM it is important to have the same shock series as input, so you would need to think how to generate a common shock series which can later be re-scaled by estimated shock parameters. As far as I remember (I might be wrong), you can get draws of the binomial distribution by manipulating uniform random numbers.
matlab/+mom/objective_function.m lines 211 starting with Compute Moments of the model solution for normal innovations: here we do the re-scaling of the shocks and feed those shocks into the command
simult_.m. You would need to adjust the common shock series with your estimated parameters. Also make sure that the optimizer truly updates those parameters of your distribution and keeps the bounds as one parameter is between 0 and 1 and the other one is actually an integer (so I would probably not estimate this but try out different values).
matlab/simult_.m: this is where we actually do the simulations based on the approximated policy functions (the same function is used when you call
stoch_simul in your mod file). Now, this is where things could potentially become messy depending on what kind of shocks you are considering and what properties they have. For instance, you need to make sure that the shocks are zero mean (the binomial distribution is not zero mean), so you would need to take this into account and adapt the codes accordingly. Also if your are doing perturbation order higher than 1, things get messy very quickly as you would need to re-compute stuff like oo_.dr.ghs2 (as M_.Sigma_e is not the correct covariance matrix of your shocks) or if your shocks are asymmetric you would even need to compute some matrices of the policy function manually as Dynare (due to symmetry of the Gaussian distribution) simply sets those to 0 (and have some interface for this).
So again, why exactly do you need the binomial distribution? This can be done (in principle) with Dynare, but regarding the changes needed for the binomial distribution, I would probably suggest you don’t hack into Dynare, but rather do your computations from scratch to make sure you are not missing something along the way.
I wonder whether it is possible to specify HP filtered moments in the “matched_moments” block of the code. I have tried to define the hpfilter command as an external function but this approach does not seem to work.
Moreover, I am confused on whether the stoch_simul output (activating the hp filter option) may help me on this.
Any thought would be very helpful. Thanks!!!