introduction to e-views - comesa monetary institute...

40
Introduction to E-views By Tinashe Bvirindi [email protected]

Upload: truongkien

Post on 30-Aug-2018

232 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Introduction to E-views

By

Tinashe Bvirindi

[email protected]

Page 2: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Introduction

• Opening an Eviews workfile

• Loading data into e-views– Direct load

– Importing

– Command/program based importation

• Performing data transformations

• Basic equation estimation

• Diagnostic tests

• Building a model

• Forecasting and policy simulations

Page 3: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Opening an Eviews work file

To open a new work file go to file, New, then select work file

Page 4: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Opening an Eviews workfile

• Once the workfile option is selected the following window will appear

Page 5: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Opening and eviews wok file

Choose the structureOf the data

Page 6: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Opening an eviews work file

Select the frequency of the data

Page 7: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Opening an Eviews workfile

Insert data range,name the work fileand assign a page

Page 8: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Workfile

• Once the structure of the workfile and the data range has been set the following window appear

Page 9: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Inputing data into eviews

• There are various ways to copy data into eviews:

– Direct copy and paste

– Copy and paste via empty group

– Importing from excel

– Importing data using a program (programing based technique)

Page 10: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Direct copy and paste

Click on quick, then choose the empty group series

Page 11: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Direct copy and paste

Page 12: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Direct copy and paste

Copy data directly from excel and paste in E-views

Page 13: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Direct copy and paste

Page 14: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

program based import

After you have created the work fileGo to file, New, Program to start importing using the program

Page 15: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Program based import

Page 16: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Program based import

• In the command window write the following command and run it.

read(b2,s=dta) d:\\comesaprc\tinasdatp.xlsx 22File path

Excel sheet in which data is contained

File type

Point at which command starts reading data

number of variables

Page 17: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Descriptive statistics

• To view the descriptive statistics of a data series first open the data series or the group of variables.

Page 18: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Descriptive statistics

Page 19: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Class exercise 1

• Load data into Eviews using the copy and paste technique

• Plot the following series :– Credit

– Nominal gdp

– Household consumption

– Private consumption

• Compute all descriptive statistics

• Compute the correlations between the four series

Page 20: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Data transformations and manipulation

Click on generate series

Page 21: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Generating series

Type the equation of choiceLcpi=log(cpi)

Page 22: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Generating series

Alternatively you can generate series and perform transformations using commands in this window

We can use the series or genr command e.g. type series lcpi=log(cpi)

Page 23: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Class exercise 21. Generate logs of the variables you have loaded in 1

using the Genr window

2. Compute the rate of inflation, year on year growth rate for GDP and the credit to GDP ratio

3. Generate differences of the series

4. In your groups, estimate an equation for:– Credit

– Inflation

– Imports

– exports

• Explain the reasoning behind the estimated equations and interpret coefficients

Page 24: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Class exercise 3

• Repeat 1 to 4 using a program

Page 25: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Financial cycle and business cycle:using the HP filter

By

Tinashe Bvirindi

Page 26: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

HP filter

• The Hodrick-Prescott Filter is a smoothingmethod that is widely used amongmacroeconomists to obtain a smooth estimateof the long-term trend component of a series.

• The method was first used in a working paper(circulated in the early 1980’s and publishedin1997) by Hodrick and Prescott to analyzepostwar U.S. business cycles.

Page 27: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

HP filter

• Technically, the Hodrick-Prescott (HP) filter is a two-sided linear filter that computes the smoothed series (s) of (Y) by minimizing the variance of (Y) around (s), subject to a penalty that constrains the second difference of (s)

• That is, the HP filter chooses to minimize (s):

Page 28: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

HP filter

Page 29: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

HP Filtering in E-views• To compute an HP filtered series in E-views you need to open

the data series

• Then go to procedures and select HP Filter

Page 30: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

HP filter

Name the new filtered series

Alternative is to use the RavanUhlig (2002) power rule and set power to 4

Page 31: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

HP Filter

-60

-40

-20

0

20

40

60

0

50

100

150

200

250

90 92 94 96 98 00 02 04 06 08 10

STCKPR Trend Cycle

Hodrick-Prescott Filter (lambda=1600)

Permanent trend

Page 32: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Countercyclical capital buffer • Designed to limit pro-cyclicality

• Configuration of the buffer based on deviations of credit to gdp ratio from longrun trends

• Buffer rules are that:

– Capital requirement 2.5% if deviation > 10%

– Proportional upto 2.5% if deviation is between 2% and 10%

– Zero if deviation is less than 2%

– Lamda provided by basel

Page 33: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Class exercise 4

• Generate filtered series for credit and nominal GDP

• Plot the business cycle against the financial cycle and comment

• Generate filtered credit to GDP ratio and compute countercyclical capital buffers requirements

Page 34: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Business and financial cycles

-.12

-.08

-.04

.00

.04

.08

.12

90 92 94 96 98 00 02 04 06 08 10

LTDC_CYCLE LNGDP_CYCLE

Page 35: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Countercyclical capital buffer

-17.00%

-14.50%

-12.00%

-9.50%

-7.00%

-4.50%

-2.00%

0.50%

3.00%

5.50%

8.00%

20

00

Q2

20

00

Q3

20

00

Q4

20

01

Q1

20

01

Q2

20

01

Q3

20

01

Q4

20

02

Q1

20

02

Q2

20

02

Q3

20

02

Q4

20

03

Q1

20

03

Q2

20

03

Q3

20

03

Q4

20

04

Q1

20

04

Q2

20

04

Q3

20

04

Q4

20

05

Q1

20

05

Q2

20

05

Q3

20

05

Q4

20

06

Q1

20

06

Q2

20

06

Q3

20

06

Q4

20

07

Q1

20

07

Q2

20

07

Q3

20

07

Q4

20

08

Q1

20

08

Q2

20

08

Q3

20

08

Q4

20

09

Q1

20

09

Q2

20

09

Q3

20

09

Q4

20

10

Q1

20

10

Q2

20

10

Q3

20

10

Q4

20

11

Q1

20

11

Q2

20

11

Q3

20

11

Q4

counter cyclical capital buffer

gap buffer

NB: The CCCBR is 2.5% if growth>10%, 0% if CG<2% and is adjusted proportionally to 2.5% if between 2% and 10%

Page 36: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Frequency/ Band pass filters

• They are used to isolate the cyclical componentof a time series by specifying a range for itsduration.

• The filter takes a two sided weighted movingaverage of the data where cycles in a band givenby the specified upper and lower limits arepassed through and the remaining filtered out.

• There are two types of filters i.e. fixed lengthsymmetric filters and full sample asymmetricfilters:

Page 37: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Frequency/Band pass filters

Fixed length symmetric filters– Baxter and King (1999) – Christiano and Fitzgerald (2003)

• Symmetric filters are time invariant since moving averages depend on the specified frequency range and do not use the full data

• Require same number of leads and lags and therefore loses endpoint information

Full sample asymmetric filter– Christiano and Fitzgerald (2003)

• Weights on the leads and lags are allowed to differ• Calculated to the end of the original sample

Page 38: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Frequency and band pass filters

• Fixed length symmetric filters the weight matrix is of dimension 1*(q+1) where q is the number of user specified lags

• Filtered series is computed as:

Page 39: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

Business cycle and financial cyclesBaxter and King (1998)

-.08

-.04

.00

.04

.08

.12

1975 1980 1985 1990 1995 2000 2005 2010

LNGDP_BP LTDC_BP

Page 40: Introduction to E-views - COMESA Monetary Institute …cmi.comesa.int/wp-content/uploads/2014/06/Introduction-to-Eviews.pdf · • Opening an Eviews workfile ... File path Excel sheet

References

• Borio. C. (2012), Financial cycles and macroeconomics, what we have learnt so far, BIS working papers No 395

• Haldane (2010), curbing the credit cycle, bank of England publications

• Introductory econometrics of finance

• Basic econometrics Gujarati

• W. Anders (2010), Applied time series analysis

• Greene(2005),

• Baxter and King (1998), deciphering the business cycle