Hitchhiker's Guide to EViews and Econometrics .fr

We will practice an actual statistical analysis using small data set. In this ... and there are two variables already in the workfile: C(constant) and resid(Residuals). 2. ..... need to understand the way EViews handle the pooled data structure.
88KB taille 13 téléchargements 369 vues
Hitchhiker’s Guide to EViews and Econometrics

January 2000

Byung-Joo Lee Department of Economics University of Notre Dame Notre Dame, IN 46556 [email protected] 219-631-6837

EViews’ User’s Guide This is a short guide to use EViews, the econometric software that we will use in this course. EViews program is available on the campus cluster computers with windows operating system NT@ND installed. We do not have Macintosh version of this program installed on the campus computers (Macintosh version is available for individual purchase directly from the publisher). To use this program, go to any campus cluster computers with NT@ND. From the Start menu, follow the link to Programs to Academic to Arts & Letters to Stats to EViews. Double click the EViews icon and you will be presented the EViews window.

Summary of the Program EViews is a windows graphical interfaced statistical software. This program simplifies many complicated statistical problems with a few simple mouse clicks. However, this program is also powerful enough to handle many state of the art econometrics problems. This program is a successor of MicroTSP from the same company. This program handles time-series analysis better than cross section data analysis. More flexible maximum likelihood estimation procedure is one major lacking point of EViews. There are two ways to execute this program. First you can perform many statistical functions with just using menu bar. You can also do the same task using EViews commands. We will use both ways to handle statistical problems.

Getting Started When you start EViews program, EViews window appears. The first line in the window is the title bar, labeled Econometrics Views. The second line is called the menu bar beginning with File. Each one of the entries has its own submenu as you double click your mouse. They are very similar to standard windows menu bar items. Each of those items will be explained later whenever necessary. There is a blank line right below the menu bar, and it is called the command window. This is the area that you type in the EViews command to perform statistical functions (As I mentioned in the previous section, you can just use menu bar to do the same task). The main area is the work area that will display the results of statistical tasks. Each result will have its own window and as you perform multiple statistical tasks, you will see several windows cascaded. You can drag each window to different position for your own viewing convenience. The very bottom line is the status line. This line is divided into three sections. The first one is a message section (from EViews to users), the second section shows the default directory that EViews will use to look for data and program. You can change the default directory by clicking the Update Default Directory in the directory setting window. The last section displays the current work file name. When you open EViews, this section shows that work file is untitled (because you did not name the work file yet).

1

Introductory Session This is an introductory session of EViews. This session only covers the most basic and necessary tools that we need to perform minimal regression analysis. The next section, Econometric Review, covers brief but fairly comprehensive topics of the most commonly used econometric models. We will practice an actual statistical analysis using small data set. In this practice, I will explain both using menu bar and EViews command. EViews command will be boldfaced. Our practice will appear as italics.

1. Begin EViews session and prepare for the workfile. You need to create workfile for any EViews session. Click on the File|New|Workfile. (Type CREATE in a command mode) A dialog box appears to ask the frequency of data: annual, semi-annual, quarterly, monthly, weekly, daily or undated. Select appropriate frequency and enter the starting and end period of data. For example, in the start period area, type 1960 for annual or 1960:1 for quarterly, monthly or weekly (you can use period instead of colon, e.g., 1960.1). The end period can be entered as 1969 (annual), 1969:4 (quarterly) or 1969:12(monthly), etc (see step 11 to enter data). For cross section data, choose none for data frequency and enter 1 in the start period and n (number of sample size) in the end period. Then, click OK. Now the workfile appears (currently showing as workfile:UNTITLED) and there are two variables already in the workfile: C(constant) and resid(Residuals).

2. Type in data for three series CONS, INCOME and CPI. To enter data manually, click on Quick|Empty Group(Edit Series). (Type DATA). Blank spreadsheet appears with the pre-specified frequency you entered in step 1. Click in the gray cell to enter the series (variable) name. This window is called the Group within your own work file. For each operation you do in your work file, you can name these as separate group or you can just discard to close the group windows. You can use any ASCII characters up to 8 characters. Start type in numeric data immediately below the series name. Type CONS (consumption) and press down arrow (DATA CONS) and start to type in 325, 335,… Data is at the end of this exercise. After finishing cons, go to the next column and in the gray area, type INCOME and type in 350, 364, 385,… Repeat this for another series CPI. (You can do all these three series at once by DATA CONS INCOME CPI). If you want to read a data from other file(ASCII file, Lotus *.WK3, or Excel *.XLS), click on Proc/Import Data in the workfile menu. Choose proper file format to read in and select data file from your directory. You will have a data dialog window that is asking the order of data (by observation or by series: most data is arranged by

2

observation) and series names (if they don’t have names). If data already have series names, simply type in how many series in the data set. EViews will read in all necessary data into the workfile. You can export selected series into any data file format by click on Proc/Export Data in the workfile menu.

3. Save and retrieve your current working file. When you are done entering all your data, you need to save your work file so that you can use it later. To save your working file, click on File|SaveAs and give appropriate file name (work file has an automatic extension of *.wf1) and path for your own (SAVE filename). In a later session when you need this work file back, you can retrieve by File|Open and find your appropriate work file (LOAD filename).

4. Generate real variables using nominal variables and price index. Note that CONS and INCOME are nominal terms. In order to use these variables in real terms, we need to modify these variables into real terms. In your current work file menu bar, there is a button for GENR. Click GENR (GENR), you will have a window asking equation and sample period. Enter appropriate equations to change nominal variables into real terms. Type RCONS(Real consumption)=CONS/CPI and adjust for sample period. Sample period is already entered as the entire period. Do the same for RINCOME (Real income).

5. Print CONS, INCOME, CPI, RCONS, RINCOME. If you want to look at your data, you can use SHOW command in the work file menu bar and type appropriate series name(s) (SHOW CONS INCOME). For a single series, you can just double click on its series name in the workfile directory. For a multiple series, highlight the entire series name in the workfile directory and click SHOW. You can type more than one series name in the series name window. You can print using PRINT menu in the work group menu bar (PRINT CONS INCOME).

6. Plot each series separately and simultaneously. You can a graph for a single or multiple series. You can also do this by View|Graphics under the Group menu (This is only available under the View in the Group menu, where you see the actual list of series, for example) (PLOT series name or PLOT series1, series2). Each series is plotted using different color. You can make multiple graphs by choosing View|Multiple Graphs in the Group menu.

3

7. Draw and print the scatter diagram of RCONS and RINCOME. To see the relationship between two variables, you can draw a scatter diagram between two variables (SCAT CONS, INCOME, first variable in the vertical axis and the second one in the horizontal axis). You can print this scatter diagram using PRINT command in the scatter diagram menu bar.

8. Calculate the correlation, covariance and test the Granger causality between RCONS and RINCOME. You can obtain descriptive statistics of each variables using Quick|Series Statistics for single series or Quick|Group Statistics for multiple series. You can obtain the same statistics under the View|Descriptive Stats under the Group menu. There are eight statistics that you can obtain under the View menu such that descriptive statistics, crosstab, correlations, covariances, correlogram, cross correlation, cointegration test, Granger causality.

9. Estimate the least squares regression of RCONS on RINCOME with intercept. Also estimate the same regression using nominal variables. If you want to run regression of RCONS on RINCOME with intercept, click on Object|New Object|Equation (or Quick|Estimate Equation). Before you click OK button, you can (optionally) give the name for your Object. It is not necessary, but this will make it easier for you to refer to your estimated equation later. In the Equation Specification window, you can type regression equation that you want to estimate, and choose appropriate estimation method (LS: Least Squares, TSLS: Two Stage Least Squares for Simultaneous Equation Estimation, ARCH, LOGIT and PROBIT etc). For simple least squares, type RCONS C RINCOME (LS RCONS C RINCOME) for regression of RCONS(Dependent Variable) on C(intercept) and RINCOME(explanatory variable).

10. Estimate the least squares regression of RCONS on last year’s RCONS, RINCOME with intercept. If you want to estimate the regression using different specification or different estimation technique or different sample period, repeat step 9 and modify appropriate estimation option. You can also include lagged values in the regression by using RCONS(-1) as one period lagged value of RCONS or RINCOME(-2) as two period lagged value of RINCOME.

11. The following is the dada set we used for this introductory session.

4

Year 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969

Cons 325 335 355 375 401 433 466 492 537 576

Income Cpi 350 0.887 364 0.896 385 0.906 405 0.917 438 0.929 473 0.945 512 0.972 547 1.000 590 1.042 630 1.098

5

Data Handling 1. Data Transformation You can transform most of data using GENR button in the workfile menu bar. Following are the most commonly used functions and operations. +, -, *, / >, 0 and zero otherwise. Depending on the assumptions about the error term, we define either Logit model ( u t has a Weibull distribution) or Probit model ( u t has a normal distribution). These models are estimated by maximum likelihood estimation with numerical iteration (typically by Newton-Raphson or BHHH method). Quick|Estimate Equation and type Y C X1 X2 in the Equation Specification window. Choose Logit or Probit in the Estimation Settings window. Specify appropriate sample period. LOGIT Y C X1 X2 PROBIT Y C X1 X2

6. Non-Linear Least Squares.

12

EViews automatically applies nonlinear least squares to any equation that is nonlinear in its coefficients. You can just specify nonlinear equation in the Equation Specification window. For example, if you want to estimate the CES production function with the following specification: Yt = A ⋅

{ ⋅K

− t

+ (1 −

)⋅ L t −

}

−1

, where (A, 

) are parameters

to be estimated.

Quick|Estimate Equation , and in the Equation Specification window, type Y = C(1) * (C(2) * K^ (-C(3)) + (1 − C(2)) * L^ (-C(3))^ (−1/C(3)) , where C’s are parameters to be estimated nonlinearly. Choose Least Squares in the Estimation Settings window.

7. Non-Stationary Time Series Analysis Time series data {y t }t =1 is nonstationary if its autocorrelation coefficient ( , see section to above) is one, i.e., this series explodes as time progresses and has no finite variance. If this is the case, we call that this series has a unit root ( = 1 ), or in a more technical notation, y t ~ I(1) , which means that the series y t has to be differenced once to be stationary. T

7.1. Unit Root Test General unit root test proceeds as follows: Consider the following regression model: y t = ⋅ y t −1 + u t . Testing the unit root hypothesis is equivalent to test to see if = 1 . This basic equation is modified to the following three equations. \ t = ⋅ y t −1 + u t \t =

+ ⋅ y t −1 + u t

\ t = + ⋅ y t −1 + ⋅ t + u t This is the basic Dickey-Fuller unit root test equation, and the testable hypothesis is = 0 (i.e., = 1 , y t has a unit root). There are three different tables depending on your testable equation (w/ or w/o intercept and/or trend variable). More general version of the original DK test is the Augmented DK test (ADF) as following. P

\ t = ⋅ y t −1 + ∑

p

p =1

⋅ \ t -p + 1 + u t

P

\t =

+ ⋅ y t −1 + ∑

\t =

+ ⋅ y t −1 + ⋅ t + ∑

p =1

p

⋅ \ t -p + 1 + u t P

p =1

13

p

⋅ \ t -p + 1 + u t

In the ADF test, we assume the error terms ( u t ) are independent and have constant variances. Also, the lag length P in the regression equation is rather arbitrary. To overcome this problem, Phillips-Perron generalized ADF test as following: y t = * + ⋅ y t −1 + u t ~ ~ y t = ~ + ⋅ y t −1 + ⋅ (t - T 2 ) + u t Even though these equations look simpler than ADF test, this test allows far more general data generating process allowable by the ADF test. Both tests use the same critical values. Select the series you want to test unit root, and double click (or View|Show) the series to get the series window. Click View|Unit Root Test and choose appropriate options (ADF or Phillips-Perron, and appropriate equation for unit root test). 7.2. Vector Autoregression (VAR) VAR is a system of stationary time series variables. Each equation has the same right-hand side variables consisting of exogenous variables and the lagged values of all endogenous variables in the system. This system is often used to determine the causality (Granger-causality) between variables. This system is also useful to investigate the external shock effects on the endogenous variables using impulse response function. Yt =

10

+

11

⋅ Yt −1 +

12

⋅ Z t −1 +

13

⋅ t + u1t

Zt =

20

+

21

⋅ Yt −1 +

22

⋅ Z t −1 +

23

⋅ t + u2t

Objects|New Object|VAR and select appropriate entries. For VAR specification, choose Unrestricted VAR and specify Endogenous and Exogenous variables. Also specify lag length and sample period. 7.3. Cointegration When time series variables are non-stationary, it is interesting to see if there is a certain common trend between those non-stationary series. If two non-stationary series X t ~ I(1), Yt ~ I(1) has a linear relationship such that Z t = m + ⋅ X t + ⋅ Yt and Z t ~ I(0) , ( Z t is stationary), then we call the two series X t and Yt are cointegrated. Two broad approaches to test for the cointegration are Engel and Granger (1987) and Johansen (1988). Broadly speaking, cointegration test is equivalent to examine if the residuals of regression between tow non-stationary series are stationary. For Engel-Granger test, regress Yt on X t (or vice versa), and use the residual to see if it is stationary (unit root test described above). If it is stationary, two series X t and Yt are cointegrated.

14

Johansen uses more complicated VAR structure to test the cointegration. EViews use Johansen test for cointegration. In a multiple non-stationary time series, it is possible that there is more than one linear relationship to form a cointegration. This is called the cointegration rank. For cointegration test, select the series (group of variables) to test cointegration to obtain group window. Choose View|Cointegration Test and specify appropriate settings for testing. The setting is whether you want to specify intercept and/or linear deterministic time trend in the cointegration equation. 7.4. Error Correction Model If two or more non-stationary time series are cointegrated, then there exists an Error Correction Model (ECM). Cointegration is a necessary condition for ECM. ECM describes the long run equilibrium relationship between non-stationary series. Even though individual series are non-stationary, when they are cointegrated, there is a long run equilibrium relationship, and ECM explains this relationship. ; t = m1 +

11

⋅ ; t −1 +

12