Stochastic simulations with DYNARE. A practical guide. Fabrice Collard (GREMAQ,
Stochastic simulations with DYNARE. A practical guide. Fabrice Collard (GREMAQ, University of Toulouse) Adapted for Dynare 4.1 by Michel Juillard and S´ ebastien Villemot (CEPREMAP) First draft: February 2001 This draft: December 2009. This document describes a model involving both endogenous and exogenous state variable. We first describe the theoretical model, before showing how the perturbation method is implemented in DYNARE. 1 A theoretical model We consider an economy that consists of a large number of dynastic households and a large number of firms. Firms are producing a homogeneous final product that can be either consumed or invested by means of capital and labor services. Firms own their capital stock and hire labor supplied by the households. Households own the firms. In each and every period three perfectly competitive markets open — the markets for consumption goods, labor services, and financial capital in the form of firms’ shares. Household preferences are characterized by the lifetime utility function: Et ∞ X τ=t β⋆τ−t log(ct) −θ h1+ψ t 1 + ψ ! (1) where 0 < β⋆< 1 is a constant discount factor, ct is consumption in period t, ht is the fraction of total available time devoted to productive activity in period t, θ > 0 and ψ ⩾0. We assume that there exists a central planner that determines hours, consumption and capital accumulation maximizing the household’s utility function subject to the following budget constraint ct + it = yt (2) where it is investment and yt is output. Investment is used to form physical capital, which accumulates in the standard form as: kt+1 = exp(bt)it + (1 −δ)kt with 0 < δ < 1 (3) where δ is the constant physical depreciation rate. bt is a shock affecting incorpo- rated technological progress, which properties will be defined later. 1 Output is produced by means of capital and labor services, relying on a constant returns to scale technology represented by the following Cobb–Douglas production function: yt = exp(at)kα t h1−α t with 0 < α < 1 (4) at represents a stochastic shock to technology or Solow residual. We assume that the shocks to technology are distributed with zero mean, but display both persis- tence across time and correlation in the current period. Let us consider the joint process (at, bt) defined as at bt = ρ τ τ ρ at−1 bt−1 + εt νt (5) where |ρ + τ| < 1 and |ρ −τ| < 1 for sake of stationarity and E(εt) = 0, E(νt) = 0, E(εtεs) = σ2 ε if t = s 0 if t ̸= s , E(νtνs) = σ2 ν if t = s 0 if t ̸= s , E(εtνs) = ϕσεσν if t = s 0 if t ̸= s . 2 Dynamic Equilibrium The dynamic equilibrium of this economy follows from the first order conditions for optimality: ctθh1+ψ t = (1 −α)yt βEt exp(bt)ct exp(bt+1)ct+1 exp(bt+1)αyt+1 kt+1 + 1 −δ = 1 yt = exp(at)kα t h1−α t kt+1 = exp(bt)(yt −ct) + (1 −δ)kt at = ρat−1 + τbt−1 + εt bt = τat−1 + ρbt−1 + νt 3 The DYNARE code The DYNARE code is straightforward to write, as the equilibrium is written in the natural way. The whole code is reported at the end of the section. Before that we proceed step by step. 2 Preamble The preamble consists of the some declarations to setup the endoge- nous and exogenous variables, the parameters and assign values to these parame- ters. 1. var y, c, k, h, a, b; specifies the endogenous variables in the model since we have output (y), consumption (c), capital (k), hours (h) and the two shocks (a, b). 2. varexo e, u; specifies the exogenous variables in the model — namely the innovations of the shocks, since we have the innovation of the non– incorporated shock (e), and the innovation of the incorporated shock (u). 3. parameters list; specifies the list of parameters of the model. In the case we are studying: parameters beta, alpha, delta, theta, psi, rho, tau; beta discount factor alpha capital elasticity in the production function delta depreciation rate theta disutility of labor parameter psi labor supply elasticity rho persistence tau cross–persistence 4. Assignment of parameter values. This is done the standard way in MATLAB. For example, we write alpha = 0.36; rho = 0.95; tau = 0.025; beta = 0.99; delta = 0.025; psi = 0; theta = 2.95; 5. Note that ϕ, the conditional correlation of the shocks, is not, strickly speak- ing, a parameter of the recursive equations and doesn’t need to be listed in the parameters instruction. It may however be convenient to express it as a parameter in the expression of the variance–covariance matrix of the shocks (see below) and one may simply write: phi = 0.1; Declaration of the model: This step is done in a straightforward way. It starts with the instruction model; and ends with end;, in between all equilibrium conditions are written exactly the way we write it “by hand”. However, there is a 3 simple rule that should be kept in mind when the model is written. Let us consider a variable x: • If x is decided in period t then we simply write x. • When the variable is decided in t −1, such as the capital stock in our simple model, we write x(−1). • Finally, when a variable is decided in the next period, t + 1, such as con- sumption in the Euler equation, we write x(+1). Hence the required code to declare our model in DYNARE will be: 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; Assume now that we want to take a Taylor series expansion in logs rather than in level, we just rewrite the model as 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; so that the level of consumption is actually given by exp(c). Solving the model 1. Now we need to provide numerical initial conditions for the computation of the deterministic steady state. This is done with the sequence between initval; and end;. Each variable, endogenous or exogenous, should be initialized. In our example, we give the exact values of the deterministic equilibrium in absence of shocks. This takes the form 4 initval; y = 1.08068253095672; c = 0.80359242014163; h = 0.29175631001732; k = 11.08360443260358; a = 0; b = 0; e = 0; u = 0; end; Alternatively, we could provide only approximated values. DYNARE would then automatically compute the exact values. 2. We then specify the innovations and their matrix of variance–covariance. This is done using a shocks; and end; block and declare only the nonzero elements of the covariance matrix: shocks; var e; stderr 0.009; var u; stderr 0.009; var e, u = phi*0.009*0.009; end; Note that it is possible to shut down a shock by assigning it a zero variance. 3. The model is then solved and simulated using the stoch simul; com- mand. By default, the coefficients of the approximated decision rules are reported as well as the moments of the variables and impulse response func- tions for each exogenous shocks are ploted. In addition, the following op- tions are available (out of many others): • ar = Integer: Order of autocorrelation coefficients to compute and to print (default = 5) • periods = Integer: If different from zero, the model will be simu- lated and empirical moments will be computed instead of theoretical moments. The value of the option specifies the number of periods to use in the simulations (default = 0) • nocorr: Doesn’t print the correlation matrix (default = PRINT) • drop = Integer: Number of points dropped at the beginning of simu- lation before computing the summary statistics (default = 100) • irf = Integer: Number of periods on which to compute the IRFs (de- fault = 40) 5 • nofunctions: Doesn’t print the coefficients of the approximated solution • nomoments: Doesn’t print moments of the endogenous variables • order = [1,2,3]: Order of Taylor approximation (default = 2) • replic = Integer: Number of simulated series used to compute the IRFs (default = 1, if order = 1, and 50 otherwise) In our first example, we use simply: stoch_simul; DYNARE will compute theoretical moments of variables. In our second example, we use: stoch_simul(periods=2000, drop=200); DYNARE will compute simulated moments of variables. The simulated tra- jectories are returned in MATLAB vectors named as the variables (be careful not to use MATLAB reserved names such as INV for your variables ...). A DYNARE code for the model in level Here is the model file for the model in level. It can be found in file example1.mod. var y, c, k, a, h, b; varexo e, u; parameters uploads/Finance/ guide-pdf 4 .pdf
Documents similaires







-
46
-
0
-
0
Licence et utilisation
Gratuit pour un usage personnel Attribution requise- Détails
- Publié le Apv 11, 2022
- Catégorie Business / Finance
- Langue French
- Taille du fichier 0.1049MB