Learning EViews

By Ju-Chin Huang
Department of Economics
University of New Hampshire
(ECU, Economics, 1993-1998)

[More EViews information here.]

I. Point and Click

EViews is like most of the software designed to run in Windows environment. It utilizes most of the features in Windows such as drawdown menus and on-line help. Like most of the Windows applications, things can be done in two ways: selecting commands from the menu or typing in the commands directly. The latter requires knowledge of the commands in EViews. The former is simply clicking the items you want from the menu. This document is to show you how to do the former in EViews. There are different ways of doing the same things. Feel free to experiment.


Create a Workfile

A workfile MUST be created before doing anything else.

Click File/New/Workfile

Select "type of data" (annual? undated? ....)

Specify "dates" (use help menu to learn the syntax of giving dates)

For example,

Start date

End date

Annual

1977

1986

Monthly

1980:03

1983:12

Weekly

2:10:51

3:17:94

Undated

1

250

(If it's undated data, specify a big number in "End date", say, 500, make sure the number specified is bigger than the number of observations.)

Click ok (A Workfile window pops up.)

*Different windows will come up as you go; e.g., Workfile, Series, Group, etc. To distinguish them, look at the title given at the top of each window.


Get Data in EViews

Key in data

Click Objects/New Object ... at the top of the Econometric Views window

Select Series from the "Type of object" list

Type in the variable name, say, X, at the "Name of Object" slot

(An object "X" is created in the Workfile window.)

Double click the object X in the Workfile window

Click Edit H/! at the top of the X window (to type in the values of X)

Click on the first cell and type in the value of observation 1

Click on the second cell and type in the value of observation 2, etc.

Import data from Excel

Click File/Import ... at the tope of the Econometric Views window

(Choose Excel.xls from the "List Files of Type" at the bottom left hand corner of the opened window.)

Select filename

Click ok

Specify (1) "Order of data"

as by observations if data are stored in the following form:

X

Y

1

3

4

5

6

7

5

9

or, as by series if data are stored in the following form:

X

1

4

6

5

Y

3

5

7

9

(2) "Upper-left data cell" (Give the location of the first data value.)

For example, an Excel spreadsheet is given.

 

A

B

C


1


X


Y

 


2


5


7

 


3


4


9

 


4


2


10

 

Y The "Upper-left data cell" is A2.

(3) "Names for series or Number of series if names in file"

Type in variable names with a space in between if variable names are not in the Excel file. (For the above example, type in X Y)

If the names are in file (e.g., above example), type in the number of series. (For the above example, the number of series is 2)

(An object for each variable is created in the Workfile window. Double click each object to check on the data.)

Click ok


Basic Data Analysis - Summary Statistics, Graphs, and Regression Analysis

Suppose two variable objects, X and Y, have been created in Workfile window.

-- Summary statistics for one variable

Double click X in the Workfile window (A window displaying all observations of variable X appears.)

Click View at the top of the X window and choose any of the statistics and graphs you want to do. (check them out.)

-- Summary statistics between two variables

Hold down the left mouse button to select more than one object from the Workfile window.

Double click the selected objects

Click Open Group (A Group window appears.)

Click View and check out all the summary statistics and graphs you can get.

To save the selected group of variables as an object in the Workfile window to use it again later, do the following:

Click Name at the top of the Group window (An Object Name window appears.)

Give a name, say, GROUP1.

Click ok (An object called GROUP1 is created in the Workfile window. Double click the GROUP1 object to recall the Group window.)

To save summary statistics for this group of variables, do the following.

Click View/Descriptive Stats/Common Sample at the top of the Group window

Click Freeze at the top of Group window (A Table window appears.)

(You may give a title or edit the Table by clicking the items at the top of the Table window.)

Click Name (An Object Name window appears.)

Give a name, say, TABLE1.

Click ok (An object called TABLE1 is created in the Workfile window. Double click the TABLE1 object to recall the regression results.)

*In general, to save any result as an object in the workfile, click Freeze and Name it!

-- Scatter plot of two variables

Suppose we want to plot Y against X.

Hold down the left mouse button to select both Y and X objects from the Workfile window. If the objects X and Y are not adjacent to each other, hold down the Ctrl key and click on the objects X and Y. Make sure Y is selected FIRST.

Double click the selected objects.

Click Open Group

Click View/Graph (A graph will appear.)

Double click the graph to get to the Graph Options window.

Select Scatter Diagram from the AGraph Type@ list and select other features you want for your scatter plot.

Click ok (A Group window appears with the scatter plot.)

To save the plot as an object so it can be recalled later, do the following.

Click Freeze at the top of Group window (A Graph window appears.)

(You may give a title or edit the graph by clicking the items at the top of the Graph window.)

Click Name at the top of the Graph window (An Object Name window appears.)

Give a name, say, GRAPH1.

Click ok (An object called GRAPH1 is created in the Workfile window. Double click the GRAPH1 object to recall the graph.)

-- Regression analysis

Suppose we want to regress Y on X.

Hold down the left mouse button to select both Y and X objects. Make sure Y is selected FIRST.

Double click the selected objects.

Click Open Equation ... (An Equation Specification window will appear.)

Click ok (An untitled Equation window will appear and contains the results.)

To save the equation as an object, do the following.

Click Name at the tope of the Equation window (An Object Name window appears.)

Give a name, say, EQ1.

Click ok (An object called EQ1 is created in the Workfile window. Double click the EQ1 object to recall the equation.)

To save the results as an object, do the following.

Click Freeze at the top of Equation window (A Table window appears.)

(You may give a title or edit the Table by clicking the items at the top of the Table window.)

Click Name (An Object Name window appears.)

Give a name, say, TABLE2.

Click ok (An object called TABLE2 is created in the Workfile window. Double click the TABLE2 object to recall the regression results.)


Saving Results on Disk

Click Save at the top of the Workfile window

Give a filename with an extension .wf1 (For example, exercise.wf1)

To recall the saved workfile, click File/Open at the Econometric Views window and retrieve the file.

II. Programming Commands

To Write A Program:

Use the mouse to click on FILE

Click on NEW

At ATYPE OF OBJECT@ prompt, click on PROGRAM

Click on OK

Type program statements

Click on SAVE AS

Save as PROGRAMNAME.PRG. Click OK

To Run A Program

Create a workfile first: click File-New-Workfile and specify a range of data (e.g., 1 200).

You may add a line in your program to create the workfile. e.g., CREATE U 200 (see help menu for options)

Type RUN PROGRAMNAME on command line at top of screen or click on RUN on menubar in the program window.

To Plot Y against X

Click on Y and X in the workfile window while pressing down the ctrl key.

Double click the selected data and select Group. A window with two columns of numbers appears.

Click View-Graph. A graph window appears.

Double click the graph. Another windows appears. Click Group Type and select Scatter Diagram. Click ok.

To save the graph as data, click Freeze and you may add title to the graph. Click Name and give a name. An icon will be created in your workfile with the given name. (You may "freeze" a table, a spreadsheet, or regression results, and name them.) Double click on the icon to see the saved results. When the workfile is saved, all data in the workfile, including the graph data, will be saved. It can be retrieved next time by reopening the workfile.

To Create A Table of Descriptive Statistics of Data in Workfile

Click on the variable icons in workfile while holding down the ctrl key to select variables for analysis.

Double click the selected variables. Select AOpen Group@ and click View-Descriptive Stats-Common Sample.

To create a table icon of summary statistics in workfile, click Freeze and give a name.

Tips

In addition to using the pull-down menu, all commands can be typed in and executed one by one at the command line which is the space below FILE.

Alternatively you may first write a program file that contains all commands (e.g., create, read, ls,...) to execute and run them at once.

In a program file, use an apostrophe (>) before a comment statement if you do not want Micro TSP to read it.

Save a program file as filename.prg

Save a workfile as filename.wf1

Use the CREATE command at the beginning of a program to create a workfile.

example: CREATE U 8 creates an undated (U) workfile with 8 observations.

CREATE Q 46:1 88:1 creates a quarterly (Q) workfile from first quarter (.1) 1946 to first quarter 1988. CREATE A creates an annual workfile and CREATE M creates a monthly workfile.

Use the FETCH command to retrieve data stored as TSP data series.

example: to retrieve the data series called GPA.dat and the data series called INCOME.dat from the directory C:\EVIEWS\DATA use

FETCH C:\EVIEWS\DATA\GPA C:\EVIEWS\DATA\INCOME

Use the READ(o) command to retrieve data stored as an ASCII file. Click Help-Search to search for on-line help on Read command for reading in different types of data.

The LS command returns the least squares linear regression equation.

example: LS GPA C INCOME regresses the variable GPA on the variable INCOME and a CONSTANT (C).

Use the EQUATION command to name an equation.

example: EQUATION EQ1.LS GPA C INCOME regresses GPA on INCOME and a CONSTANT (C) and names the equation EQ1. A (group) object called EQ1 will be created in the workfile containing regression results once the above ls command is executed.

example: PRINT EQ1.STATS prints the results of the regression.

Alternatively, the results of the regression can be printed without naming the equation.

example: LS(P) GPA C INCOME prints(P) the results of the regression.

In general, using (P) after a command sends the results to the printer and (S) sends the results to the screen.

The COEFCOV command generates the coefficient covariance matrix.

example: PRINT EQ1.COEFCOV

The RESIDS command generates a list of the residuals actual and fitted values.

example: PRINT EQ1.RESIDS

In general, using (G) after a command generates a graph.

example: PRINT EQ1.RESIDS(G) prints a graph(G) of the residuals actual and fitted values.

Use the SMPL command to select a particular sample range.

example: SMPL 59.1 88.1

Use the GENR command to generate a new variable. Use the NRND to generate a random number.

example: GENR X=50+5*NRND creates a random variable called X.

Use the R command to rename variables.

example: R GCDAN S changes the name of the variable AGCDAN@ to AS@.

Use (-1) or (-2) etc. after a variable to represent a lagged time period.

example: GENR MAP=PDP+PDP(-1)+PDP(-2) generates a new variable called MAP which is the three month sum of PDP.

Use the SAVE command to save a workfile.

example: SAVE INTEREST saves the workfile INTEREST for future use. When a workfile is named and saved, everything within the workfile can be retrieved by reopening the workfile.

Use the LOG command to calculate the logarithm of a variable.

example: GENR LPCEXP=LOG(PCEXP) generates a new variable LPCEXP which is the logarithm of PCEXP.

Use the @SSR, @SUM, and @COR commands to calculate the sum of squared residuals, sum, and simple correlation respectively.

Use the SCAT command to generate a scatter plot.

example: SCAT(P) RES INC prints(P) a scatter plot of the dependent variable RES versus the independent variable INC.

Use the LS(W= ) command to perform a weighted least squares regression.

example: LS(W=X) HEXP C INC performs a weighted regression with weight X.

Use the PLOT command to create a graph.

example: PLOT (A,P) E generates a graph of E and scales automatically (A) and prints (P).

Use the LOAD command to load a previously created workfile.

example: LOAD INTEREST loads the workfile named INTEREST.

Use the EXPAND command to extend the range of a workfile in order to forecast out of sample.

example: CREATE U 8 creates and undated workfile with 8 observations.

EXPAND 15 expands the workfile to 15 observations.

Use the FIT command to produce a forecast.

Use the SHOW command to see results on the screen.

example: SHOW INCOME GPA shows the variables INCOME and GPA on the screen.

Alternatively, use the PRINT command to send results to the printer.

example: PRINT INCOME GPA

Use the IDENT command to produce the autocorrelation function and the partial autocorrelation function.

example: IDENT(#) where # is the number of correlations.

The FORCST command computes an n-period ahead dynamic forecast for the dependent variable in the active equation.

The FIT command computes the fitted values (one period ahead forecast values) from the active equation .

The DIFFERENCE OPERATOR specifies the first difference of a variable (use D(GNP) rather than @DIF(GNP)).

example: D(GNP) computes GDP - GDP(-1).