Skip to content

Commit

Permalink
ready to run DSGE GMM and ML montecarlos
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Creel committed May 30, 2024
1 parent f580fa6 commit b405204
Show file tree
Hide file tree
Showing 73 changed files with 2,752 additions and 1,072 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ nss =1/3;
model;
MUC = (c)^(-gam);
MUL = psi*exp(z2);
r = alppha * exp(z1) * (k(-1))^(alppha-1) * n^(1-alppha);
w = (1-alppha)*exp(z1)* (k(-1))^alppha * n^(-alppha);
r = alppha * exp(z1) * (k)^(alppha-1) * n^(1-alppha);
w = (1-alppha)*exp(z1)* (k)^alppha * n^(-alppha);
MUC = betta*MUC(+1) * (1 + r(+1) - delta);
MUL/MUC = w;
z1 = rho1*z1(-1) + sigma1*e1;
z2 = rho2*z2(-1) + sigma2*e2;
y = exp(z1) * ((k(-1))^alppha) * (n^(1-alppha));
y = exp(z1) * ((k)^alppha) * (n^(1-alppha));
invest = y - c;
k = invest + (1-delta)*k(-1);
k = invest(-1) + (1-delta)*k(-1);
end;

shocks;
Expand Down Expand Up @@ -56,27 +56,26 @@ z1 = 0;
z2 = 0;
end;

steady;

stoch_simul(order=1);


estimated_params;
// start values for the optimization
// the numbers after the comment are the true
// values used to generate the data.
betta , 0.99 , uniform_pdf , 0.9724 , 0.01299; // 0.99
gam , 2.0 , uniform_pdf , 2.5 , 1.4434; // 2.0
rho1 , 0.9 , uniform_pdf , 0.4975 , 0.28723; // 0.9
sigma1 , 0.02 , uniform_pdf , 0.05 , 0.02887; // 0.02
rho2 , 0.7 , uniform_pdf , 0.4975 , 0.28723; // 0.7
sigma2 , 0.01 , uniform_pdf , 0.05 , 0.02887; // 0.01
nss , .3333 , uniform_pdf , 0.3125 , 0.03608; // 1/3
gam , 2.0 , uniform_pdf , 2.5 , 1.4434; // 2.0
rho1 , 0.9 , uniform_pdf , 0.4975 , 0.28723; // 0.9
sigma1 , 0.02 , uniform_pdf , 0.05 , 0.02887; // 0.02
rho2 , 0.7 , uniform_pdf , 0.4975 , 0.28723; // 0.7
sigma2 , 0.01 , uniform_pdf , 0.05 , 0.02887; // 0.01
nss , .3333 , uniform_pdf , 0.3125 , 0.03608; // 1/3
end;

varobs y w; // experiment choosing one or two from y c n r w
// try one or the other of the following. If you change variable
// you may need to change mh_jscale to get good acceptance rate

varobs c n; // experiment choosing one or two from y c n r w
estimation(order=1, datafile='dsgedata.csv', mh_replic=20000, mh_nblocks=4, mh_jscale=2.) ;

// Does a single fairly short chain
estimation(order=1, datafile='dsgedata.csv', mh_replic=20000, mh_jscale=7.) ;
//varobs y n; // experiment choosing one or two from y c n r w
//estimation(order=1, datafile='dsgedata.csv', mh_replic=20000, mh_nblocks=4, mh_jscale=5.) ;


75 changes: 0 additions & 75 deletions Examples/DSGE/Bayesian/CKmcmc_cn.log

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions Examples/DSGE/Bayesian/Estimate.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Dynare, Serialization, Statistics

context = @dynare "CKmcmc_cn.mod"
context = @dynare "CK.mod"

chain = deserialize("CKmcmc_cn/output/mcmc_chain_1.jls")
chain = deserialize("CK/output/mcmc_chain_1.jls")
mean(chain.value[:,1:end-1],dims=1)
Binary file modified Examples/DSGE/Bayesian/MCMC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/DSGE/Bayesian/MCMC2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Examples/DSGE/Bayesian/MonteCarlo/CK.txt
Loading

0 comments on commit b405204

Please sign in to comment.