logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Dennison BertonBusiness
(5/5)

783 Answers

Hire Me
expert
Kim WoodLaw
(5/5)

641 Answers

Hire Me
expert
Janet FearnleyPsychology
(4/5)

956 Answers

Hire Me
expert
Bimla RastogiResume writing
(5/5)

791 Answers

Hire Me
MATLAB
(5/5)

linear rational expectations models are solved numerically on the computer. Several Matlab programs are available freely on the web as many authors complement

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Tutorial on Dynare

1 Introduction to Dynare

In practice, linear rational expectations models are solved numerically on the computer. Several Matlab programs are available freely on the web as many authors complement their papers with a program that implements their suggested solution method. Dynare, however, is a popular Matlab-based program for solving models that allow the models to be written in a more natural form. Dynare is a suite of programs that solve linear rational expectations models.

1.1 Getting started

To run Dynare, one has to use Mathworks MATLAB.

• Download the latest Dynare Windows installer at www.dynare.org (which will be Dynare 4.3.x)

• To install Dynare, double-click on the Dynare installer and follow the instructions.

• Run MATLAB

• Configure MATLAB for Dynare (using MATLABs command window):

– Type: addpath c:\dynare\4.3.x\matlab

(You will have to do this every time you start MATLAB, as at least older versions of MATLAB will not remember the setting.)

Now MATLAB is prepared for the use of Dynare.

1.2 Running and Editing a Dynare *.mod-File

In order to give instructions to Dynare, the user has to write a model file whose filename extension has to be example.mod (instead of just .m). This file contains the description of the model and the computing tasks required by the user. Once the model file is written, Dynare is invoked using the dynare-command at the MATLAB prompt (with the filename of the .mod given as argument).

• Create a working directory that will hold your Dynare-files. For example, c:\dynare\work.

• After writing your example model file, save it to your working directory. (Note that dynare-files use the extension .mod instead of just .m)

• At the MATLAB command window type the following to change the working directory of MATLAB: cd c:\dynare\work

• Now type the following to run the example model file: dynare example (without any extension!)

• If you want to edit your .mod-file type the following: edit example.mod.

A Dynare model file contains a list of commands and of blocks. Each command and each element of a block is terminated by a semicolon (;). Blocks are terminated by end;. This terminations are mandatory in Dynare. To forget one or more of these terminations is one of the most common reasons for issuing error messages.

In the following, we discuss how to use dynare to solve the linear rational expectations model.

2 Solving/Simulating the RBC Model with Dynare - A Code Example

2.1 The linear model

Now consider the RBC model with labor supply. The linearized model is given by

y = C∗ c

t Y ∗ t

+ δ K∗ i

Y ∗ t

c = E c

kt = (1 − δ)kt−1 + δit yt = αkt + (1 − α)nt + at

ηnt + σct = yt − nt

— ( 1 ) α ( Y ∗ ) (E y— k )

at = ρat−1 + εt

where c, y, k, n, i and a denote consumption, output, capital, labor, investment, and technology, respectively. It is also assumed that εt is i.i.dN (0, sda2). The steady-state values are given by

Y ∗ 1 1

K∗ = 1 − α ∗ (β − 1 + δ)

I∗ 1

Y ∗ = δ ∗ ( Y ∗ )

C∗ I∗

Y ∗ = 1 − Y ∗

Calibration of the model yields, α = 0.33, δ = 0.012, ρ = 0.95, the standard deviation of technology, sda = 0.007, β = 0.987, σ = 2 and η = 2.

2.2 Writing the example code: rbc. mod

2.2.1 Intro

In the .mod file, it is better to write the name of the model. For example,

% Basic RBC Model

% rbc.mod

Matlab does not recognize any word or sentence typed after

2.2.2 Preamble

The preamble consists of the declarations to setup the endogenous variables, the exogenous variables as well as the parameters and assigns values to these parameters.

1. First of all the endogenous variables of the model like output (y), capital (k), investment

(i) etc. must be specified:

var y c k i n a;

2. After the endogenous variables the exogenous variables (i.e. the shock εt) of the model must be specified:

varexo e;

3. Now follows the list of parameters:

parameters alpha delta rho sigma beta eta sda; parameters Y\_K C\_Y I\_Y;

4. The assignment of parameter values

alpha = 0.66;

delta = 0.012;

rho = 0.95;

sda = 0.007;

beta = 0.987;

sigma = 2;

eta = 2;

Y\_K = (1/1-alpha)*(1/beta -1 +delta); I\_Y = delta*(1/Y\_K);

C\_Y = 1 - I\_Y;

2.2.3 Declaration of the Model This step starts with the instruction model(linear);

or just with model; which declares the model as being non-linear.

Now all equilibrium conditions of the model are written exactly the way you would write them on a piece of paper. However, there are very simple rules to follow concerning variables:

• for variables decided in t (like xt) write x

• for variables decided in t1 (like xt1) write x(−1)

• for variables decided in t + 1 (like xt+1) write x(+1)

model(linear);

y - n = eta*n + sigma*c;

c = c(+1) - (1/sigma)*(alpha)*Y\_K*(y(+1) - k); C\_Y*c + I\_Y*i = y;

y = alpha*k(-1) + (1-alpha)*n + a; delta*i = k-(1-delta)*k(-1);

a = rho*a(-1)+e; end;

Note that there must be as many equations as there are endogenous variables in the model, ex-

cept when computing the unconstrained optimal policy with ramsey policy or discretionary policy. The declaration (or the block) of the model ends with end;

2.2.4 Solving the Model

A typical experiment is to study the effects of a temporary shock after which the system goes back to the original equilibrium (if the model is stable. . . ). A temporary shock is a temporary change of one or several exogenous variables of the model. Temporary shocks are specified within the next block between the commands shocks; and end;:

Another typical experiment in a deterministic context is to study the transition of one equilibrium position to another, it is equivalent to analyze the consequences of a permanent shock and this in done in Dynare through the proper use of initval and endval.

To get Dynare to compute the steady state values just add:steady;

To get informations about the eigenvalues and, thus, about the stability of the model (i.e. if its specification satisfies the Blanchard-Kahn condition) just add:

check;

The model is then solved and simulated using the stoch simul-command for 20 periods

stoch_simul((hp_filter = 1600,irf=20,,order = 1)

which solves a stochastic (i.e. rational expectations) model, using QZ techniques. More pre- cisely, stoch simul; computes the decision and transition functions for the model around the steady-state. Using them, it computes impulse response functions as the difference between the trajectory of a variable following a shock at the beginning of period 1 and its steady state value as well as various descriptive statistics (moments, variance decomposition, correlation and autocorrelation coefficients). By default, the

• coefficients of the approximated decision rules as well as

• moments of the variables are reported and

• impulse response functions for each exogenous shock are plotted

Before calculating the second moments, the Hodrick-Prescott Filter(short: HP-Filter) to re- move a smooth trend from data is sometimes applied. For Quarterly data, it is normally set as λ = 1600 Then, we can add option (hp filter = 1600) to stoch simul. Since we only deal with first order approximation in this model, the order=1 must be specified in stoch simul. Note that while running the dynare code it stores the values of the endogenous variables of each period in corresponding vectors. For example, since all of our endogenous variables response to the shock e dynare names them ce, ye, ie and so on (see figure 1). This is very convenient because the default dynare plots arent very pretty so that we have the opportunity to plot the impulse-response-functions the way we want. We can write the name of an endogenous variable. This permits to limit output to those variables listed here. For example,

stoch_simul((hp_filter = 1600,irf=20,,order = 1) y c

Then output is produced only for y and c.

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme