I am writing because I am not being able to run a matlab .m file to calculate the value of some parameters, which are functions of deeper parameters of the model (to be estimated).
So, basically I have a log-linearized model. Some of the coefficients on the log-linear variables, are ratios of steady-state levels. This steady-state levels are functions of deep parameters of the model that I want to estimate.
I have a matlab function that calculates these steady-state levels, given some previously defined deep parameters.
What I want is to run this matlab .m function within the definition of the model, so that every time the model is being solved during the estimation process, the coefficients on the variables of the log-linear equations are based upon the deep parameters being estimated, and not upon some fixed ones.
Say my model file is model.mod
I am writing #model_steadystate; as part of the definition of the model, but its not running.
Does anybody know how to handle this situation?
Thanks a lot for your help!
I have exactly the same problem. Have you found a solution yet?
With Dynare version 4 it is not possible to call matlab functions in the model block of a mod file. The reason is that this version of Dynare computes analytical derivates of the model, instead of numerical derivates with Dynare version 3. So Dynare needs to know how to derive any functions appearing in the model block. To overcome this limitation, you can define the parameters in the steady state file. Here is an example with a deterministic growth model (the same applies for stochastic simulations and estimation). In this example, two parameters (A and PSI) are computed in the steadystate matlab file. In this file you can call any matlab functions.
dog_steadystate.m (2.53 KB)
dog.mod (1.99 KB)
Perfect. Looks like exactly what I need. Thanks!!!
One more (related) question: Is there a way to recover the steady state calculated in the previous iteration in the steady state file? I will have to use a non-linear solver to find some of the steady state variables, it would be handy to be able to use these as initial conditions.
Felipe, you will find the previous steady state in oo_.steady_state. oo_ is a global matlab structure gathering all the results (from stoch_simul or estimation).
Hi Stephane, thanks for the answer.
I don’t seem to be able to call the oo_. structure from the steady state script, perhaps it has not been defined at that point?
In any case, I am able to get the same information from the ys vector, which is one of the inputs to the file you sent me and that appears to work. Does that sound right?