Linearisation and log-linearisation, in Dynare and by hand

Hi all,

I have my model for which I solve the steady-state by hand and I also log-linearise by hand. I wanted to let Dynare do the linearisation to see if it gives me the same results but this is not the case. There are two things:

  1. Differences in terms of unconditional correlations across the two models, the one that I introduce in log-linear form in Dynare and the one that I let Dynare do so are sometimes quite substantial. In both cases, I use resid(1) and all the residuals of the static model are nill, suggesting that the steady-state is well defined.

  2. When I let Dynare on one hand to linearise the model, and on the other to log-linearise it, results are (almost) unchanged.

Am I doing something wrong to get such big discrepancies across the two models, which are supposed to give me the exact same solution? Thanks for any help/suggestions how I could verify/correct my results

Best,
K.

Could you provide the mod-files. What you describe should not happen. The results must be identical

Hi jpfeifer,

Thanks for your response. I have to admit the model is a bit complicated, mostly big. I attach the relevant files. The commands before the model block are to calculate the steady state. For that it also uses the fsolve function attached in an additional file. The files are:

  • BSnews: the one where I introduce the linear model.
  • BSnewsNL: model’s FOCs, Dynare does the linearisation.
  • BSnewsNL1: model’s FOCs, Dynare does the log-linearisation.
    Note that all variables are followed by 1 and 2 as it is a two country model.

Some doubts I had in introducing the model’s equations are the following:

  • treatment of the adjustment cost functions (investment and utilisation) in the mod files that Dynare does the linearisation (variable names sI and sprimeI and deltaU and deltaprimeU).
  • treatment of the exogenous (productivity) process. In particular, I assume a production function Y = ZK^alphaN^(1-alpha) and wondering whether it should be e^Z*K…

Thanks for your time and willingness to help.

Best,
K.
myfunCapitalServices3.m (1.35 KB)
BSnews.mod (37.4 KB)
BSnewsNL1.mod (33.4 KB)
BSnewsNL.mod (37.1 KB)

I am puzzled by the fact that

% Intermediate goods production yT_I1 = zT1 + alphaT_1*(ST1) + (1-alphaT_1)*nT1 ; yT_I2 = zT2 + alphaT_2*(ST2) + (1-alphaT_2)*nT2 ; yN1 = zN1 + alphaN_1*(SN1) + (1-alphaN_1)*nN1 ; yN2 = zN2 + alphaN_2*(SN2) + (1-alphaN_2)*nN2 ;
in the lineariz model have a residual of -1 each and that the steady state seems to be not exactly 0 as it should be. There are also other equation with non-zero residuals that typically indicate small problems that remain.

Hi,

Sorry, that was so stupid of me. In that version I left something open while I was experimenting to find a solution to the problem. In particular, and this might be a hint, I set the initial conditions on Z=1, for all of the Zs.

I am attatching again the corrected version of the files. These are same three files as before (same description) where the static model is solved without any apparent problem. Those linearised by Dynare (BSnewsNL and BSnewsNL1) offer almost identical results. The one I introduced in log-linear form myself (BSnews) produces different ones.

Can you please look it up again? Thanks!

Best,
K.
BSnewsNL1.mod (33.4 KB)
BSnewsNL.mod (37.1 KB)
BSnews.mod (37.4 KB)

Hi,

I was wondering weather you had any chance to have a look at my code. I actually noticed that in the cases where I let Dynare do the linearisation (simple or log) the** variances of the langrange multipliers are huge**; an obvious anomaly. Any idea what that might mean and where would that mean I should look for a mistake? Whats surprising is that all the other statistics - I even ask extra verifications than the ones Dynare does - look perfectly normal.

I am attaching again a version of the model (the one that I ask for simple linearisation), I discovered one mistake in the previous one.

Thanks a lot!

K.
BSnewsNL_1.mod (37.9 KB)