Handout 1 Eviews basics

170 downloads 242 Views 734KB Size Report
1. drag-and-drop the file onto the Eviews icon. 2. ... 1.1.1 Opening an existing Workfile .... specification, for example coefficient for PR term is labeled C(4). 5 ...
Eviews Basics 22.02.2007/01.03.2007 In this classes we will learn about some basic features of Eviews. This classes are meant to be just introduction to Eviews, not a full description of the program. Data for the classes are on the web pages www.wne.uw.edu.pl/ ~krosiak and www.wne.uw.edu.pl/~pwojcik and in EViews installation directory (U:/Program Files/Eviews/Example Files/Data). You should copy the following files: demo.wf1, demo.xls and macromod.wf1 into chosen folder. Data description of DEMO workfile: M1– money supply, GDP–gross domestic product, RS– short term interest rate, PR–price level

1

Basic commands in Eviews

1.1

Getting data into Eviews

There are two ways of opening Excell workfiles in Eviews: 1. drag-and-drop the file onto the Eviews icon 2. File/Open/Eviews workfile... 1.1.1

Opening an existing Workfile

If you saved the above mentioned workfiles, you can easily open them by File/Open/Eviews workfile (ctrl+O command)→ desired file: demo.wf1 1.1.2

Opening an Excel file

You may drag-and-drop the file onto the Eviews icon or click on File/Open/Eviews workfile... → Files of types: Excel → desired file: demo.xls

1

Katarzyna Lada, Piotr Wójcik

Macroeconometrics 2007

Eviews opens the Excel Read wizard. There are two steps, generally you can choose default settings. If preview window does not correctly display your data, then choose other options available on the second page of wizard.

When you click Finish, eviews will create a new workfile, displaying the group of variables imported from Excel file. You may check them, compare with the original Exel file and create a group of those variables. To do this, click on Name, give some name of the group and accept by clicking OK.

Now, to work further with the workfile, you should save it. Do it now.

2

Katarzyna Lada, Piotr Wójcik

1.1.3

Macroeconometrics 2007

Creating a new Workfile

Click on File/New/Workfile and fill in the Workfile structure type dialog box and the Date specification (for example, choose Dated-regular frequency and Frequency: Quarterly). Then you have to specify first and last date in your sample (choose 1952:1 and 1996:4 respectively). Click OK.

Notice:

1.

The workfile window displays two pairs of dates: one of the range of dates contained in the workfile, and the second for the current workfile sample.

2.

The workfile contains the coefficient vector C and the series RESID. All Eviews workfiles will contain these two objects.

Now, you may create new objects by clicking right mouse button and choosing New Object... You will see the main object types available in Eviews. You will learn about them in more details later. You may also import Excel-file: click on Proc/Import/Text-Lotus-Excel..., locate the demo.xls and double click on the file name. Fill in the new dialog box (see below) and click OK.

1.2

Basic data analysis

To open the default spreadsheet view of the series, simply double click one of the series. You can now use several entries of the View and Proc menus to analyse

3

Katarzyna Lada, Piotr Wójcik

Macroeconometrics 2007

several characteristics of the series. Explore the contents of the View and Proc menus in the chosen series window. Try for example the following commands: View/Descriptive statistics/Stats Table... View/Graph/Line... ... Task : Anwser the question, whether according to Jarque-Bera test is GDP normally distributed? You can create new series, which is the function of the existing series. For example, let us create natural logarithm of GDP series. To do this write in the command line: genr log gdp=log(gdp) Now you can work with that new series. Try the further commands from the View and Proc menus, for example: View/Descriptive statistics/Histogram and Stats... View/Distribution/Empirical Distribution Tests... ... Task : Show the correlogram of the natural logarithm of GDP. You can create group of new series without creating new series in the workfile. For example to create group that contains natural logarithms of the series M1 and GDP, the level of RS and first difference of natural logarithm of PR, write in the command line: show log(m1) log(gdp) rs dlog(pr)

Now you can work with the group similar as with the single series. Note that the entries for group object differ from those for a series object. Try to plot the group: View/Graphs/Line... or display table of descriptive statistics for each of the series in the group: View/Descriptive Stats/Individual Samples... Explore other entries. Task : Show the correlation matrix of the series in the group.

4

Katarzyna Lada, Piotr Wójcik

1.3

Macroeconometrics 2007

Regression estimation

We will estimate the following model for M1, using data over the period from 1952Q1-1992Q4 log(M 1t ) = α0 + α1 log(GDPt ) + α2 RSt + α3 ∆log(P Rt ) + t .

(1)

To open the estimation dialog box select Quick→Estimate Equation... and enter the equation specification. List first dependent variable, then C if you want to include constant in the regression and then expressions for each of the independent variables. Then you should choose the Method of estimation (default is least squares method) and Sample. Change text in that box to „1952Q1 1992Q4“.

Click OK to estimate the equation and display estimation results. To display a graph of actual and fitted values of dependent variable, along with residuals select: View/Actual,Fitted, Residual/Actual,Fitted, Residual Graph... You can choose other view of your equation. Task : Display coefficient covariance matrix. You can save created equation object. To do this, click on Name, give some name of the equation and accept by clicking OK.

1.4

Hypotheses testing

You can now easily perform several hypotheses using the estimated equation. Wald test View/Coefficient test/Wald–coefficient Restrictions... and enter the restriction (example C(2)=1) Note: Coefficients are assigned in the order that the variables appear in the specification, for example coefficient for PR term is labeled C(4).

5

Katarzyna Lada, Piotr Wójcik

Macroeconometrics 2007

Breusch-Godfrey test for serial correlation in the residuals View/Residual Tests/Serial Correlation LM Test...

1.5

Equation modification

The tests results suggest that you should modify the equation to take into account the serial correlation. To edit the specification click Estimate. Adding new variables

Now you can add lags of the variables:

log(m1(−1)) log(gdp(−1)) rs(−1) dlog(pr(−1)) Click OK to estimate new specification. Task : Save this equation. Including ARMA terms Other common method of accounting for serial correlation is to include AR and MA terms in the equation. To estimate the equation with AR(p) or MA(q) error specification enter ar(p) or ma(q) terms at the end of equation specification. Do the following steps: 1. Copy the equation: Object/Copy Object... 2. Give the name of the new equation: you know how 3. Edit the copied equation: you know how 4. Modify the equation: you know how 5. Estimate and analyse the new equation: you know how You should receive the following results:

Task : Basing on Akaike and Schwarz information criteria, compare the two models and choose better one.

6

Katarzyna Lada, Piotr Wójcik

1.6

Macroeconometrics 2007

Forecasting

Click on Forecast. You will see the followin dialog box:

You should choose the variable to forecast (logarithm of M1 or M1), provide the names for forecast series, forecast standard errors (if you want to create them and save in the workfile), forecast method, forecast sample and what you want to display as output. If you choose dafault options for output and then click OK, you will see graph of forecasts and statistics evaluating quality of the fit to the actual data. Task : Display on the same line graph M1 and the forecast of M1.

2

System estimation

Now open the workfile named CS.wf1. To display data description click on Details+/−.

2.1

System specification

To create the system of equations click on Object/New Object... /System and give some name of your system in the Name for object box (you can also type system in the command line).

Enter your equations, by formula, using standard EViews expressions. For example consider two equation system:

7

Katarzyna Lada, Piotr Wójcik

Macroeconometrics 2007

Key rules for specifying equations: –Equations can be nonlinear in variables, coefficients, or both. y=c(1)+c(2)*x^2+z^c(3) –You may impose cross equation coefficient by using the same coefficients in different equations. y=c(1)+c(2)*x z=c(3)+c(2)*w+(1-c(2))*x –You may impose adding up constaraints. y=c(1)*x+c(2)*z+(1-c(2)-c(3))*w –Equations may contain AR error specifications. y=c(1)+c(2)*x+[ar(1)=c(3)]

2.2

System estimation

Once you created and specified your system of equations, you can estimate it, simply by clicking on Estimate button. In the System Estimation dialog box you should select Method of estimation and Sample.

Click OK to display estimation results.

8

Katarzyna Lada, Piotr Wójcik

2.3

Macroeconometrics 2007

Examining the system

View Generally system view is similar to view of single equation object. You may, for example, perform hypothesis tests on the coefficients, display graph of residuals, graph endogenous variables etc. Task : Perform Wald test to check if GDP coefficients are equal in both equations. Procs Task : Create a new group containing the two series of residuals from the system of equations. Check for cross correlations in the residuals.

3

Models

Open the workfile named MACROMOD.wf1 Task : Identify the specifications of equations in the workfile and analyse their fit to the data.

3.1

Model specification

Having estimated the equations, you can easily create model. Select Object/New Object.../Model enter the name of the model and click OK to save it. To add stochastic equations to the model, simply copy and paste them. Select the equations in the workfile window, then ctrl+c, click anywhere in the model object window and use ctrl+v. Double clicking on any equation will bring up a dialog box of properties of that equation. The equations are inserted as links. That means if you reestimate any eqaution, you should update the equations in the model by using Proc/Links/Update All Links-Recompile model. To add the identity, click the right mouse botton anywhere in the model window and select Insert... In the displayed dialog box simply type the identity:

Click OK. The model specification is complete.

9

Katarzyna Lada, Piotr Wójcik

3.2

Macroeconometrics 2007

Model solving

To solve the model click on Solve in the model window. There is many options available from the dialog box, but now you should use the basic settings. Set the sample to 1960q1 to 1999q4 and use default options. Click OK to start calculations. View Select View/Variables to display variables from the model. The lines contain the icons indicating the variable type, the name of the variable, the associated equation and the description of the variable. Procs For example, to display on the line graph actual and fitted values of endogenous variables in the model, simply select the four variables (by holding down the control key and clicking on he variable names), then select Procs/Make Graph... In the dialog box check Actuals and set the Sample for graph to 1960q1 to 1999q4 and click OK. Task : Save the graph.

3.3

Specifying scenarios

The last exercise today is to examine how the model bahaves under some assumptions with respect to the exogenous variables. EViews provides a simply tool to carry out such an exercise. Using View/Scenarios... you can override a subset of the exogenous variables in a model to give them new values, while using the values stored in the actual series for the remaider of the variables. To add new scenario, click on Create New Scenario botton.

Once you have created the scenario, you can modify the scenario from the baseline case by overriding one of your exogenous variables. To do this, return to the variable window of the model, click on the variable M, use the right mouse button to call up the Properties dialog box for the variable, and then in the Scenario box, click on the checkbox for Use override series in scenario. A message will appear asking if you would like to create the new series.

10

Katarzyna Lada, Piotr Wójcik

Macroeconometrics 2007

Click on Yes to create the series, then OK to return to the variable window. In the variable window, the variable name M should now appear in red, indicating that it has been overridden in the active scenario. This means that the variable M will now be bound to the series M 2 instead of the series M when solving the model. To contract the money supply over the period 1990q1 to 1999q4, you can simply use the following lines of commands: smpl 1990q1 1999q4 m 2=500 smpl @all Task : Solve the scenario 2 of the model. Once the solution is complete, you can compare the results obtained for unrestricted and restricted money supply. Go back to variable view, check the exogenous variables and use Proc/Make Graph... to display the results. Check both the Active and Compare solution checkboxes, making sure that the active scenario is set to Scenario 2, and the comparison scenario is set to Baseline. Set the sample to 1980Q1 to 1999Q4. Task : According to the model, how the cut in money supply affects the interest rates, invetment, income and consumption? PLEASE, LEARN MORE ABOUT THE ABOVE MENTIONED TOPICS READING CHAPTERS 2, 23 AND 26 OF Eviews 5 User’s Guide.

11