diff --git a/Makefile.am b/Makefile.am index d276440e3..50c7b192c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,9 +22,10 @@ EXTRA_DIST = \ license.txt \ windows/dynare.nsi \ windows/mexopts.bat \ - windows/README.txt + windows/README.txt \ + examples dist-hook: - rm -rf `find $(distdir)/matlab -name *~` + rm -rf `find $(distdir)/matlab $(distdir)/examples -name *~` rm -f $(distdir)/matlab/dynare_m$(EXEEXT) $(distdir)/matlab/dynare_version.m $(MKDIR_P) $(distdir)/mex/matlab $(distdir)/mex/octave diff --git a/doc/manual.xml b/doc/manual.xml index 173d02f91..62e3e998f 100644 --- a/doc/manual.xml +++ b/doc/manual.xml @@ -3995,6 +3995,31 @@ plot_conditional_forecast(periods = 10) e u; + + Examples + Dynare comes with a database of example .mod files, which are designed to show a broad range of Dynare features, and are taken from academic papers for most of them. You should have these files in the examples subdirectory of your distribution. + Here is a short list of the examples included. For a more complete description, please refer to the comments inside the files themselves. + + + ramst.mod + An elementary real business cycle (RBC) model, simulated in a deterministic setup. + + + example1.mod + example2.mod + Two examples of a small RBC model in a stochastic setup, presented in (see the file guide.pdf which comes with Dynare). + + + fs2000.mod + A cash in advance model, estimated by . + + + bkk.mod + Multi-country RBC model with time to build, presented in . + + + + @@ -4097,7 +4122,7 @@ plot_conditional_forecast(periods = 10) e u; - + @@ -4222,7 +4247,7 @@ plot_conditional_forecast(periods = 10) e u; - + @@ -4289,7 +4314,8 @@ plot_conditional_forecast(periods = 10) e u; Journal of Applied Econometrics 15 - 645-70 + 6 + 645-670 @@ -4337,5 +4363,46 @@ plot_conditional_forecast(periods = 10) e u; + + + + + Collard + Fabrice + + + 2001 + Stochastic simulations with Dynare: A practical guide + + + + + + + + Backus + David K. + + + Kehoe + Patrick J. + + + Kydland + Finn E. + + + 1992 + International Real Business Cycles + + + Journal of Political Economy + 100 + 4 + 745-775 + + + + diff --git a/examples/bkk.mod b/examples/bkk.mod new file mode 100644 index 000000000..aca08ebfd --- /dev/null +++ b/examples/bkk.mod @@ -0,0 +1,173 @@ +/* + * This file implements the multi-country RBC model with time to build, + * described in Backus, Kehoe and Kydland (1992): "International Real Business + * Cycles", Journal of Political Economy, 100(4), 745-775. + * + * The notation for the variable names are the same in this file than in the paper. + * However the timing convention is different: we had to taken into account the + * fact that in Dynare, if a variable is denoted at the current period, then + * this variable must be also decided at the current period. + * Concretely, here are the differences between the paper and the model file: + * - z_t in the model file is equal to z_{t+1} in the paper + * - k_t in the model file is equal to k_{t+J} in the paper + * - s_t in the model file is equal to s_{J,t}=s_{J-1,t+1}=...=s_{1,t+J-1} in the paper + * + * The macroprocessor is used in this file to create a loop over countries. + * Only two countries are used here (as in the paper), but it is easy to add + * new countries in the corresponding macro-variable and completing the + * calibration. + * + * The calibration is the same than in the paper. The results in terms of + * moments of variables are very close to that of the paper (but not equal + * since the authors a different solution method). + * + * This implementation was written by Sebastien Villemot. Please note that the + * following copyright notice only applies to this Dynare implementation of the + * model. + */ + +/* + * Copyright (C) 2010 Dynare Team + * + * This file is part of Dynare. + * + * Dynare is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Dynare is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Dynare. If not, see . + */ + +@#define countries = [ "H", "F" ] +@#define J = 4 + +@#for co in countries +var C_@{co} L_@{co} N_@{co} A_@{co} K_@{co} Z_@{co} X_@{co} LAMBDA_@{co} S_@{co} NX_@{co} Y_@{co}; + +varexo E_@{co}; + +parameters beta_@{co} alpha_@{co} eta_@{co} mu_@{co} gamma_@{co} theta_@{co} nu_@{co} sigma_@{co} delta_@{co} phi_@{co} psi_@{co} rho_@{co}_@{co}; +@#endfor + +// Lagrange multiplier of aggregate constraint +var LGM; + +parameters rho_@{countries[1]}_@{countries[2]} rho_@{countries[2]}_@{countries[1]}; + +model; +@#for co in countries + +Y_@{co} = ((LAMBDA_@{co}*K_@{co}(-@{J})^theta_@{co}*N_@{co}^(1-theta_@{co}))^(-nu_@{co}) + sigma_@{co}*Z_@{co}(-1)^(-nu_@{co}))^(-1/nu_@{co}); +K_@{co} = (1-delta_@{co})*K_@{co}(-1) + S_@{co}; +X_@{co} = +@# for lag in (-J+1):0 + + phi_@{co}*S_@{co}(@{lag}) +@# endfor +; + +A_@{co} = (1-eta_@{co})*A_@{co}(-1) + N_@{co}; +L_@{co} = 1 - alpha_@{co}*N_@{co} - (1-alpha_@{co})*eta_@{co}*A_@{co}(-1); + +// Utility multiplied by gamma +# U_@{co} = (C_@{co}^mu_@{co}*L_@{co}^(1-mu_@{co}))^gamma_@{co}; + +// FOC with respect to consumption +psi_@{co}*mu_@{co}/C_@{co}*U_@{co} = LGM; + +// FOC with respect to labor +// NOTE: this condition is only valid for alpha = 1 +psi_@{co}*(1-mu_@{co})/L_@{co}*U_@{co}*(-alpha_@{co}) = - LGM * (1-theta_@{co})/N_@{co}*(LAMBDA_@{co}*K_@{co}(-@{J})^theta_@{co}*N_@{co}^(1-theta_@{co}))^(-nu_@{co})*Y_@{co}^(1+nu_@{co}); + +// FOC with respect to capital +@# for lag in 0:(J-1) + +beta_@{co}^@{lag}*LGM(+@{lag})*phi_@{co} +@# endfor +@# for lag in 1:J + -beta_@{co}^@{lag}*LGM(+@{lag})*phi_@{co}*(1-delta_@{co}) +@# endfor + = beta_@{co}^@{J}*LGM(+@{J})*theta_@{co}/K_@{co}*(LAMBDA_@{co}(+@{J})*K_@{co}^theta_@{co}*N_@{co}(+@{J})^(1-theta_@{co}))^(-nu_@{co})*Y_@{co}(+@{J})^(1+nu_@{co}); + +// FOC with respect to stock of inventories + LGM=beta_@{co}*LGM(+1)*(1+sigma_@{co}*Z_@{co}^(-nu_@{co}-1)*Y_@{co}(+1)^(1+nu_@{co})); + +// Shock process +@# if co == countries[1] +@# define alt_co = countries[2] +@# else +@# define alt_co = countries[1] +@# endif + (LAMBDA_@{co}-1) = rho_@{co}_@{co}*(LAMBDA_@{co}(-1)-1) + rho_@{co}_@{alt_co}*(LAMBDA_@{alt_co}(-1)-1) + E_@{co}; + + +NX_@{co} = (Y_@{co} - (C_@{co} + X_@{co} + Z_@{co} - Z_@{co}(-1)))/Y_@{co}; + +@#endfor + +// World ressource constraint +@#for co in countries + +C_@{co} + X_@{co} + Z_@{co} - Z_@{co}(-1) +@#endfor + = +@#for co in countries + +Y_@{co} +@#endfor + ; + +end; + +@#for co in countries +beta_@{co} = 0.99; +mu_@{co} = 0.34; +gamma_@{co} = -1.0; +alpha_@{co} = 1; +eta_@{co} = 0.5; // Irrelevant when alpha=1 +theta_@{co} = 0.36; +nu_@{co} = 3; +sigma_@{co} = 0.01; +delta_@{co} = 0.025; +phi_@{co} = 1/@{J}; +psi_@{co} = 0.5; +@#endfor + +rho_H_H = 0.906; +rho_F_F = 0.906; +rho_H_F = 0.088; +rho_F_H = 0.088; + +initval; +@#for co in countries +LAMBDA_@{co} = 1; +NX_@{co} = 0; +Z_@{co} = 1; +A_@{co} = 1; +L_@{co} = 0.5; +N_@{co} = 0.5; +Y_@{co} = 1; +K_@{co} = 1; +C_@{co} = 1; +S_@{co} = 1; +X_@{co} = 1; + +E_@{co} = 0; +@#endfor + +LGM = 1; +end; + +shocks; +var E_H; stderr 0.00852; +var E_F; stderr 0.00852; +corr E_H, E_F = 0.258; +end; + +steady; +check; + +stoch_simul(order=1, hp_filter=1600, nograph); diff --git a/examples/example1.mod b/examples/example1.mod new file mode 100644 index 000000000..8fb9df1e8 --- /dev/null +++ b/examples/example1.mod @@ -0,0 +1,68 @@ +/* + * Example 1 from F. Collard (2001): "Stochastic simulations with DYNARE: + * A practical guide" (see "guide.pdf" in the documentation directory). + */ + +/* + * Copyright (C) 2001-2010 Dynare Team + * + * This file is part of Dynare. + * + * Dynare is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Dynare is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Dynare. If not, see . + */ + + +var y, c, k, a, h, b; +varexo e, u; + +parameters beta, rho, alpha, delta, theta, psi, tau; + +alpha = 0.36; +rho = 0.95; +tau = 0.025; +beta = 0.99; +delta = 0.025; +psi = 0; +theta = 2.95; + +phi = 0.1; + +model; +c*theta*h^(1+psi)=(1-alpha)*y; +k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1))) + *(exp(b(+1))*alpha*y(+1)+(1-delta)*k)); +y = exp(a)*(k(-1)^alpha)*(h^(1-alpha)); +k = exp(b)*(y-c)+(1-delta)*k(-1); +a = rho*a(-1)+tau*b(-1) + e; +b = tau*a(-1)+rho*b(-1) + u; +end; + +initval; +y = 1.08068253095672; +c = 0.80359242014163; +h = 0.29175631001732; +k = 11.08360443260358; +a = 0; +b = 0; +e = 0; +u = 0; +end; + +shocks; +var e; stderr 0.009; +var u; stderr 0.009; +var e, u = phi*0.009*0.009; +end; + +stoch_simul; diff --git a/examples/example2.mod b/examples/example2.mod new file mode 100644 index 000000000..09d505828 --- /dev/null +++ b/examples/example2.mod @@ -0,0 +1,67 @@ +/* + * Example 2 from F. Collard (2001): "Stochastic simulations with DYNARE: + * A practical guide" (see "guide.pdf" in the documentation directory). + */ + +/* + * Copyright (C) 2001-2010 Dynare Team + * + * This file is part of Dynare. + * + * Dynare is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Dynare is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Dynare. If not, see . + */ + + +var y, c, k, a, h, b; +varexo e, u; + +parameters beta, rho, alpha, delta, theta, psi, tau; + +alpha = 0.36; +rho = 0.95; +tau = 0.025; +beta = 0.99; +delta = 0.025; +psi = 0; +theta = 2.95; + +model; +exp(c)*theta*exp(h)^(1+psi)=(1-alpha)*exp(y); +exp(k) = beta*(((exp(b)*exp(c))/(exp(b(+1))*exp(c(+1)))) + *(exp(b(+1))*alpha*exp(y(+1))+(1-delta)*exp(k))); +exp(y) = exp(a)*(exp(k(-1))^alpha)*(exp(h)^(1-alpha)); +exp(k) = exp(b)*(exp(y)-exp(c))+(1-delta)*exp(k(-1)); +a = rho*a(-1)+tau*b(-1) + e; +b = tau*a(-1)+rho*b(-1) + u; +end; + +initval; +y = 0.1; +c = -0.2; +h = -1.2; +k = 2.4; +a = 0; +b = 0; +e = 0; +u = 0; +end; + +steady; + +shocks; +var e = 0.009^2; +var u = 0.009^2; +end; + +stoch_simul(periods=2000, drop=200); diff --git a/examples/fs2000.mod b/examples/fs2000.mod new file mode 100644 index 000000000..14e78d910 --- /dev/null +++ b/examples/fs2000.mod @@ -0,0 +1,118 @@ +/* + * This file replicates the estimation of the cash in advance model described + * Frank Schorfheide (2000): "Loss function-based evaluation of DSGE models", + * Journal of Applied Econometrics, 15(6), 645-670. + * + * The data are in file "fsdat_simul.m", and have been artificially generated. + * They are therefore different from the original dataset used by Schorfheide. + * + * The equations are taken from J. Nason and T. Cogley (1994): "Testing the + * implications of long-run neutrality for monetary business cycle models", + * Journal of Applied Econometrics, 9, S37-S70. + * Note that there is an initial minus sign missing in equation (A1), p. S63. + * + * This implementation was written by Michel Juillard. Please note that the + * following copyright notice only applies to this Dynare implementation of the + * model. + */ + +/* + * Copyright (C) 2004-2010 Dynare Team + * + * This file is part of Dynare. + * + * Dynare is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Dynare is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Dynare. If not, see . + */ + +var m P c e W R k d n l gy_obs gp_obs y dA; +varexo e_a e_m; + +parameters alp bet gam mst rho psi del; + +alp = 0.33; +bet = 0.99; +gam = 0.003; +mst = 1.011; +rho = 0.7; +psi = 0.787; +del = 0.02; + +model; +dA = exp(gam+e_a); +log(m) = (1-rho)*log(mst) + rho*log(m(-1))+e_m; +-P/(c(+1)*P(+1)*m)+bet*P(+1)*(alp*exp(-alp*(gam+log(e(+1))))*k^(alp-1)*n(+1)^(1-alp)+(1-del)*exp(-(gam+log(e(+1)))))/(c(+2)*P(+2)*m(+1))=0; +W = l/n; +-(psi/(1-psi))*(c*P/(1-n))+l/n = 0; +R = P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(-alp)/W; +1/(c*P)-bet*P*(1-alp)*exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)/(m*l*c(+1)*P(+1)) = 0; +c+k = exp(-alp*(gam+e_a))*k(-1)^alp*n^(1-alp)+(1-del)*exp(-(gam+e_a))*k(-1); +P*c = m; +m-1+d = l; +e = exp(e_a); +y = k(-1)^alp*n^(1-alp)*exp(-alp*(gam+e_a)); +gy_obs = dA*y/y(-1); +gp_obs = (P/P(-1))*m(-1)/dA; +end; + +initval; +k = 6; +m = mst; +P = 2.25; +c = 0.45; +e = 1; +W = 4; +R = 1.02; +d = 0.85; +n = 0.19; +l = 0.86; +y = 0.6; +gy_obs = exp(gam); +gp_obs = exp(-gam); +dA = exp(gam); +end; + +shocks; +var e_a; stderr 0.014; +var e_m; stderr 0.005; +end; + +steady; + +check; + +estimated_params; +alp, beta_pdf, 0.356, 0.02; +bet, beta_pdf, 0.993, 0.002; +gam, normal_pdf, 0.0085, 0.003; +mst, normal_pdf, 1.0002, 0.007; +rho, beta_pdf, 0.129, 0.223; +psi, beta_pdf, 0.65, 0.05; +del, beta_pdf, 0.01, 0.005; +stderr e_a, inv_gamma_pdf, 0.035449, inf; +stderr e_m, inv_gamma_pdf, 0.008862, inf; +end; + +varobs gp_obs gy_obs; + +estimation(order=1, datafile=fsdat_simul, nobs=192, loglinear, mh_replic=2000, mh_nblocks=2, mh_jscale=0.8); + + +/* + * The following lines were used to generate the data file. If you want to + * generate another random data file, comment the "estimation" line and uncomment + * the following lines. + */ + +//stoch_simul(periods=200, order=1); +//datatomfile('fsdat_simul', char('gy_obs', 'gp_obs')); diff --git a/examples/fsdat_simul.m b/examples/fsdat_simul.m new file mode 100644 index 000000000..56c0e4cd5 --- /dev/null +++ b/examples/fsdat_simul.m @@ -0,0 +1,416 @@ +% Generated data, used by fs2000.mod + +gy_obs =[ + 1.0030045 + 1.0002599 + 0.99104664 + 1.0321162 + 1.0223545 + 1.0043614 + 0.98626929 + 1.0092127 + 1.0357197 + 1.0150827 + 1.0051548 + 0.98465775 + 0.99132132 + 0.99904153 + 1.0044641 + 1.0179198 + 1.0113462 + 0.99409421 + 0.99904293 + 1.0448336 + 0.99932433 + 1.0057004 + 0.99619787 + 1.0267504 + 1.0077645 + 1.0058026 + 1.0025891 + 0.9939097 + 0.99604693 + 0.99908569 + 1.0151094 + 0.99348134 + 1.0039124 + 1.0145805 + 0.99800868 + 0.98578138 + 1.0065771 + 0.99843919 + 0.97979062 + 0.98413351 + 0.96468174 + 1.0273857 + 1.0225211 + 0.99958667 + 1.0111157 + 1.0099585 + 0.99480311 + 1.0079265 + 0.98924573 + 1.0070613 + 1.0075706 + 0.9937151 + 1.0224711 + 1.0018891 + 0.99051863 + 1.0042944 + 1.0184055 + 0.99419508 + 0.99756624 + 1.0015983 + 0.9845772 + 1.0004407 + 1.0116237 + 0.9861885 + 1.0073094 + 0.99273355 + 1.0013224 + 0.99777979 + 1.0301686 + 0.96809556 + 0.99917088 + 0.99949253 + 0.96590004 + 1.0083938 + 0.96662298 + 1.0221454 + 1.0069792 + 1.0343996 + 1.0066531 + 1.0072525 + 0.99743563 + 0.99723703 + 1.000372 + 0.99013917 + 1.0095223 + 0.98864268 + 0.98092242 + 0.98886488 + 1.0030341 + 1.01894 + 0.99155059 + 0.99533235 + 0.99734316 + 1.0047356 + 1.0082737 + 0.98425116 + 0.99949212 + 1.0055899 + 1.0065075 + 0.99385069 + 0.98867975 + 0.99804843 + 1.0184038 + 0.99301902 + 1.0177222 + 1.0051924 + 1.0187852 + 1.0098985 + 1.0097172 + 1.0145811 + 0.98721038 + 1.0361722 + 1.0105821 + 0.99469309 + 0.98626785 + 1.013871 + 0.99858924 + 0.99302637 + 1.0042186 + 0.99623745 + 0.98545708 + 1.0225435 + 1.0011861 + 1.0130321 + 0.97861347 + 1.0228193 + 0.99627435 + 1.0272779 + 1.0075172 + 1.0096762 + 1.0129306 + 0.99966549 + 1.0262882 + 1.0026914 + 1.0061475 + 1.009523 + 1.0036127 + 0.99762992 + 0.99092634 + 1.0058469 + 0.99887292 + 1.0060653 + 0.98673557 + 0.98895709 + 0.99111967 + 0.990118 + 0.99788054 + 0.97054709 + 1.0099157 + 1.0107431 + 0.99518695 + 1.0114048 + 0.99376019 + 1.0023369 + 0.98783327 + 1.0051727 + 1.0100462 + 0.98607387 + 1.0000064 + 0.99692442 + 1.012225 + 0.99574078 + 0.98642833 + 0.99008207 + 1.0197359 + 1.0112849 + 0.98711069 + 0.99402748 + 1.0242141 + 1.0135349 + 0.99842505 + 1.0130714 + 0.99887044 + 1.0059058 + 1.0185998 + 1.0073314 + 0.98687706 + 1.0084551 + 0.97698964 + 0.99482714 + 1.0015302 + 1.0105331 + 1.0261767 + 1.0232822 + 1.0084176 + 0.99785167 + 0.99619733 + 1.0055223 + 1.0076326 + 0.99205461 + 1.0030587 + 1.0137012 + 1.0145878 + 1.0190297 + 1.0000681 + 1.0153894 + 1.0140649 + 1.0007236 + 0.97961463 + 1.0125257 + 1.0169503 + 1.0197363 + 1.0221185 + +]; + +gp_obs =[ + 1.0079715 + 1.0115853 + 1.0167502 + 1.0068957 + 1.0138189 + 1.0258364 + 1.0243817 + 1.017373 + 1.0020171 + 1.0003742 + 1.0008974 + 1.0104804 + 1.0116393 + 1.0114294 + 0.99932124 + 0.99461459 + 1.0170349 + 1.0051446 + 1.020639 + 1.0051964 + 1.0093042 + 1.007068 + 1.01086 + 0.99590086 + 1.0014883 + 1.0117332 + 0.9990095 + 1.0108284 + 1.0103672 + 1.0036722 + 1.0005124 + 1.0190331 + 1.0130978 + 1.007842 + 1.0285436 + 1.0322054 + 1.0213403 + 1.0246486 + 1.0419306 + 1.0258867 + 1.0156316 + 0.99818589 + 0.9894107 + 1.0127584 + 1.0146882 + 1.0136529 + 1.0340107 + 1.0343652 + 1.02971 + 1.0077932 + 1.0198114 + 1.013971 + 1.0061083 + 1.0089573 + 1.0037926 + 1.0082071 + 0.99498155 + 0.99735772 + 0.98765026 + 1.006465 + 1.0196088 + 1.0053233 + 1.0119974 + 1.0188066 + 1.0029302 + 1.0183459 + 1.0034218 + 1.0158799 + 0.98824798 + 1.0274357 + 1.0168832 + 1.0180641 + 1.0294657 + 0.98864091 + 1.0358326 + 0.99889969 + 1.0178322 + 0.99813566 + 1.0073549 + 1.0215985 + 1.0084245 + 1.0080939 + 1.0157021 + 1.0075815 + 1.0032633 + 1.0117871 + 1.0209276 + 1.0077569 + 0.99680958 + 1.0120266 + 1.0017625 + 1.0138811 + 1.0198358 + 1.0059629 + 1.0115416 + 1.0319473 + 1.0167074 + 1.0116111 + 1.0048627 + 1.0217622 + 1.0125221 + 1.0142045 + 0.99792469 + 0.99823971 + 0.99561547 + 0.99850373 + 0.9898464 + 1.0030963 + 1.0051373 + 1.0004213 + 1.0144117 + 0.97185592 + 0.9959518 + 1.0073529 + 1.0051603 + 0.98642572 + 0.99433423 + 1.0112131 + 1.0007695 + 1.0176867 + 1.0134363 + 0.99926191 + 0.99879835 + 0.99878754 + 1.0331374 + 1.0077797 + 1.0127221 + 1.0047393 + 1.0074106 + 0.99784213 + 1.0056495 + 1.0057708 + 0.98817494 + 0.98742176 + 0.99930555 + 1.0000687 + 1.0129754 + 1.009529 + 1.0226731 + 1.0149534 + 1.0164295 + 1.0239469 + 1.0293458 + 1.026199 + 1.0197525 + 1.0126818 + 1.0054473 + 1.0254423 + 1.0069461 + 1.0153135 + 1.0337515 + 1.0178187 + 1.0240469 + 1.0079489 + 1.0186953 + 1.0008628 + 1.0113799 + 1.0140118 + 1.0168007 + 1.011441 + 0.98422774 + 0.98909729 + 1.0157859 + 1.0151586 + 0.99756232 + 0.99497777 + 1.0102841 + 1.0221659 + 0.9937759 + 0.99877193 + 1.0079433 + 0.99667692 + 1.0095959 + 1.0128804 + 1.0156949 + 1.0111951 + 1.0228887 + 1.0122083 + 1.0190197 + 1.0074927 + 1.0268096 + 0.99689352 + 0.98948474 + 1.0024938 + 1.0105543 + 1.014116 + 1.0141217 + 1.0056504 + 1.0101026 + 1.0105069 + 0.99619053 + 1.0059439 + 0.99449473 + 0.99482458 + 1.0037702 + 1.0068087 + 0.99575975 + 1.0030815 + 1.0334014 + 0.99879386 + 0.99625634 + 1.0171195 + 0.99233844 + +]; + diff --git a/examples/ramst.mod b/examples/ramst.mod new file mode 100644 index 000000000..df4029ad4 --- /dev/null +++ b/examples/ramst.mod @@ -0,0 +1,82 @@ +/* + * An elementary RBC model, simulated in a deterministic setup. + * + * The model is the following: this is a closed economy, with a representative + * agent. The utility is equal to 'c^(1-gam)/(1-gam)', where 'c' is consumption + * and 'gam' is relative risk aversion. The subjective discount is 'bet'. + * + * The production function equals 'aa*x*k(-1)^alph', where 'aa' is a constant, + * 'x' is a stochastic technology level variable, 'k' is capital (using + * end-of-period timing convention, which is Dynare's default), and 'alph' is + * another constant. + * + * Capital stock evolves according to the usual law of motion, where 'delt' + * is the depreciation rate. + */ + +/* + * Copyright (C) 2001-2010 Dynare Team + * + * This file is part of Dynare. + * + * Dynare is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Dynare is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Dynare. If not, see . + */ + + +// Endogenous variables: consumption and capital +var c k; + +// Exogenous variable: technology level +varexo x; + +// Parameters declaration and calibration +parameters alph gam delt bet aa; +alph=0.5; +gam=0.5; +delt=0.02; +bet=0.05; +aa=0.5; + +// Equilibrium conditions +model; +c + k - aa*x*k(-1)^alph - (1-delt)*k(-1); // Resource constraint +c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam); // Euler equation +end; + +// Steady state (analytically solved) +initval; +x = 1; +k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1)); +c = aa*k^alph-delt*k; +end; + +// Check that this is indeed the steady state +steady; + +// Check the Blanchard-Kahn conditions +check; + +// Declare a positive technological shock in period 1 +shocks; +var x; +periods 1; +values 1.2; +end; + +// Deterministic simulation of the model for 200 periods +simul(periods=200); + +// Display the path of consumption and capital +rplot c; +rplot k; diff --git a/windows/dynare.nsi b/windows/dynare.nsi index ce51ebfa2..98a382bcf 100644 --- a/windows/dynare.nsi +++ b/windows/dynare.nsi @@ -130,7 +130,7 @@ Section "Dynare++ (standalone executable)" File ..\dynare++\src\atlas.dll ..\dynare++\src\blas.dll ..\dynare++\src\cblas.dll ..\dynare++\src\lapack.dll ..\dynare++\src\libgcc_s_dw2-1.dll ..\dynare++\src\libgfortran-3.dll SectionEnd -Section "Documentation (Dynare and Dynare++)" +Section "Documentation and examples (Dynare and Dynare++)" SetOutPath $INSTDIR\doc File ..\doc\manual.pdf ..\doc\guide.pdf ..\doc\userguide\UserGuide.pdf ..\doc\bvar-a-la-sims.pdf ..\doc\dr.pdf ..\doc\macroprocessor\macroprocessor.pdf ..\doc\preprocessor\preprocessor.pdf @@ -141,6 +141,12 @@ Section "Documentation (Dynare and Dynare++)" File ..\dynare++\doc\dynare++-tutorial.pdf ..\dynare++\doc\dynare++-ramsey.pdf ..\dynare++\sylv\sylvester.pdf ..\dynare++\tl\cc\tl.pdf ..\dynare++\integ\cc\integ.pdf ..\dynare++\kord\kord.pdf CreateShortcut "${SMLOC}\Documentation.lnk" "$INSTDIR\doc" + + SetOutPath $INSTDIR\examples + File ..\examples\* + + CreateShortcut "${SMLOC}\Examples.lnk" "$INSTDIR\examples" + SectionEnd Section "Uninstall" @@ -155,6 +161,7 @@ Section "Uninstall" Rmdir /r $INSTDIR\mex Rmdir /r $INSTDIR\dynare++ Rmdir /r $INSTDIR\doc + Rmdir /r $INSTDIR\examples # We don't force deletion of installation directory (with /r), to avoid deleting important files Rmdir $INSTDIR