Page 1 of 2
A simple neoclassical model
Posted:
Tue Oct 07, 2014 12:18 pm
by zhuzixiang
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?
Re: A simple neoclassical model
Posted:
Tue Oct 07, 2014 12:37 pm
by jpfeifer
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.
Re: A simple neoclassical model
Posted:
Tue Oct 07, 2014 1:11 pm
by zhuzixiang
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.
Re: A simple neoclassical model
Posted:
Mon Dec 15, 2014 3:01 am
by sadia
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.
Re: A simple neoclassical model
Posted:
Tue Dec 16, 2014 6:41 pm
by jpfeifer
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.
Re: A simple neoclassical model
Posted:
Thu Dec 18, 2014 8:31 am
by sadia
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.
Re: A simple neoclassical model
Posted:
Thu Dec 18, 2014 4:07 pm
by jpfeifer
Re: A simple neoclassical model
Posted:
Mon Dec 29, 2014 2:29 am
by sadia
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.
Re: A simple neoclassical model
Posted:
Mon Dec 29, 2014 10:10 am
by jpfeifer
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.
Re: A simple neoclassical model
Posted:
Tue Dec 30, 2014 3:05 am
by sadia
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.
Re: A simple neoclassical model
Posted:
Mon Jan 05, 2015 3:07 am
by sadia
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.
Re: A simple neoclassical model
Posted:
Tue Jan 06, 2015 9:34 pm
by jpfeifer
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.
Re: A simple neoclassical model
Posted:
Thu Jan 08, 2015 11:09 pm
by sadia
Okay I got it now. Thanks Professor.
Re: GK financial friction model
Posted:
Thu Feb 05, 2015 8:27 am
by 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
Re: GK financial friction model
Posted:
Thu Feb 05, 2015 10:02 pm
by 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. 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