A simple neoclassical model

Dear all,
I run the mod but the result shows that:

Starting Dynare (version 4.4.2).
Starting preprocessing of the model file …
ERROR: BCA.mod: line 147, col 62: character unrecognized by lexer

??? Error using ==> dynare at 174
DYNARE: preprocessing failed

Could anyone tell me why?
CH_data_1981_2011.m (1.23 KB)
BCA.mod (4.95 KB)

When I copy your code to a text-editor other than Matlab, I get

[quote] rho_P_13 , 0, 0 , Inf , normal_pdf, 0 , 0.20 ;
rho_P_14 , 0, 0 , Inf , normal_pdf, 0 , 0.20 ;
[/quote]

Thus, where you see two empty spaces in Matlab, you actually have two special characters that Dynare detects. You need to delete them. Dynare exactly tells you where these characters are.

[quote=“jpfeifer”]When I copy your code to a text-editor other than Matlab, I get

[quote] rho_P_13 , 0, 0 , Inf , normal_pdf, 0 , 0.20 ;
rho_P_14 , 0, 0 , Inf , normal_pdf, 0 , 0.20 ;
[/quote]

Thus, where you see two empty spaces in Matlab, you actually have two special characters that Dynare detects. You need to delete them. Dynare exactly tells you where these characters are.[/quote]

Thanks Pro.Pfeifer! I made it.

Hi, I am trying to replicate a medium scale DSGE model. I am new to Dynare. When I try to run the attached .mod file, it always gives me the following error message:
Starting Dynare (version 4.4.3).
Starting preprocessing of the model file …
ERROR: sims.mod: line 18, col 31: character unrecognized by lexer
Error using dynare (line 174)
DYNARE: preprocessing failed "…

I am using Dynare version 4.4.3. Can anyone please tell me why I am getting this error message or how to fix it? Thanks in advance.
Fred_data.xls (28.5 KB)
sims.mod (4.76 KB)

The exponent sign “^” you are using is not the standard ASCII one (Ascii 94) but rather a special character (Ascii 710) that just looks similar. Please replace it by the correct one.

Dear Professor Pfeifer,
Thanks a lot. I have corrected the exp sign (^) and other language mistakes like ‘estimated_params’, not estimated params. Now I am having trouble in the initival block. The error message is like:
STEADY: The Jacobian contains Inf or NaN. The problem arises from:
STEADY: Derivative of Equation 1 with respect to Variable lam (initial value of lam: NaN)
STEADY: Derivative of Equation 3 with respect to Variable lam (initial value of lam: NaN) …STEADY: The problem most often occurs, because a variable with exponent smaller than 1 has been initialized to 0…

But the initial value of ‘lam’ is analytically calculated. Does this means the initial value for ‘lam’ is not correct or bad guess? I would like to know how these problem are to solve or what should I do in such case. I am trying to replicate DSGE model from Eric Sims notes to learn the estimation technique before going to my own model. Attached is the updated .mod file. thanks.
Fred_data.xls (28.5 KB)
sims.mod (4.77 KB)

See [Error occur when estimate parameter)

Thanks a lot Prof. Pfeifer. What I did is, I calibrated the model first in a separate file, and later used these exact steady state values in the estimation file.
Is that what you mean in the link? Now the ‘Jacobian Nan…’ problem is gone.
Later while estimating, I used mode_compute=6 as 1 to 4 were not working. However the prior and posterior distribution of parameter figure look weird. Why is that? I am using de-trended data.
Thank you for all your replies, It really helps me learning. This is truly appreciable.
Fred_data.xls (34 KB)
simstest.mod (5.08 KB)

It seems you have mulitplied your growth rates with 100, but did not account for this in the shock processes. See the remark in my Guide to Observation Equations.

Yes, the growth rates and inflation, interest rate data are all multiplication of 100. Okay, it seems I need to read your whole guide carefully to learn estimation techniques. I will ask you if I don’t understand.

Meanwhile, I would like to ask you if you don’t mind about calibration of a full blown DSGE model, “Sudden flood, macro prudential regulation and stability in an open economy” by Agenor et al (2014). I have derived the FOCs of every sector same as authors but feeling trouble while declaring the model. Unlike the medium scale DSGE I sent you, here I am having both prices and inflations.

My understanding is I can declare all assets (deposits, bonds, bank debt, housing etc) in real terms, thus get rid of P. But still having P in aggregate resource constraint. Also I have intermediate and final goods and prices as well as imported goods, and exported goods their respective prices. Is it that I will have to have equations for each of them separately in the model?
Here I am especially struggling in specifying the production sector. Any advice or tips to make things easier?
Thanks a lot.
Sudden Floods, Macroprudential Regulation and Stability in an Open Economy (Agenor et al., 2014).pdf (986 KB)

Dear Professor Pfeifer, to be consistent with data and shock specification I can either use data dividing by 100, or I can use my existing data but multiply the shock standard errors by 100, is that correct? I have done the latter way. As my model is not log-linearized, shock stderr 0.2 means shock size 20 %, right?

As I mentioned in earlier post, I calibrated the model first in a separate file with analytical steady state values and later used the exact steady state values from calibrated model to the estimation mod file. Then I could successfully run the mod file. But if I add ‘steady’ and ‘check’ command in the estimation mod file then I encounter the following error message:
“Error using dynare_solve (line 60)
An element of the Jacobian is not finite or NaN
Error in evaluate_steady_state (line 66)…”

Why is that? If the calibration gives me correct steady state values, then how Jacobian can be NaN? Alternatively, how can estimation be done with the same mod file if I don’t put the ‘steady’, ‘check’ command?

Thanks in advance for any clarification.
Fred_data.xls (34 KB)
simstest.mod (5.16 KB)

No, if you are using data mulitplied by 100, then 0.2 is 0.2 percent.

If you use the steady command, the model must be fully calibrated. Currently, you are only setting a subset of the parameters. The other ones are only set for estimation.

Okay I got it now. Thanks Professor.

Dear Professor Pfeifer,
First of all, I apologise that this question is not directly related to Dynare use, rather theoretical. I hope you won’t mind with that as you help us in so many directions.
As I can estimate the model now for which I received your help earlier (in previous posts), I would like to add Gertler and Karadi (2009)’s financial friction model into this. Just to remind you my earlier model : It has household sector (HH) ( with nominal wage rigidity and it produces capital and decides capital utilization also), Final production sector, Monopolistically competitive intermediate goods sector (nominal price rigidity) and government & the central bank.

Now I would like to separate the capital production from HH first of all. And I want the intermediate goods sector to decide capital utilization rate. While dealing with the intermediate sector, my understanding/the way I am proceeding is,
I explicitly use per unit capital value (Q) and the total cost for capital hiring is , gross interest rate*Q K. This interest rate comes from the bank’s lending rate.
So while minimizing total cost in input markets, the firm’s control variables are Labour (N), capital (K) as well as utilization rate (U)?

The firm’s production function is, Yt = At (u e k)^alpha L^(1-alpha), where u is capital utilization rate, e is capital quality shock and K is capital. Then , intermediate firm’s profit function contains two control variables: firm j’s output price (P(j)) and U. Here in profit function, the capital utilization comes through the production function . This implies, intermediate firm (j) is deciding capital utilization twice : once in cost minimization problem in factor market and second in profit maximization in output market?
Is it correct/consistent?

Regards

Dear Professor Pfeifer,
First of all, I apologise that this question is not directly related to Dynare use, rather theoretical. I hope you won’t mind with that as you help us in so many directions. I would like to add Gertler and Karadi (2009)’s financial friction model into my earlier simple model (in previous posts). Just to remind you my earlier model : It has household sector (HH) ( with nominal wage rigidity and it produces capital and decides capital utilization also), Final production sector, Monopolistically competitive intermediate goods sector (nominal price rigidity) and government & the central bank.

Now I would like to separate the capital production from HH first of all. And I want the intermediate goods sector to decide capital utilization rate. While dealing with the intermediate sector, my understanding/the way I am proceeding is,
I explicitly use per unit capital value (Q) and the total cost for capital hiring is , gross interest rate*Q K. This interest rate comes from the bank’s lending rate.
So while minimizing total cost in input markets, the firm’s control variables are Labour (N), capital (K) as well as utilization rate (U)?

The firm’s production function is, Yt = At (u e k)^alpha L^(1-alpha), where u is capital utilization rate, e is capital quality shock and K is capital. Then , intermediate firm’s profit function contains two control variables: firm j’s output price (P(j)) and U. Here in profit function, the capital utilization comes through the production function . This implies, intermediate firm (j) is deciding capital utilization twice : once in cost minimization problem in factor market and second in profit maximization in output market?
Is it correct/consistent?

Regards

Sorry, but I am not well-versed in that branch of the literature. But usually the utilization rate is not a choice in the input market as capital and labor chosen.

[quote=“sadia”]Dear Professor Pfeifer,
First of all, I apologise that this question is not directly related to Dynare use, rather theoretical. I hope you won’t mind with that as you help us in so many directions.
As I can estimate the model now for which I received your help earlier (in previous posts), I would like to add Gertler and Karadi (2009)’s financial friction model into this. Just to remind you my earlier model : It has household sector (HH) ( with nominal wage rigidity and it produces capital and decides capital utilization also), Final production sector, Monopolistically competitive intermediate goods sector (nominal price rigidity) and government & the central bank.

Now I would like to separate the capital production from HH first of all. And I want the intermediate goods sector to decide capital utilization rate. While dealing with the intermediate sector, my understanding/the way I am proceeding is,
I explicitly use per unit capital value (Q) and the total cost for capital hiring is , gross interest rate*Q K. This interest rate comes from the bank’s lending rate.
So while minimizing total cost in input markets, the firm’s control variables are Labour (N), capital (K) as well as utilization rate (U)?

The firm’s production function is, Yt = At (u e k)^alpha L^(1-alpha), where u is capital utilization rate, e is capital quality shock and K is capital. Then , intermediate firm’s profit function contains two control variables: firm j’s output price (P(j)) and U. Here in profit function, the capital utilization comes through the production function . This implies, intermediate firm (j) is deciding capital utilization twice : once in cost minimization problem in factor market and second in profit maximization in output market?
Is it correct/consistent?

Regards[/quote]

Do you have a pdf of the equations? It sounds like this wouldn’t make sense to have them optimizing over capacity utilization twice. Intermediate firms choose them in your model, right? That should give you the price of utilization and the household side should give a supply condition. You might want to lay out the context of the model – why you’re adding these mechanisms – in the future so it’s easier to follow the question

Thank you macroresearch123 and Professor Pfeifer. Yes, capital utilization rate is chosen by intermediate goods sector. Can I kindly refer you to the equations of Gertler and Karadi (2009)'s, henceforth GK, financial friction model? It is slightly different than my context, in the sense that, in GK, the intermediate goods sector is perfectly competitive in output market. So, in the profit maximization problem, intermediate firm chooses L, u and K. In this case, how do I explain the FOC with respect to u? Price of capital utilization ? Depreciation rate is a function of u. Final goods price is determined in monopolistically competitive retail sector. Capital price Q (Tobin’s Q) is determined in a separate capital producing sector, not in the household sector.

If I say instead that, intermediate sector is monopolistically competitive, then it minimizes costs in input markets and maximizes profit in output market by choosing its output price from the profit function. So there are two optimization problems in the intermediate sector. Now where does the u fit in, if I assume similar to GK (2009) that intermediate sector chooses capital utilization? And capital is produced by capital producing sector.

May be its a very simple issue that I got confused with due to my naive understanding. Sorry about this. Thanks in advance for your response.
GK model_2009.pdf (268 KB)