johannespfeifer / dsge_mod Goto Github PK
View Code? Open in Web Editor NEWA collection of Dynare models
License: GNU General Public License v3.0
A collection of Dynare models
License: GNU General Public License v3.0
In 1c85cdc the name of the file for the mode was changed, but the new file was not committed.
In Model 3, Equation (29) on page 171 of the original paper JIE published version, the authors use the specification
I suspect this to be a typo.
Best,
Camilo
Hallo Johannes,
Ich arbeite momentan am Paper "Understanding the effects of government spending on consumption" (Gali, Valles, Lopez-Salido - 2007). Ich habe einige Probleme, die IRFs zu replizieren.
Ich hatte mal im DynareForum gelesen, dass du schon an diesem Code (Mod.File) gearbeitet hattest.
Ich wäre dankbar für jede Hilfe, falls du dazu was hast.
Viele Grüße,
Louis
Hier der aktuelle Code:
var g
c
y
i
k
w
n
r
b
r_k
pi
q
mu_phat
t
kshare
labshare
lp
nu
;
varexo
epsG
epsnu
;
parameters
betta
alp
delta
mu_p
eta
lambda
theta
varphi
phi_pi
phi_g
phi_b
rho_g
rho_nu
zzeta
//The following are composite parameters
Gamma
sigma
Theta_n
Theta_t
lambda_p
//The following parameters are steady state relationships
rho
gamma_g
gamma_i
gamma_c
% Nss
% MCss
% Rss
% RKss
% Kss
% Yss
% Css
% Wss
% LSss
;
betta=0.99;
mu_p=1.2;
delta=0.025;
alp=1/3;
lambda=0.5;
theta=0.75;
varphi=0.2;
eta=1.0;
phi_pi=1.5;
phi_g=0.1;
phi_b=0.33;
gamma_g=0.2;
rho_g=0.9;
rho_nu=0.9;
zzeta=6; %elasticity of substitution between differentiated goods, yielding mu_p
// SS Relationships
rho=(1/betta)-1; %p.246
gamma_c=1-gamma_g-((deltaalp)/((rho+delta)(mu_p))); %Modified (cf. 2004 paper)
gamma_i=1-gamma_g-gamma_c;
// Perfectly competitive labour markets
lambda_p=((1-bettatheta)(1-theta))/theta;
Gamma=1/(mu_pvarphigamma_c+(1-alp)(1-lambda(1+varphi))); %p.244
sigma=(1-lambda)Gamma(mu_pvarphigamma_c+(1-alp)); %p.244
Theta_n=lambdaGamma(1-alp)(1+varphi)varphi; %p.244
Theta_t=lambdaGammamu_p*varphi; %p.244
// Imperfectly competitive labour markets
lambda_p=((1-bettatheta)(1-theta))/theta;
PHI = 1/(gamma_cmu_p - lambda(1-alp));
sigma=gamma_cPHI(1-lambda)mu_p;
Theta_n=lambdaPHI*(1-alp)(1+varphi);
Theta_t=lambdaPHI*mu_p;
model(linear);
// Households
[name='1. Tobins Q']
q=bettaq(+1)+(1-betta(1-delta))r_k(+1)-(r-pi(+1));
[name='2. Investment']
i-k(-1)=etaq;
[name='3. Capital Accumulation']
k=deltai+(1-delta)k(-1);
[name='4. Euler Equation (aggregate)']
c=c(+1)-sigma(r-pi(+1))-Theta_n(n(+1)-n)+Theta_t*(t(+1)-t); //(not sure whether this is really correct, particularly t and not t_r)
[name='5. Wage Schedule (competitive)']
w=c+varphi*n;
// Firms
[name='6. NKPC']
pi=bettapi(+1)-lambda_pmu_phat;
[name='7. Markup (1)']
mu_phat=y-n-w;
[name='8. Markup (2)']
mu_phat=y-k-r_k;
[name='9. Production Function']
y=(1-alp)n+alpk(-1);
// Market Clearing
[name='10. Market Clearing']
y=gamma_cc+gamma_ii+g; %surely there's a gamma_g missing before g in the paper?!
%If I add gamma_g, then I need to adapt the fiscal rule etc as well!
// Policy
[name='11. Taylor Rule']
r=phi_pipi+nu;
%r=Rss+phi_pipi; %leads to non-0 SS values
[name='12. Debt']
%b=(1+rho)(1-phi_b)b(-1)+(1+rho)(1-phi_g)g;
b=(1+rho)(b(-1)+g-t);
[name='13. FP Rule']
t=phi_bb(-1)+phi_g*g;
// Factor Shares
[name='14. Capital Share']
kshare = r_k+k(-1)-y;
[name='15. Labor Share']
labshare = w+n-y;
[name='16. Labor Productivity']
lp=y-n;
// Shock Processes
[name='17. Government Spending Shock']
g=rho_gg(-1)+epsG;
%Or with a news shock specification...
%g=rho_gg(-1)+epsG(-4);
[name='18. Monetary Policy Shock']
nu=rho_nu*nu(-1)+epsnu;
end;
shocks;
var epsG; stderr 1;
end;
resid(1);
steady;
check;
stoch_simul(order=1,irf=20,periods=1000);
Hi Johannes,
In Gali and Monacelli (5005) mod file, there is an error in the line 341. I'm using MatLab 2020a and Dynare 4.6.3. The variable var_string is a cell array, and var_string(var_iter) returns a cell, which results in an error. I believe a fix would be to replace var_string{var_iter} by var_string{var_iter}.
Best,
Eduardo
Dear Professor Pfeifer
today ,i download the newest DSGE_mod.zip file;
but the program has wrong. the matlab console reminder these messages:
Unrecognized function or variable 'Create_1_by_4_vola_figures'.
Error in BP2020_CES.driver (line 663)
Create_1_by_4_vola_figures
Error in dynare (line 293)
evalin('base',[fname '.driver']) ;
Error in run_model_IRF_generation_order_4 (line 22)
dynare BP2020_CES -Dsticky_prices=1 -Dsticky_wages=1
With the highest respect
Sincerely yours,
Daniel Tulips Liu
BeiJing,China.
The mode_file is taken for granted as input in the Smets & Wouters code. If I understand correctly it's obtained from M_.params
and M_.Sigma_e
from an initial run of the model without the Metropolis-Hastings algo. Then that is saved as a mode-file and used as input in the code with mode_file option and mode_compute = 0 with MH.
However, it's not clear how this mode_file is retrieved. I.e. which of the mode_compute options is used to retrieve the mode_file. I experimented a bit and believe it uses the default mode_compute = 4, which I would suggest is added to the documentation (if I didn't miss this) or as a step programatically.
Hi Professor, I have trying to replicate results in the paper and found your code is extremely helpful, especially for people like me who just start to use Dynare. So I got exact same IRF figures as what's shown in the paper. But for the asset returns data, it doesn't seem like quite right. I don't know if that's because we use second approximation instead of log linear asset pricing here. Here is the results I get based on your code and mod file. Numbers in the parenthesis is the results in the paper while those without parenthesis are from the code.
Another silly problem is, could you tell me or give me some hints on how to do log-linear asset pricing and calculate returns moments as in the paper? I searched a pile of papers and codes. None of them is using this approach and no one is writing it explicitly on how to actually do that. Any answer or recommendation would be helpful!!! I also built another model by substituting variable with exp(x). It produces same IRF. So it should be log-linear type of model, right? Then, how I am supposed to calculate expected risk free rate and so on?
Many thanks!!!!!
Hello,
Is there an easy way to run a counterfactual simulation with some of the estimated smoothed shocks being shut down? If this issue has already been discussed I would appreciate a link. The model file I am working with is for replicating Garcia-Cicco et al (2010).
Thank you
M
Hi,
I am trying to estimate by SMM with the relatively new Dynare toolbox a model with two binomial draws (a couple of random draws into the model will do the job). In fact, the binomial parameters, say p and q, are those among I would like to be estimated. Nonetheless, to the best of my understanding Dynare only supports normal shocks for the estimations.
Is there a way to generate random draws as opposed to Normal ones for the estimation in the SMM toolbox?
Alternatively, I was thinking whether there is a Dynare-implementable method to transform normal to random shocks (into the model part of the code) so that I can proceed with the SMM estimation.
Any help will be highly appreciated!
Dear all,
I am trying to extend the model in dynare! If I only want a single one with all two or three shocks at once, what I should do? I want to interpret all three shocks for, for example monetary , fiscal and oil price, at once.
Thanks a lot in advance
fhosseini
Dear Sir, I am running the file Ascari Sbordone 2014 using code available at the website. It shows the following error
Error using dynare (line 172)
dynare:: can't open Ascari.mod
please comments
Thank you
Hi, professor. I was having a discussion with you at the Dynare Forum, but by some reason the website is not working. So I will send some doubts here for both the CET 2016 problem that I was having and the replication of Gali_2015_chapter_7.mod:
Dear Prof. Pfeifer, thank you so much for your kind response.
I have 2 questions after trying your suggestion:
dynare_config
before calling dynare cet.mod
as you suggested. I don’t know exactly what the output after running this should’ve been, but I got this:`>> dynare_config
ans =
'/Applications/Dynare/4.6.4/matlab/‘`
Indeed, the problem with the data.m
file is not showing up, but now all I got for every file in the folder is:
`Error using cet_steadystate
Too many input arguments.
Error in evaluate_steady_state_file (line 49)
[ys,params1,check] = h_steadystate(ys_init, exo_ss,M,options);
Error in evaluate_steady_state (line 210)
[ys,params,info] = evaluate_steady_state_file(ys_init,exo_ss,M, options,steadystate_check_flag);
Error in resid (line 66)
evaluate_steady_state(oo_.steady_state,M_,options_,oo_,0);
Error in cet.driver (line 1103)
resid;
Error in dynare (line 293)
evalin('base',[fname '.driver']) ;`
There is a problem with calculating the steady state, but I really don’t want to make any changes in the function available… Do you have any suggestion?
Warning: Some of the parameters have no value (lambda_p, lambda_w) when using stoch_simul. If these parameters are not initialized in a steadystate file or a steady_state_model-block, Dynare may not be able to solve the model... Total computing time : 0h00m05s Note: 31 warning(s) encountered in the preprocessor Note: warning(s) encountered in MATLAB/Octave code
but there is indeed a steady_state_model-block (lines 221-224). What do you thing is the issue here?
Thank you very much!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.