Question on Ramsey_ Example.mod

Hello everyone,

My mentor recently runs the official Ramsey_Example.mod Ramsey_Example.mod (8.7 KB) in the Dynare “examples” folder. But he finds a problem. The final report says:

VARIABLE          1        2        3        4        5
pi_ann       0.9170   0.7952   0.6408   0.5175   0.4106
log_h       38.9755  38.8220  38.7416  38.8011  38.9005
R_ann        0.8399   0.7042   0.5592   0.4555   0.3672
log_C        0.8399   0.7042   0.5592   0.4555   0.3672
Z            0.8399   0.7042   0.5592   0.4555   0.3672
r_real       0.8399   0.7042   0.5592   0.4555   0.3672
[Warning: MATLAB has disabled some advanced graphics rendering features by switching to software OpenGL.]

Note: the autocorrelations of log_h are extremely high. But autocorrelation theoretically should locate in [0, 1]. We are not sure the reason.

Then I simplify the file to only include the Ramsey situation,
Ramsey_Example_concise.mod (1.5 KB)

VARIABLE         1       2       3       4       5
R_ann       0.8399  0.7042  0.5592  0.4555  0.3672
log_C       0.8399  0.7042  0.5592  0.4555  0.3672
Z           0.8399  0.7042  0.5592  0.4555  0.3672
r_real      0.8399  0.7042  0.5592  0.4555  0.3672
log_h      -0.1845  0.0659 -0.1239 -0.0165 -0.0555

Now numbers of log_h are acceptable. However the problem still exists.
Ramsey contains drawing IRFs for 6 variables,
stoch_simul(order=1,irf=20,periods=500) pi_ann log_h R_ann log_C Z r_real;
But in my computer, I miss the IRFs of pi_ann and log_h.

The reason is the use of simulations and numerical imprecision. pi_ann and log_h do not move under optimal policy. That’s why their IRFs are not displayed. However, when computing the autocorrelation based on simulated data, you will get junk due to a division by 0.


Perhaps the following question is off the topic, but it confuses me for long time.

In the model; section of Ramsey_Example.mod, you write


Then in the simulation section, you write

pi_ann log_h R_ann log_C Z r_real;

Your code obeys the rule that:

  1. directly write what we see into what we code, in model; section;
  2. simulate some important variables, which we take logs for them, in simulation section.

Hence, I would like to know why R_ann is not in log form?

Generally, I also saw some codes written inconsistently.

  1. They write GDP, pi, Q (real exchange rate), tb(trade balance) in model; section;
  2. They still simulate them without log. However they do logs for C, I, K, N, etc.


Actually, in Ramsey_Example.mod, I experimented h instead of log_h, IRF and error reports are different. I experimented logGDP, log_pi, log_tb as well. Some of them will cause errors. Yet the way that authors write is OK for dynare. Do they choose the log/non-log patterns for simulation deliberately?

Thank you once again!

  1. For things that can be negative, using the log is not feasible, e.g. the trade balance.
  2. We use logs to express variables in percentages. For interest rates that is usually not necessary as they are already measured in percentage points. That is the case in the above mod-file. R is a net interest rate so you don’t need to log it. It’s different for the real interest rate, where the object within the log is a gross interest rate.

So sorry for reviving this topic. I would like to further confirm whether we need to take logs on following indicators, when drawing their IRFs:
relative producers’ price p_{Ht}\equiv \displaystyle \frac{P_{Ht}}{P_t},
real exchange rate \mathcal{Q}_t\equiv \displaystyle\frac{\mathcal{E}_tP^*_t}{P_t},
terms of trade TOT_t\equiv \displaystyle \frac{\mathcal{Q}_t}{p_{Ht}},
stochastic discount factor \Lambda_{t,t+1}\equiv \displaystyle \beta \frac{\lambda_{t+1}}{\lambda_t}, where \lambda_t is the Lagrangian multiplier of the budget constraint of households, and it equals the marginal utility of consumption.

That is up to you. There is never a need to take logs. We take logs if we want to express IRFs in percentage deviations, i.e. without units. All of the variables you mention need to be positive, so taking logs is feasible.

I’m drafting a section that analyzes IRFs in plain words. A bit disheartening…

Do you have any guidelines/templates/sample papers for how to write that part well?

For example, in an open economy model, when Home country experiences a productivity shock Y_t\uparrow, I notice inflation \Pi_t \downarrow in its IRF. I judge at least three ways leading to this:

1, home production Y_{Ht} booms, nominal and real producers’ prices P_{Ht} and p_{Ht} \downarrow. Then due to the connection between inflations:
\Pi_{Ht} = \displaystyle \frac{p_{Ht}}{p_{H,t-1}}\Pi_t,
\Pi_t may \uparrow.

2, the inverse relation between Y_t with \Pi_t or between Y_{Ht} with \Pi_{Ht} can be viewed from NKPCs (I recall this is mentioned in Gali’s book)

3, in the Euler equation, given some certain monetary policy R_t,

So (re-)optimization of consumption and bond holdings (\Lambda_{t,t+1}) will influence \Pi_{t+1}.

These are the reasons that I want to obtain a more precise magnitude (log or non-log) of variations of p_{Ht}, \Lambda_{t,t+1}, to be consistent with the magnitude of \Pi_t in their corresonding IRFs.

If there are any other results or data that Dynare reports and can help me judge the movements of variables more accurately, please let me know.

What you mention are aggregate relationships holding in levels. In that case, you should not work in logs. Alternatively, you may want to gain intuition from log-linearized equations. In that case, use the logs for all variables.

That’s great! It is in line with my hunch!