A simple neoclassical model

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

A simple neoclassical model

Postby zhuzixiang » Tue Oct 07, 2014 12:18 pm

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?
Attachments
CH_data_1981_2011.m
(1.23 KiB) Downloaded 112 times
BCA.mod
(4.95 KiB) Downloaded 146 times
zhuzixiang
 
Posts: 12
Joined: Sat Sep 06, 2014 3:36 am

Re: A simple neoclassical model

Postby jpfeifer » Tue Oct 07, 2014 12:37 pm

When I copy your code to a text-editor other than Matlab, I get
rho_P_13 , 0, 0 , Inf , normal_pdf, 0 , 0.20 ;
rho_P_14 , 0, 0 , Inf , normal_pdf, 0 , 0.20 ;

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: A simple neoclassical model

Postby zhuzixiang » Tue Oct 07, 2014 1:11 pm

jpfeifer wrote:When I copy your code to a text-editor other than Matlab, I get
rho_P_13 , 0, 0 , Inf , normal_pdf, 0 , 0.20 ;
rho_P_14 , 0, 0 , Inf , normal_pdf, 0 , 0.20 ;

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.



Thanks Pro.Pfeifer! I made it.
zhuzixiang
 
Posts: 12
Joined: Sat Sep 06, 2014 3:36 am

Re: A simple neoclassical model

Postby sadia » Mon Dec 15, 2014 3:01 am

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.
Attachments
Fred_data.xls
(28.5 KiB) Downloaded 108 times
sims.mod
(4.76 KiB) Downloaded 117 times
sadia
 
Posts: 46
Joined: Fri Dec 12, 2014 3:17 am
Location: Australia

Re: A simple neoclassical model

Postby jpfeifer » Tue Dec 16, 2014 6:41 pm

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: A simple neoclassical model

Postby sadia » Thu Dec 18, 2014 8:31 am

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.
Attachments
Fred_data.xls
(28.5 KiB) Downloaded 87 times
sims.mod
(4.77 KiB) Downloaded 95 times
sadia
 
Posts: 46
Joined: Fri Dec 12, 2014 3:17 am
Location: Australia

Re: A simple neoclassical model

Postby jpfeifer » Thu Dec 18, 2014 4:07 pm

------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: A simple neoclassical model

Postby sadia » Mon Dec 29, 2014 2:29 am

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.
Attachments
Fred_data.xls
(34 KiB) Downloaded 98 times
simstest.mod
(5.08 KiB) Downloaded 106 times
sadia
 
Posts: 46
Joined: Fri Dec 12, 2014 3:17 am
Location: Australia

Re: A simple neoclassical model

Postby jpfeifer » Mon Dec 29, 2014 10:10 am

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: A simple neoclassical model

Postby sadia » Tue Dec 30, 2014 3:05 am

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.
Attachments
Sudden Floods, Macroprudential Regulation and Stability in an Open Economy (Agenor et al., 2014).pdf
(986.49 KiB) Downloaded 113 times
sadia
 
Posts: 46
Joined: Fri Dec 12, 2014 3:17 am
Location: Australia

Re: A simple neoclassical model

Postby sadia » Mon Jan 05, 2015 3:07 am

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.
Attachments
Fred_data.xls
(34 KiB) Downloaded 108 times
simstest.mod
(5.16 KiB) Downloaded 109 times
sadia
 
Posts: 46
Joined: Fri Dec 12, 2014 3:17 am
Location: Australia

Re: A simple neoclassical model

Postby jpfeifer » Tue Jan 06, 2015 9:34 pm

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: A simple neoclassical model

Postby sadia » Thu Jan 08, 2015 11:09 pm

Okay I got it now. Thanks Professor.
sadia
 
Posts: 46
Joined: Fri Dec 12, 2014 3:17 am
Location: Australia

Re: GK financial friction model

Postby sadia » Thu Feb 05, 2015 8:27 am

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
sadia
 
Posts: 46
Joined: Fri Dec 12, 2014 3:17 am
Location: Australia

Re: GK financial friction model

Postby sadia » Thu Feb 05, 2015 10:02 pm

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
sadia
 
Posts: 46
Joined: Fri Dec 12, 2014 3:17 am
Location: Australia

Next

Return to Dynare help

Who is online

Users browsing this forum: No registered users and 11 guests