45-734 Probability and Statistics II (4th Mini AY 1997-98 Flex-Mode and Flex-Time)

Using EVIEWS


These notes are written to help you learn the basics of EVIEWS. The first section is concerned with the first homework assignment and the second section lists some frequently used EVIEWS commands that you will encounter during the course.


First Homework Assignment

Part 1: Military Mobilization Data

First, you will need to obtain the data that you will be using. These data can be downloaded from each problem set. Each data set is stored with a WF1 suffix. Hence, if you want to copy the data for the military mobilization assignment, you should copy MILITARY.WF1. You will probably find it useful to keep a separate diskette for this course. We will be adding additional items as we go along.

In these notes, the commands that you are to issue will be listed in capital letters at the left margin. EVIEWS sometimes asks you questions. In these notes, responses that you are to give to such questions will not be preceded by a prompt. Your responses should always be followed either by a return or clicking on the appropriate option.

After EVIEWS comes up, across the top of the screen will be the menu bar in a standard WINDOWS type layout. Click on the file menu and choose "open". Pick the appropriate drive and directory (e.g., A: if you leave your WF1 file on the root directory of a floppy). After the file loads a window will come up with its own menu bar and the window will contain a list of the variables in the data file. You should see GNP, YEAR, MILMOB, and RESID (resid will always appear regardless of the data set). The cursor will be flashing in a space below the main menu bar. You can issue commands by simply typing them in and hitting the enter key.

GNP, YEAR, and MILMOB are the labels of the variables. YEAR contains the entries 1915 to 1988; GNP is the change in GNP from year t-1 to year t; and MILMOB is the change in the fraction of the U.S. population in the military.

To have the data series listed on the screen, issue the command:

SHOW YEAR GNP MILMOB

Another window will appear with the three variables displayed as columns. After looking at the data, close the window but do not bother to save it.

Plot GNP against year to see how it looks. Issue the command:

SCAT GNP YEAR

The scatter plot window offers you some choices on the menu bar including printing out the scatter plot, adding labels, zooming, and so on. The two right-most options are sometimes hard to see so you have to expand the window to the right to see the buttons. These two buttons are PrintSetup and Options. The Options window offers you a wide range of controls over the plot including an option to immediately fit a regression line through the points.

To generate a histogram for GNP, issue:

HIST GNP

Once again you will see a menu bar with a number of options including one to print out the histogram. This windown also contains the basic statistics for the variable: mean, median, standard deviation, and so on.

You can obtain summary information about means, standard deviations, and correlations of an arbitrary number of data series. Issue:

STATS GNP MILMOB

To see the correlations issue the command:

COR GNP MILMOB

The menu bar in the correlation window has a Stats button. Clicking the button displays the same information as issuing the STATS command.

For assignment 1 you first want to regress GNP on a constant and MILMOB. The constant is built into EVIEWS and is named C (it is a reserved word so you cannot use C for anything else or EVIEWS will complain). To run the regression you use the command LS which, naturally enough, stands for "Least Squares". That is:

LS GNP C MILMOB

The results should come up very quickly in a window with a menu bar across the top. You can click on "print" to print the regression results. Clicking on "resids" shows you a plot of the residuals. If you want to use the residuals for something, they are stored in resid until you run another regression. If you want to keep them longer, you can generate a new series of your own. Hence, you might issue:

GENR GNPRES=RESID

This stores the residuals in a series called GNPRES. Graph the residuals against YEAR and note pattern. Namely:

SCAT GNPRES YEAR

To run a separate regression just on the time period 1915 - 1945 you can change the sample range by using the SMPL command. That is:

SMPL 1915 1945

which selects the first 31 observations. You can run the regression as described above.

To end the session click on the file menu and choose exit. A dialog box will come up warning you that your workfile (military.wf1) has been changed. Click on "yes" to save the changed file and you will then exit EVIEWS.

Part 3: Problem 11.3 MWS

To get the data into EVIEWS, first issue the command:

CREATE

and in the window that comes up click the option Undated. When you do this at the bottom of the window Start Observation will have a 1 in it. In the box labeled End Observation enter 10 and then click OK. A window labeled Workfile: Untitled will now come up with only C and Resid in the variable listing. You are now ready to enter data.

To enter the data type:

DATA Y X and hit the enter key. A simple spreadsheet-like window comes up and you can type the numbers into each cell by simply moving the arrow keys. When you are done simply close the data entry window and you will now see X and Y in the variable listing. You can now run the regression.

When you are finished be sure to save your workfile. EVIEWS will prompt you for a name as your workfile is Untitled.

If you have already entered the data into a spreadsheet program like Excel, you can simply highlight the appropriate columns in the spreadsheet, copy them onto the Windows clipboard, and then paste them into an EVIEWS spreadsheet. Before you paste into an EVIEWS spreadsheet make sure the spreadsheet is in edit mode by clicking the Edit+/- button.


Useful EVIEWS Commands


  1. To create a new work file type CREATE at the command line and then fill out the window that opens. After you have created a work file you can read data from Excel, Lotus, and text files by using the READ command. Simply type READ and fill in the appropriate information.

  2. Data can be entered by hand using the DATA command. For example:

    DATA X Y

    brings up a window where you can key in the data corresponding to the variables X and Y by hand.

  3. The GENR command is used to transform variables. For example:

    GENR XSQ = X^2, to produce the square of X
    GENR XSQR = X^.5, to produce the square root of X
    GENR XINV = 1/X, to produce the inverse of X
    GENR LNX = LOG(X), to produce the natural log of X
    GENR EXPX = EXP(X), to produce the exponential of X
    GENR SUMXY = X + Y, to produce the sum of two variables

  4. To get a sample from a Normal Distribution with mean 0 and variance 1:

    GENR Z = NRND

    and

    GENR XU = RND

    produces a random sample from a [0,1] uniform distribution.

  5. To create a variable that is ordered 1,2,3,4,...,

    GENR SEQNO=1
    SEQNO=SEQNO(-1)+1


  6. Logical Operators: The following creates a 1,0 dummy variable corresponding to values of EXPER greater than 8 and not greater than 8:

    GENR DUMMY8=(EXPER<=8)*0+(EXPER>8)*1

  7. Sorting: To sort a file according to the values of X

    SORT X, for ascending order, and SORT(D) X for descending order.

  8. The View button in the Regression Window: In the regression window is a button called View that has a number of useful items including
    Coefficient Tests for various sorts of restrictions on the coefficients;
    Stability for testing for break points in the data; and
    Residuals for tests such as the White Heteroskedasticity test.

  9. LS(H) Y C X1 X2 X3 ... does the White correction for heteroskedasticity

  10. SCALAR PVAL
    1. SCALAR PVAL=@TDIST(2.31,25) calculates the two-tailed p-value given the t-statistic of 2.31 and 25 degrees of freedom. Click on PVAL in the work file to display its value. The value appears at the bottom of the window.
    2. SCALAR PVAL=@FDIST(4.7,4,36) calculates the upper tail p-value for an F-Statistic of 4.7 with 4 df in the numerator and 36 df in the denominator.
    3. SCALAR PVAL=@CHISQ(5.2,4) calculates the upper tail p-value for a Chi-Square statistic of 5.2 with 4 df (this is the distribution function).

  11. SCALAR AREANOR=@CNORM(2.2) is the distribution function for the normal; that is, F(2.2).