About OSR command and Bodenstein et al (2019) toolbox

Dear all,

HI, I’m a beginner of Dynare, and I’m studying OSR and the toolbox (the zip file below) in Bodenstein et al (2019).

Firstly, I red the Dynare manual, and tried to apply the explanation of OSR to my model for my thesis. But I found that the same optimal responses considered in my model are derived for any kind of shocks. Is it because the constraint for the minimization problem reflects all exogenous shocks declared in the varexo- command?

Secondly, I tried to understand the toolbox. The toolbox assumed that the two policymakers has their only one instruments. But I want one of the players to have three instruments. So, Is it sufficient to modify the matlab file ‘convertmodfiles’ and ‘get_aux’? And where can I download the older version of Dynare like 4.4.2? (In Dynare website, the error " The requested URL was not found on this server." appears.)

Finally, in the toolbox, I want to set the welfare function which consists of the diverse variances of variables. But I don’t know exactly code in the model block since the variable ‘welfare’ must be in the block. (I know how to calculate the second order approximated welfare function after the stoch _simul command. like [DSGE_mod/Born_Pfeifer_2018/Welfare/Born_Pfeifer_2018_welfare.mod at master · JohannesPfeifer/DSGE_mod · GitHub]) How to do that?

Thank you so much in advance.

Best wishes,

Shin.

BGL_Replication_Codes.zip (2.7 MB)

  1. OSR is unconditional in that it depends on the full distribution of shocks. It is not an exercise conditional on a particular type of shock.
  2. I am not familiar with their toolbox and cannot answer. You can find all Dynare versions at
    Index of /release
  3. What exactly are you trying to do with welfare? For OSR I am afraid you have to manually derive the respective weights on the variable variances implied by a welfare function.

First of all, thank you so much for your reply, professor.

  1. I don’t understand what you mean. I found that when I erased some shocks or changed the standard deviations of any shocks in the shock block, the optimal coefficients considered in my policies also changed. It is consistent with your answer?

  2. I just really appreciate your help and thank you for the link. I can download it now.

  3. I thought that by OSR, I can derive the social welfare of the cooperative game set in the ‘optim_weights’ block and compare the one of the baseline model. And the welfare is unconditional welfare. Is it right? Also, I’m also confused with the code you provided in Optimal policy parameters in a non-linear model for maximizing social welfare. I thought the lifetime welfare are approximated in second order, then, it is just the unconditional welfare as well. Am I right? I can’t find the difference between your code and OSR.

  4. Plus, I want to ask some questions about the meaning of unconditional welfare and conditional. In Unconditional versus conditional Welfare measure, the unconditional welfare corresponds to the unconditional ergodic mean of the welfare variable. So, the mean is just the simple average of the welfare variable over the periods I set in stoch_simul command?
    On the other hand, I saw the comment, Unconditional versus conditional Welfare measure - #8 by HelloDynare. I got confused since when it comes to the question 3, in the process of finding the unconditional welfare, does the economy also start with the steady state? What’s the difference? (I entered the all steady state value of the endogenous and exogenous variables in initval block.) Finally, in the comment, “Risky steady state : despite no shocks , the agent observes the distribution of the shocks that may hit the economy in future, e.g. standard deviation σ.”, So how can we identify the agent’s consideration in Dynare code? I believe that the standard deviations in shock block do not show the consideration. I thought the risky steady state corresponds to conditional welfare.

Sorry for too many questions. at this time, I’m beginner of MATLAB and Dynare and I got lost in my road for my graduation. Please understand my situation. I really appreciate much.

Without wax,

Shin.

  1. I clarified that point above. The optimal rule will always depend on full distribution of the specified shocks. It’s not about computing a different rule for each type of shock.
  2. My point is that you need to provide the weights in the optim_weights-block, which means you cannot simply compute welfare numerically by defining the welfare function within the model block. And yes, the objective in OSR is an unconditional one. The difference between OSR and my code is that OSR as implemented in Dynare works in a linear-quadratic framework. Everything you put into the model-block will only be linearly approximated.
  3. Unconditional welfare is the unconditional expected value of welfare. You can either compute the expectations theoretically from the decision rules are via a long simulation as the simulated time series are ergodic. Ergodicity typically requires the effect of the starting value of the simulation to vanish, i.e. discarding a burn-in. Whether you start at the deterministic steady state or somewhere else does not matter. The risky or stochastic steady state is a concept typically not relevant for welfare analysis. Whether you consider conditional or unconditional welfare depends on which object you read out of the results. The expected value of welfare in e.g. oo_.mean or the welfare evaluated at a particular point of the state space, usually using simult_.m.
  1. Now, I got your point. So, I think that OSR is just the device to introduce endogeneity to the considered rules. Not good as the optimal policy in cooperative game. I’m just wondering that before executing OSR command, should I put all shocks declared in varexo block in the shock block?

  2. I understand your point. But I want to ask about the difference. The code you provided is also not meaningless for deriving the optimal policy for each type of shocks?

  3. Thank you for your explanation. Could you introduce the reference (or textbook) for the ergodicity in time series?

  4. Plus, I applied your code to my mode file. The objective function is the social welfare as Rubio et al (2014), " Macroprudential and Monetary Policies: Implications for Financial Stability and Welfare". It is declared as “SW” in the mode file. But the result showed the error occurring in your MATLAB code for cmaes. What caused the error? I attached the mod file. On the other hand, I can’t identify the difference the options, ‘irf’ and ‘periods’ in stoch_simul command. Why does the latter produce the empirical moments?

Thank you so much again for your help.

Best regards,

Shin.
Mode_LDe_LDr.mod (36.5 KB)
get_minus_welfare_objective.m (1.7 KB)
LDe_LDr.txt (638 Bytes)

  1. OSR is not a fully state contingent optimal policy. Rather, the feedback from the state of the economy is mediated through a small set of endogenous variables (the S for simple)
  2. The linear quadratic OSR framework dates back to a time where full second order was hard to compute. That’s different now. Ideally, you would go for a full second order approximation.
    3 You could start with https://faculty.washington.edu/ezivot/econ583/asymptoticsprimerslides2.pdf and the references therein.
  3. You starting values were infeasible given the bounds. Try the attached where I removed the global variables:
    Mode_LDe_LDr.mod (36.6 KB)
    get_minus_welfare_objective.m (1.7 KB)
  1. I got it, professor.

  2. Yes, your answer made me to go for the code you provided.

  3. Thank you for the reference. I will read it.

  4. Now it finally works well. I didn’t expect it to take more than 2 hours. :smile:

Now, I find the road to my destination under your guide. I really appreciate so much for your tremendous help. If there exist people facing similar problem like me in this topic, hopefully they will crash the rock with this post.

Have a good day, professor.

Without wax,

Sangun Shin.

Dear professor,

I have one more question.

I defined the social welfare as sum of different variances using expectation commands and I optimize it with the code you gave in Jun 26.

  1. The objective is positive. Then, by the ‘get_minus_welfare_objective’ file, the objective is converted to the negative one. Then, in my mode file above, how am I guaranteed that the methods, csminwel and cmaes, minimize the welfare?

  2. I also declared ‘SW’ as the sum of the lifetime utilities of the agents. Then I compare the SW in two cases, (1) constant DTI, (2) welfare-maximizing DTI. I can obtain theoretical and empirical moments of the variables. Which is better for the comparison?

Thank you very much in advance.

Shin.

  1. What do you mean? By convention, numerical optimizers are minimizers. If you wan to maximize welfare, you minimize the negative welfare of the welfare objective function.
  2. If possible, I would go for theoretical moments. They will not be subject to random noise of Monte Carlo Integration.
  1. I didn’t know the functions are numerical minimizers. Your answer is now enough.

  2. Yes, I will follow your recommendation.

Thank you so much again.

Shin.

Dear professor,

I have three questions about the code you gave for the optimization functions.

  1. I set my loss function which is the sum of three variances of credit to output (‘BY’ in my mod file), inflation(pie), and output(Y)'. So, I put the three variable names in the 'target_name" and I set the ‘fval’ in the MATLAB function file as “fval = oo_.var(1,1) + oo_.var(2,2) + 0.148 * oo_.var(3,3);” It worked (I used ‘csminwel’ function) and I attained the minimized fval and optimized coefficients. But, when I put the responses in my mode file and conduct stochastic simulation of which the options are set equivalently, I have different the value of loss function. The difference was at least not negligible compared to the two fvals. What did cause the difference? Are the optimal coefficients are just local optimal?

  2. If I do with the ‘cmaes’ function instead and face similar situation, should I stop the work with the function?

  3. I made the sum of the variances of three considered endogenous variables as variable in my mod file. But I’m not sure the codes for variances are right since the oo_.mean value of the combination are too small after I set the sum (SWV) as the target variable for ‘csminwel’ function’s ‘fval’, compared to the sum of value of oo_.var for the considered variables.
    For example, the codes for the sum (SWV) as variable in my mode file are,

exp(BY2) = exp(BY)^2;

exp(pie2) = exp(pie)^2;

exp(YG2) = exp(YG)^2;

“SWV = ( 1 / (1 - 0.99)) * ( exp(BY2) - (EXPECTATION(0)(exp(BY)))^2 + exp(pie2) - (EXPECTATION(0)(exp(pie)))^2 + (0.148) * ( exp(YG2) - (EXPECTATION(0)(exp(YG)))^2 ) ) ;”

Thank you so much in advance again and again.

Without wax,

Sangun Shin.
Mode_LDe_LDr_C.mod (38.0 KB)
J_get_minus_welfare_objective.m (1.7 KB)