Linear and Nonlinear equations mixed.New Keynesian Model

Hi all,

I use the standard New Keynesian model in order to calculate steady-state and moments. However, i have found only log-linear examples. I try to mix the non-linear equations with a linear Taylor rule and the approximated forward looking NKPC. So all endogenous variables are in Levels except inflation and the marginal cost. Could anyone verify if this approach is correct or not?

Thanks a lot in advance.

stagprices_nonlinear.mod (2.51 KB)


why don’t you write down the non linear Phillips curve instead? You can find a recent post on the Dynare forum about that.



I checked the forum but i didn’t find any example of the non linear New Keynesian PC only a post that is referred to some papers(not named),did you know if there is any example with the non-linear version of the NKPC??? However, i also use in this script a linear Taylor rule. I compare this with the log-linearized version of the New Keynesian mod file (model (linear) ) moments and IRFs and are very very similar, they have only infinitesimal differences. This approximation is incorrect?

Anyway thanks a lot for your time.


I am interested too

The attached mod-file, which may soon be delivered in the Dynare examples, is entered non-linearly. It is based on Fernandez-Villaverdes Baseline DSGE model. The reference can be found in the header of the mod-file.
NK_baseline.mod (9.15 KB)
NK_baseline_steadystate.m (2.72 KB)

@jpfeifer, I have a question regarding this model: in Fernandez-Villaverdes’s paper (2006), variables are rescaled by technology growth rate so that rescaled variables would be stationary (correct me, if wrong). No problems with codes as posted. My confusion goes to fitting the model into real data: in this case, do I have to rescale real time series as well? Or this stochastic growth trend generated by technology is already included in nonlinear FOCs, so there is no further data rescaling problem.

Thanks in advance.

The model is only calibrated. If you want to estimate it, you still need to define a measurement equation that maps the stationary model variables to the data. In case of the Baseline DSGE model, Fernandez-Villaverde uses first differences.


I am fresh student in DSGE models. I have question about the attached mod file.
As I know the equilibrium conditions Just wrote in NK_baseline.mod (correct me, if wrong), but there is no initial values, so why this does not lead to errors( as mine)?
please help me about this.
Thank you in advance

Because there is a steady state file supplying the analytical steady state.

Thank you a lot.
So If I have the log-linearized model,I can find the IRFs. I mean it is not necessary to have a steady state file too. am I right?
Thank you.

If your model is log-linearized, it has steady state 0. You don’t need a steady state file in this case.

Thank you very much!

Thanks for providing the code. I have downloaded both files and run the dynare code on my computer. However, I got a warning message regarding some steady state parameters.

*Warning: Some of the parameters have no value (gammma1, Rbar, Lambdax) when using
steady. If these parameters are not initialized in a steadystate file, Dynare may not
be able to solve the model…

In test_for_deep_parameters_calibration (line 46)
In steady (line 33)
In NK_baseline (line 351)
In dynare (line 180) *

The programme has finished without error message. It seems like steady state has been found by “fsolve” function. My question is, shall I worry about the warning message above? Thanks a lot!


*Equation solved.

fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance, and
the problem appears regular as measured by the gradient.*

No, you should not worry. The warning is

but these parameters are indeed set in the steadystate-file.


I am trying to solve Fernandez-Villaverdes’ model without the capital, investment and wage rigidity. It’s a simple model with price rigidity only.

I am aware that we need to re-scale some variables in order to preserve stationary time series. However, I still encounter certain problems when Dynare is trying to deal with the technology variable (A), which is the only exogenous shock that grows exponentially.

An infinite element was encountered when trying to solve equation(s) 6 with respect to the variable(s): A.

Could anyone give me some thoughts or hints on where I get it wrong? Thanks in advance.

parameters_repli.mod (162 Bytes)
model_onecountry.mod (2.17 KB)

A problem is

A(+1) = A*exp(mu_a + e_a);
In steady state, it implies

which is only feasible if mu_a=0.

Hello! I am new to Dynare, I just wanted to know how can I check if I have linearized my model correctly by hand? Is there a way I can compare linear and non-linear models on Dynare (separate files, ofcourse). What would be the basis for this comparison? How can I check if the two are coherent? Thank you!

If they are consistent, then the IRFs at first order should be identical.