2. Descriptive statistics in EViews - wiwi.uni …. Descriptive statistics in EViews Features of...

Preview:

Citation preview

2. Descriptive statistics in EViews

Features of EViews:

• Data processing(importing, editing, handling, exporting data)

• Basic statistical tools(descriptive statistics, inference, graphical tools)

• Regression analysis

• Time series analysis

• Specification diagnostics, specification testing

• Forecasting, simulation studies

• Programming

7

2.1. Introduction to EViews

Fundamental concept behind EViews:

• EViews is based on objects

Some typical EViews objects:

• Data series (single: series, collection of series: groups)

• graphs

• equations

How to enter EViews commands:

• Via the EViews menu (clicking)

• Via the command line (typing commands)

8

EViews screenshot

9

Basis of all EViews actions:

• workfile

Definition of a workfile:

• Container for all EViews objects with which you want to work(series, graphs, equations)

Features of a workfile:

• Prespecified data frequency

• Prespecified sampling period

10

Creating an EViews-workfile:

• Either by typing the command create

• Or by clicking through the menu items File/New/ Workfile

−→ dialogue requesting two pieces of information:

(1) Data frequency

(2) Start date and end date

11

Data frequency and data representation

Frequency Representationannual 2014, 2015, etc.

semi-annual 2015:1, 2015:2

quarterly 2015:1, ... , 2015:4

monthly 2015:01, ... , 2015:12

weekly mm/dd/yyyy,

e.g. 03/26/2015

daily (5 days weeks) mm/dd/yyyy

daily (7 days weeks) mm/dd/yyyy

integer date 1, ... , 150

12

Generating data series:

• Manual data input(invoking the EViews data editor by the command data)

• Importing data from external data bases(e.g. from Excel, Lotus, ...)

Afterwards, we may use data series

• to generate graphs

• in statistcial and econometric routines

13

Two fundamental EViews concepts:

• Transformating data series(via the genr command)

• Setting the active sample(via the smpl command)

Objective of many data transformations:

• Creating new data series from existing data series

14

Example:

Assume we are given the following series in EViews:

• EX RATE: the nominal Euro-USD exchange rate

• P EURO: the overall price level in Euroland

• P US: the overall price level in the US

Creating the real exchange-rate series:

• genr EX RATE REAL = EX RATE * P US / P EURO

15

Some operators and functions for the genr command

Operator Meaning Example+ Sum- Difference* Product/ Ratio^ Power genr H = (A+B/(H+K))^2log(x) Natural log genr Z = log(X)exp(x) Natural expabs(x) Absolute valuesqr(x) Square rootsin(x) Sinecos(x) Cosine genr Z = log(sqr(sin(Y)))

16

Lagged values (lag operator, lags):

• Let Pt denote an overall price level at date t

• The inflation rate πt between the dates t−1 and t is definedas

πt =Pt − Pt−1

Pt−1

Lag operator in EViews:

• Let P be the price-level series in EViews

• The inflation rates may be generated via the command

genr INFL RATE = (P-P(-1))/P(-1)

17

Setting the active sample:

• Sometimes, it may not be reasonable to consider all obser-vations of a series in statistical operations

• Via the smpl command we are able to restrict the data rangeto be processed

Example:

Assume that your worfile contains yearly GDP data between 1950and 2015:

• If you only need to consider the time period 1970 until 2010,you set

smpl 1970 2010

• Then, all subsequent EViews operations only process thesedata

18

Remarks:

• The smpl command allows us to further restrict our data basevia the if statement

• If you only need to analyze the years between 1970 and 2010,in which the inflation rate exceeded 2%, you set

smpl 1970 2010 if INFL RATE > 2.0

19

2.2. Descriptive statistics

Notation:

• Consider the data series x1, . . . , xT

• T is the number of observations, xt is the t-th observation

• The ordered series is x(1) ≤ x(2) ≤ . . . ≤ x(T )

20

Example:

Prices (in euros) of the mutual fund DEKALUX-JAPAN duringthe calender weeks #10 and #11 in 2002

Date t xt x(t)03/04/2002 1 527.54 x(3)03/05/2002 2 523.79 x(2)03/06/2002 3 521.92 x(1)03/07/2002 4 540.91 x(7)03/08/2002 5 551.68 x(9)03/11/2002 6 556.54 x(10)03/12/2002 7 543.45 x(8)03/13/2002 8 530.52 x(4)03/14/2002 9 534.60 x(5)03/15/2002 10 538.04 x(6)

21

2.2.1. Histogram and empirical cumulative distri-bution function

Definition 2.1: (Histogram)

The histogram divides the series range (the distance between themaximum and minimum values) into a number of equal lengthintervals (bins) and displays a count of the number of observa-tions that fall into each bin.

Definition 2.2: (Empirical cumulative distribution function)

Given the data series x1, . . . , xT , for every x ∈ R the empiricalcumulative distribution function FT : R→ [0,1] is defined as

FT (x) =number of xt ≤ x

T.

22

Histogram with descriptive statistics in EViews

23

0

1

2

3

520 525 530 535 540 545 550 555 560

Series: DEKALUXSample 3/04/2002 3/15/2002Observations 10

Mean 536.8990Median 536.3200Maximum 5 56.5400Minimum 5 21.9200Std. Dev. 11.51973Skewness 0.340804Kurtosis 2.018182

Jarque-Bera 0.595232Probability 0.742587

Empirical cumulative distribution function in EViews

24

0.0

0.2

0.4

0.6

0.8

1.0

524 528 532 536 540 544 548 552 556

Pro

ba

bili

ty

DEKALUX

2.2.2. Measures of a single series

Minimum, maximum:

• Formulae: xmin = x(1), xmax = x(T )

• EViews commands: =@min(DEKALUX), =@max(DEKALUX)

Arithmetic mean:

• Formula: x =1T· (x1 + x2 + . . . + xT ) =

1T·

T∑

t=1xt

• EViews command: =@mean(DEKALUX)

25

Median:

• Formula: xmed =

x([T+1]/2) , if T odd12 ·

[

x(T/2) + x([T+2]/2)

]

, if T even

• EViews command: =@median(DEKALUX)

Variance, standard deviation:

• Formulae: s2 =1

T − 1·

T∑

t=1(xt − x)2 , s =

1T − 1

·T

t=1(xt − x)2

• EViews commands: =@vars(DEKALUX), =@stdev(DEKALUX)

26

Skewness:

• Formula: xskew =1T

T∑

t=1

xt − x√

1T

∑Tt=1 (xt − x)2

3

• EViews command: =@skew(DEKALUX)

Kurtosis:

• Formula: xkurt =1T

T∑

t=1

xt − x√

1T

∑Tt=1 (xt − x)2

4

• EViews command: =@kurt(DEKALUX)

27

2.2.3. Covariance and correlation

Now:

• Assume that you have collected pairwise observations(x1, y1), . . . , (xT , yT ) for the two data series X and Y in EViews

Covariance:

• Formula: SXY =1

T − 1

T∑

t=1(xt − x)(yt − y)

• EViews command: =@covs(X,Y)

28

Correlation coefficient:

• Formula: RXY =SXY

SX · SY=

∑Tt=1(xt − x)(yt − y)

[

∑Tt=1(xt − x)2

] [

∑Tt=1(yt − y)2

]

• EViews command: =@cor(X,Y)

29