How to Use
Eviews
Economics 375, 470, and 475
Henson, Krieg, and Hodges
Overview of EViews
EViews, or Econometric Views, is an econometric
software package designed to run on personal computers under the Windows
operating system. It takes advantage of
the Windows graphical user interface for easy entry, manipulation, and analysis
of data. It is the latest version of a
program called TSP, or Time Series Processor, which was originally developed to
run under text-based operating systems such as DOS. While EViews has a number of features that
make it particularly useful for analyzing time-series data, it is also quite
powerful for working with cross-section data.
Operations can be performed in EViews in three
different ways: by using its menu
system, by typing TSP commands interactively, or by executing commands stored
in a program file. This handout provides
an overview of all three methods. It
assumes a basic familiarity with personal computers and the Windows
environment. The best way to use this handout
is to work through the examples using EViews.
Topics are arranged in the following order:
I. Starting EViews
II. Basic Concepts
and Terminology
III. Step-by-Step
Illustration Using Menus
IV. Illustration Using
Interactive Commands
V. Using Help
VI. Printing EViews
Output
VII. Saving Results in
the Workfile
VIII. Running EViews
Programs
For now, you should become familiar with the topics
in sections I-V. You will need the
information in sections VI-VIII for the computer assignments later in the
course.
As a convention, commands that you type or menu
items that you select will be indicated in this handout by bold-face type.
I. Starting EViews
Eviews is provided to all students enrolled in
Economics 375, 470, and 475 through the ZENworks application organizer which is
part of Novell. To access this, log into
Novell on a campus computer and, after starting up, open up the WWU
Applications icon. It looks like:

From
here, open up the “All” programs and the Eviews icon should be apparent:

Double-clicking
on this icon will launch the Eviews program.
It may take some time, especially if others in the class are using
Eviews at the same time.[1]
The
first screen you will observe in Eviews is the main window, which looks like:

This window has the following parts:
• The title
bar is the blue bar at the top with the title “EViews.” At the far left of the title bar is the program icon. At the far right is the close button, labelled “X,” used to exit the program.
• The main
menu is the line immediately below the title bar, and has these options:
File Edit
Objects View Procs
Quick Options Window
Help
We’ll discuss the main menu
in detail below.
• The command
window is the white area below the main menu. Operations can be performed in EViews in one
of two ways: either by selecting an
operation from the menu, or by typing a command in the command window. The vertical blinking line in the command window
is called the insertion point. Any commands that you type will be inserted
here.
• The work
area is the gray area that occupies most of the screen. Results are displayed here.
• At the bottom of the screen is the status bar. It has four sections. When you start EViews, the left-hand section
just says “Welcome to EViews.” The
center section shows the default path or folder where the program will look for
data and programs. The right-hand
sections display the names of the default “database” and the “workfile”
currently in memory. We’ll cover these
later.
II. Basic Concepts and Terminology
Windows Menu
System Basics
Many operations in EViews are simplified by using
the menu system. To select an item from
the menu, simply use the mouse to move the tip of the pointer arrow over the
item, then click the left-hand mouse button.
For example, try clicking on Help. This causes a “submenu” to pop down. Now select “EViews Help Topics…” from this submenu. This causes the “EViews Help Topics” window
to open. We’ll discuss the Help facility
in greater detail below.
For the moment, let’s close the Help Topics window
and examine some of the other items on the main EViews menu. There are two ways to exit from the Help
Topics window: click either on the close button, (the button labelled X at the top-right corner of the Help
Topics window—not the one in the
corner of the EViews main window!), or on the Cancel button at the bottom-right corner. Go ahead and close the Help Topics window
now.
Notice that each item on the EViews main menu
contains one letter that is underlined.
This provides a way to select that item by using the keyboard rather
than the mouse. This is accomplished by
using the “Alt” key at the bottom of the keyboard. To open the Help menu, for example, press the
Alt key once. Notice that the left-most
item in the main menu (File)
is now highlighted. Now press the “h”
key, and the Help pop-down submenu will appears. Now just type “e” to open the EViews Help
Topics window. This sequence of
keystrokes can be denoted in various ways, such as <Alt>-H-E or as Alt+H+E. It does not matter whether you hold down the
Alt key or release it before typing the letter, and it does not matter whether
the letters are typed in upper case or lower case.
If you select a menu item and then decide not to
choose one of the items from the submenu, you can cancel the selection by
simply clicking on the main menu item again, or by clicking anywhere outside of
the submenu box, or by pressing the Esc
key near the upper left corner of the keyboard.
Most windows in EViews can be closed in one of four
ways. The first is by clicking on the
close button in the top-right corner, as we’ve already seen. A second way is to select “File” and then “Exit” from the menu. A third way is to click on the program icon, which is the little picture
in the top-left corner of the window above the main menu, then select Close from the pop-down
menu. Finally, you can just double-click
on the program icon. These methods for
closing programs are common to almost all Windows applications.
In what follows we will denote a series of menu and
submenu choices by a slash to separate each item. For example, selecting “File” and then “Exit”
will just be denoted File / Exit
(without the underlines or quotes).
Workfiles,
Objects, Views, and Procedures
Before you can use EViews to analyze any data, you
need to provide the program with information about the data and reserve space
in the computer’s memory to hold the data and the results of your
analysis. This memory area is called a workfile. Once they are created, workfiles can be
stored on disk and used over and over again.
Items stored in a workfile are called objects.
An object can be a set of data (or “series object” in EViews
terminology), the results of a regression (an “equation object”), a graph, a
table, or a variety of other things.
Objects may be displayed using a variety of
different views. A view is simply a window that displays the
object in a particular way. For example,
data can be viewed either as raw numbers, or using a variety of different types
of graphs. Regression results can also
be displayed either numerically or graphically.
Finally, EViews contains a variety of procedures for manipulating and
analyzing data.
These concepts will become clearer as we work
through the example below.
III. A Step-by-Step Illustration Using Menus
A. Entering the Data by Hand
Now let’s use EViews to work through an
example. We will create a workfile,
analyze the data, print the results, and save the workfile for future analysis.
Step 1A: Create a Workfile
From the EViews main menu, select File / New / Workfile to create a new
workfile. This will open a “dialog box”
where you supply information about your data.
The data we will use are four observations on the gasoline consumption
(in gallons per person per week) and price (in dollars per gallon) for
different countries. Because the data
are cross-sectional rather than time-series, so we select Undated or irregular. We are
now prompted for the starting and ending observations. EViews assumes that the starting observation
is number 1. (We can change that if we like, but leave it as is for this
example.) Move the mouse pointer over
the box labeled “End observation,” and click once. A blinking insertion point appears. Since we have four observations, type 4 in the box; then select the OK button (or just hit the Enter key after typing the 4).
This opens a new Workfile window in the work area,
with the title “Workfile:
UNTITLED.” Immediately below the
title bar is a toolbar, which contains
eleven buttons beginning with “View”
and ending with “Sample”. (Some of the
buttons might be hidden by an edge of the window. If so, move the mouse pointer to the edge
until a double arrow appears. Now click
and, while holding down the left mouse button, drag the window edge to move
it.) Below the toolbar is some
information about the data set, followed by a list of the variables that the
data set contains. It might seem
surprising to see that there are already two variables in the data set—“c” and
“resid”—even though we haven’t entered any numbers yet! These are variables that EViews creates for
use in regressions. We’ll discuss them
later.
Step 2A: Enter the Data
The easiest way to enter data is to select Quick from the EViews main menu (top of
the screen). Then select Empty Group (Edit Series) from the
submenu. This opens a new window (with
the title “Group: UNTITLED Workfile:
UNTITLED”) that looks like a spreadsheet.
(This is a “Group” window, because it contains a group of series.) First we need to label the variables. Click on the gray cell to the right of the
cell labelled “obs.” Type GALLONS (in either upper or lower
case), then hit the Enter key on the
keyboard. “GALLONS” will now appear in
that cell. EViews is now ready for you
to enter data.
Notice that the elements in the column under
“GALLONS” are all labeled “NA,” or “not available.” Also, the cell for observation 1 is
highlighted by a dark border, meaning that anything you type will be entered
into that cell. Type 10, then press the “down” arrow at the
right of the keyboard to move down to the next cell. The second cell is now highlighted; type 4.
Continue to fill in the cells in this column with the third and fourth
observations: 4, 2. If you discover that
you’ve made a mistake, just click the mouse on the cell containing the bad data
(or move to it using the arrow keys on the keyboard). You can either retype the number (in which
case whatever you type will automatically replace the previous contents of the
cell) or use the edit window (the
white area immediately below the toolbar) to edit the number.
Now click on the gray cell to the right of the one
labelled “GALLONS” and type PRICE. Now enter the price data in the column
below: 1, 2, 3, 4. The screen will
now look like this:

Note: If you
simply hit the Enter key after typing an entry in a cell, EViews moves you to
the next line, but not to the next
cell in the same column—instead, it returns to column one! This is nice if you’re
entering data row-by-row (one observation at a time), but not if you’re
entering it column-by-column (one variable at a time). Be careful here!
When you’re done editing, click on the Edit+/– button on the toolbar. The edit window below the toolbar will
disappear, and you can no longer edit the spreadsheet. If you want to edit any entries later, just
click on Edit+/– again.
The Group window might obscure part of the Workfile
window. If that bothers you, then click
the mouse pointer on the title bar of one of the windows and, while holding down the left mouse button,
move the mouse to drag the window to another location in the work area.
B. Entering Data that has been previously
created by another program
Step 1B: Create a Workfile
In order to transform a data file from one program
(say, Excel) to Eviews, it will be helpful to know something about the data you
are examining. I have provided an excel
file that was drawn from a sample of questions asked students in a 375 class. This file is entitled “Survey of 375 Students”
and can be found at:
http://www.cbe.wwu.edu/krieg/Eviews%20Help%20Booklet/Eviews.htm.
The purpose of this data is for demonstration
purposes only.
A quick examination of this file reveals that 14
students responded to the following 8 questions:
What was your score on the SAT? (SAT)
What was your winter quarter GPA? (GPA)
How many alcoholic drinks did you average per week
during the winter quarter (DRINKS)
How many hours of sleep did you average per day
during the winter quarter (SLEEP)
Did you have a significant other during winter
quarter (SIGOTHER, 1 = yes, 0 = no)
How many hours of work did you average per week
during winter quarter (WORK)
How
many credit hours did you complete during winter quarter (CREDITS)
How many hours of exercise per week did you average during winter quarter
(EXERCISE)
In order to correctly transform data from Excel into
Eviews, we will need to know the number of observations (in this case, 14), the
names of the variables in the order they appear in the Excel data set, and the
Excel cell that has the first piece of data (in this case, the first piece of
data is the SAT=1430 which appears in cell A2 of the “Survey of 375 Students”
Excel file).
Begin by downloading the Excel file “Survey of 375
Students.” Be sure to save this on your
computer and do not forget its location.
Then, from the EViews main menu, select File / New / Workfile to create a new workfile. This will open a “dialog box” where you
supply information about your data.
Because the data in the “Survey of 375 Students” are cross-sectional
rather than time-series, we select Undated
or irregular. We are now prompted
for the starting and ending observations.
EViews assumes that the starting observation is number 1. (We can change
that if we like, but leave it as is for this example.) Move the mouse pointer over the box labeled
“End observation,” and click once. A
blinking insertion point appears. Since
we have fourteen observations, type 14
in the box; then select the OK
button (or just hit the Enter key
after typing the 4).
This opens a new Workfile window in the work area,
with the title “Workfile:
UNTITLED.” Immediately below the
title bar is a toolbar, which
contains eleven buttons beginning
with “View” and ending with “Sample”.
(Some of the buttons might be hidden by an edge of the window. If so, move the mouse pointer to the edge
until a double arrow appears. Now click
and, while holding down the left mouse button, drag the window edge to move
it.) Below the toolbar is some
information about the data set, followed by a list of the variables that the
data set contains. It might seem
surprising to see that there are already two variables in the data set—“c” and
“resid”—even though we haven’t entered any numbers yet! These are variables that EViews creates for
use in regressions. We’ll discuss them
later.
Step 2B: Entering the Data
To import your data from Excel into Eviews select File / Import / Read Text-Lotus Excel. This opens a dialog box where you must tell
Eviews where you saved the Excel file you placed on your computer earlier. Direct Eviews to this file and click “Open.” A new dialog box, the “Excel Spreadsheet
Import” box opens with a large number of possible things to input:
Data order:
This is asking if your data is in columns or rows. Most data you input will be in columns (as is
the data from the “Survey”).
Upper-left data cell: Asks where the actual numbers (not the names
of the variables) begin in your excel spreadsheet. In our case, you will want to change the
default B2 to A2—that is where the first observation of SAT scores resides.
Name for series or Number if named in file: This is the area where you type in the names,
in order of appearance in the Excel file, of each series of data you are
inputting.
Import sample:
the observations you are inputting.
Eviews uses a system of spaces to indicate “between.” The default here should be 1 14 meaning that
Eviews will input all data between (and including) observations 1 and 14.
When you have completed filling this import window
out, it should look like:

Click OK. If
successful, your imported data will appear in your workfile:

Notice, that in addition to the original two objects
(c, resid), 8 new objects have been added to your file—one object for each of
the pieces of data you imported.
Step 2C: Putting all of the data into a Group
Eviews looks at pieces of data as objects. So far we have created 10 objects—c, resid,
and the 8 objects just imported.
Sometimes it is easier to work with a single object rather than 8. Eviews refers to a “combined” object as a
group. In order to put our data set into
a group, hold down the “control” key and select each of credits, drinks,
exercise, gpa, sat sigother, sleep, and work.
Note that I did not include resid and c.
As you click on each of these objects their names should be highlighted
in blue. After select each of these
right click on any of them and select open/as
group. This will open a new window
that combines all of your data into one place.
You should see:

Note
that although your “Group” window looks much like your workfile, they are
different. Your group is an object that
is in your workfile. This becomes
apparent if you name your group and then exit out of the group. To name the group, click on the 5th
button in the group window entitled “Name.”
This brings a dialog box that allows you to identify this group. I will name my group “Survey.” Note, that naming something in Eviews has the
effect of saving that object to your workfile.
After naming this group, if I click on the X in the top right corner of
the group window, I will not delete this group but simply close it. One can always access this group by
double-clicking on it in the workfile window.
Step 3: Analyze the Data
To view a
graph: Select the View button at the upper-left corner of the Group window. The data are currently being viewed in
Spreadsheet form. To view a graph of the
data, select Graph. A pop-up submenu then displays several
options. Select Line to view both series on one graph, plotted against the
observation number. (If you prefer to
view each series on a separate line graph, select Multiple Graphs / Line from the View menu.) Such line graphs are useful for time series
data; they are less meaningful for cross-section data such as these. To see a more useful scatter plot of the
data, select Graph / Scatter from
the View menu. Selecting Simple Scatter at this point will
display a scatter plot with the variable in column 1 on the horizontal axis and
other variables on the vertical axis.
(If there are more than one variable to be plotted on the vertical axis,
then each variable is displayed using a different symbol.) Selecting View / Graph / Scatter / Scatter with Regression adds a fitted
regression line.
As you may have noticed, there is a bit of a problem
here: The model that we want to estimate
has GALLONS as the dependent variable, not PRICE! We could
get around this problem by putting the PRICE data in column one, but this would
be a pain to have to do each time we want a different graph. (This is one of the shortcomings of using
menus! They simplify some operations but
complicate others.) Fortunately, we
don’t have to do this. We can get around
this problem much more simply using the SCAT command, which we’ll discuss
below.
Now take another look at the scatter diagram (either
with or without the regression line).
Notice that the axes are truncated.
This is because the default “Graph Scaling” option is “Optimized Linear
Scaling,” which gives the best view of the data. This and other graph options can be changed
by either double-clicking anywhere on the graph, or single-click the right mouse button and select Options from the pop-up menu. This opens the Graph Options window. To force the axes to show the origin, select
“Linear - force through zero” for the Graph Scaling attribute. If you selected Simple Scatter as the graph
type and now want to add the least-squares regression line, you can select Regression Line from the Scatter
Diagram options at the bottom right of the Graph Options window.
To obtain
descriptive statistics: In the Group window, select View / Descriptive Stats. Choose Individual
samples if you have different numbers of observations for each variable, or
series, and want to analyze each variable separately. Select Common
sample if you want to analyze the subset of observations containing data on
both variables. Since we have a complete
sample, both choices produce the same results in this case. Other useful options are View / Correlations and View
/ Covariances.
To estimate a
regression equation: To estimate the model GALLONS
= a + b(PRICE), select Procs
from the Group window menu (or from the EViews main menu, but not from the Workfile menu!), then
select Make Equation.... This opens a new dialog box. In the box labeled “Equation Specification”
the dependent variable is listed first, followed by a list of explanatory
variables. In this case the dependent
variable is GALLONS, and the explanatory variables are PRICE and C. The variable C is just the constant term, or
intercept, in the regression equation.
If you want to change the equation specification, just type the changes
in this box. The box labeled “Estimation
Settings” shows that the estimation method is least squares (ignore the “NLS
and ARMA” stuff for now) and that all eight observations in the sample will be
used, beginning with observation 1 and ending with observation 4. These settings all look fine, so select OK.
Results are displayed in a new “Equation” window.
NOTE: VERY IMPORTANT!! Using
the menu is a very dangerous way to do regressions in EViews, and you should
never actually use the regression menu in practice. One reason is that EViews automatically
assumes that the variable in the left-most column of the spreadsheet is the
dependent variable. This is just the
default setting, and more often than not
this is not correct! Another reason
is that every other variable in your spreadsheet will be used as an explanatory
variable, whether you want to include it or not. You can override these defaults by editing
the specification in the dialog box, or by typing the LS command in the command
window. We’ll discuss the latter
approach below.
Step 4: Print the Results
The easiest way to print the contents of the
Equation window is to just click on the Print
button (fourth from the left on the Equation toolbar). The results will be printed at the printer
that is attached to your PC. If you’re
in the lab and don’t know which printer that is, ask a consultant. This is actually a pretty crude way to print
in EViews. Most of the time, you’ll want
to incorporate EViews output into a report that you’re preparing in a word
processing application, such as Word. It
turns out that it’s easy to cut and paste from EViews to Word. For details, see section VI, “Printing EViews
Output,” below.
Step 5: Save the Workfile
It’s a pain to re-enter data each time you want to
use them, so we want to save what we’ve done so far. First, insert a 3.5” diskette into the
computer’s A:\ drive. From the EViews
main menu, select File, then Save.
This opens a dialog box in which you enter information about the disk
file in which you want to save your work.
Click on the arrow to the right of the box labelled “Save in:” and use
the scroll bar to select 3½ Floppy (A:). Now double-click anywhere in the box labelled
“File name.” The word “untitled” will be
highlighted. Now type in example1 as the name of the file, and
click on the Save button. This will save your work in a file named
example1.wf1 on your diskette.
Step 6: Pack Up and Go Home
Before you go any further, take your diskette out of the A:\ drive and put it somewhere where you won’t
forget to take it with you!
Then, close EViews in one of three ways:
(a) by clicking the close button,
(the button labelled X at the
top-right corner of the screen); (b) by double-clicking the program icon at the
top-left corner of the screen; or (c) by selecting File / Exit from the menu bar.
A dialog box will pop up asking you if you want to “Delete Untitled
GROUP?” Choose Yes to All (or, just choose Yes
and then Yes again when asked if you
want to “Delete Untitled EQUATION?”)
EViews will close and return you to Windows.
Step 7: Use the Data Again Later
Now that you’ve entered the data, you can re-use
them any time. Start EViews again, and
insert your diskette into the A:\ drive.
Now select File from the main
menu. But this time, rather than
selecting New, choose Open / Workfile. Select 3½
Floppy (A:) from the “Look in:” box, and EViews will display the names of
all workfiles stored on your disk.
Select example1.wf1 either by
double-clicking on it, or by clicking once on the name and then on the Open button. The Workfile window will now open, with the
title “Workfile: EXAMPLE1 -
(a:\example1.wf1).”
To view the data in spreadsheet form, click on GALLONS in the window. Then hold down the Ctrl key on the keyboard and select PRICE. Both variable names
will now be highlighted. Select the Show button from the toolbar, and
choose Ok when prompted with a
dialog box. You are now exactly where
you were at the end of Step 2 above, ready to analyze the data in any way you
like. (By the way, clicking PRICE, then
<Ctrl>-GALLONS, reverses the columns.
We could have used this to reverse the axes on our graph, back at the
top of page 6.)
IV. Illustration Using Interactive Commands
The menu system is handy because it prompts you at
each step of the way, so you don’t need to remember commands. But menus can be slow and cumbersome, so it’s
useful to remember a few simple commands.
Re-start EViews and type the following commands in the command
window. Commands may be typed in either
upper case or lower case. Some commands
have “options,” which are enclosed in parentheses after the command. Remember to hit Enter after each command.
(When prompted with “Delete unnamed GROUP?” select Yes.) This exercise produces
exactly the same results as we obtained above using menus. Explanations are given for each command:
Command Function
create u 4 Creates
a workfile. “U” means “undated,” and “4”
is the number of observations.
data gallons price Opens
a spreadsheet for data entry. After the
spreadsheet appears, enter data on the variables GALLONS and PRICE as explained
in Step 2 above. When you’re done
entering data, click the mouse in the command window again below this command
to restore the insertion point, then continue by typing the next command:
plot gallons price Creates a line graph of the
two variables.
scat(r) gallons price Creates a scatter diagram of the two variables. The first-named variable is on the horizontal
axis. Other variables listed are plotted
on the vertical axis, each with a different symbol. The “R” option includes the regression
line. Note that “scat(r)” is one word,
with no space after the “t.” Inserting a
space would cause this command to fail.
stats gallons price Calculates descriptive statistics.
ls gallons c price Estimates
a least-squares (“LS”) regression equation.
The dependent variable is listed first, followed by the explanatory
variable(s). The “C” in the explanatory
variable list tells EViews to include a constant term, or intercept, in the
equation. Always use the LS command, rather than the menu, to do regressions! But be sure to remember to include the “C,”
otherwise your results will be junk.
save a:\example1 Saves
the current workfile on disk A:. It’s
important to include the path specification “A:\.” If you don’t, EViews will
save it in the default directory indicated by the “Path =” at the bottom of the
EViews window.
exit Closes
EViews.
Here are a
couple other useful commands:
load a:\example1 Load
the saved workfile EXAMPLE1.WF1 from disk A:.
genr logq = log(gallons) Creates (“GENeRates”) a new variable, here called LOGQ,
which is the natural logarithm of the variable GALLONS. This command allows all arithmetic operations
including +, –, * (multiplication), / (division), and ^ (exponentiation);
logical operations; and built-in functions such as SQR(X), EXP(X), and ABS(X).
genr yres = resid The
name “RESID” is a “reserved” name in EViews that refers to the residuals from
the most recently estimated regression.
Reserved names cannot be used as names for variables or other
objects. If you want to save the
residuals from a regression (which is often useful), you have to assign them a
different name. This command saves the
residuals as a variable named “YRES.”
More information on commands can be found in the EViews
help facility.
V. Using Help
At the beginning of Section II above we took a quick
look at the EViews Help window. Now
let’s take a closer look. In the EViews
main window, select Help / EViews Help
Topics... to re-open the Help Topics window. There are three tabs: Contents, Index, and Find. The Index and Find tabs are useful for
searching for specific information using keywords. For now, let’s focus on the Contents tab.
Topics with question marks next to them can be
viewed either by clicking on the topic and then on the Display button, or by
just double-clicking on the topic. Items
with books next to them can be expanded by clicking on the item and then the
Open button, or by double-clicking the item.
For example, open the EViews
Basics book, then select Introduction
to EViews. This opens the “EViews
Help System” window. This window
displays the first of several screenfulls of basic information about the
program from Chapter 1 of the EViews
User’s Guide. To move up and down
within this window, click on the “scroll bar” on the window’s right-hand
edge. To go to another topic, click on
the Contents button on the EViews Help System window. (Note:
do not close this window, or
you’ll have to re-open Help from the EViews main window.) Most of the EViews User’s Guide is contained in the Help facility.
For help with specific commands, open Reference (Commands and Functions) from
the Contents tab and select Command
Reference. Commands are listed
alphabetically following a brief introduction.
As an exercise, find and display the LS command.
For help on a particular topic, select the Index tab from the Help Topics window
(or the Index button from the Eviews Help System window. Then either scroll through topics using the
scroll bar, or type a topic or command.
For example, type LS in the
dialog box, then select Display, (or
just hit the Enter key).
There are shortcuts to some help topics directly
from the EViews main window. With all
Help windows closed, select Help
from the main menu, but then rather than selecting “EViews Help Topics...,”
select Command Reference
instead. This gets you to exactly the
same place you got to through the Contents window.
VI. Printing EViews Output
While using the Print button in EViews is probably
the quickest way to get hard copy, a more versatile way to use EViews output is
to copy it from the EViews window and paste it into a Microsoft Word
document. This allows you to integrate
regression output into a report and to format it in any way you choose. Here are the steps:
1. From EViews, open Word by either (a) clicking
on the Word button on the Microsoft
Office toolbar or (b) clicking theWindows Start
button and opening Word from the Start menu.
2. Click on the EViews button on the Windows taskbar at the very bottom of the
screen.
3. Click the mouse in the upper-left corner of
the window containing your output, and hold the button down as you move the
mouse to highlight the area you want to copy.
When you have highlighted the desired text, release the mouse button.
4. Select Edit
/ Copy from the EViews main menu.
(Alternatively, press <Ctrl>-C
on the keyboard.) Click OK in the Copy Precision dialog box to
copy the numbers as they appear in the table.
5. Click on the Microsoft Word button on the taskbar to return to Word. Position the insertion point at the location
where you want to insert the copied text, and select Edit / Paste from the Word menu (or press <Ctrl>-V).
This copies the output into Word as a table. It probably won’t look very pretty at first,
so you’ll want to do some reformatting to clean it up. Experiment to find a format that you
like. As a suggestion, I’ve found that
the following procedure works pretty well:
1. Once you’ve copied the table into your Word
document, click anywhere in the table, and select Table / Select Table from the Word menu.
2. With the table highlighted, select Table / Convert Table To Text, and
click OK to separate data using
tabs.
3. With the text still highlighted, select Format / Tabs / Clear All / OK.
4. Now insert blank lines before and after the
sixth line (the one that begins with the word “Variable”) and another before
the line that begins “R-squared.” These
blank lines replace the double lines that divide the table in the EViews
output, and separate the output into three sections: a five-line header, the coefficient estimates
and related statistics, and finally summary statistics for the model.
After adding and deleting a few tabs, this seems to
produce fairly clean output, at least using the Times New Roman 12 font (which
is the font used in this document).
Regression results from this example look like this:
Dependent Variable: GALLONS
Method: Least Squares
Date: 09/27/02 Time: 00:24
Sample: 1 4
Included observations: 4
Variable Coefficient Std. Error t-Statistic Prob.
C 11.00000 2.323790 4.733646 0.0418
PRICE -2.400000 0.848528 -2.828427 0.1056
R-squared 0.800000
Mean dependent var 5.000000
Adjusted
R-squared 0.700000
S.D. dependent var 3.464102
S.E.
of regression 1.897367
Akaike info criterion 4.425664
Sum
squared resid 7.200000
Schwarz criterion 4.118811
Log
likelihood -6.851327
F-statistic 8.000000
Durbin-Watson
stat 2.622222 Prob(F-statistic) 0.105573
Experiment to see what works best for you. (For residuals plots from the LS routine, a
fixed-pitch font such as Courier New works better than a proportional font at
lining up the plot. You might experiment
with different font styles and sizes.)
You can even copy graphs into your Word document.
VII. Saving Results in the Workfile
You can copy EViews output to a Word document
regardless of whether you save the results in the EViews workfile. But it is sometimes convenient to save the
results in the workfile for later reference.
This can be accomplished by freezing
views of results and storing them as objects
in the workfile. This can be done using
the Freeze and Name buttons in a view window, or using the Freeze command.
There are two steps involved. (See “EViews Basics / Object Basics” from the
EViews Help menu.) First, you must
assign a name to the object whose view you want to save. Then you must freeze the view. The general form of the freeze command is:
freeze(name2) name1.view
Here, name1 is the name of the object whose view you want to save, and view is the type of view. Name2
is the name that will be given to the frozen view stored in the workfile.
Okay, this all sounds pretty
convoluted—and it is. So here’s an
example that might help clarify. This
example uses three different views of a group object (“scat(r)”, “stats,” and
“cor”) and two different views of an equation object (“stats” and “cov”). It saves each of these views with a unique
name.
First, load the workfile
EXAMPLE1.WF1 from your diskette, and then type the following commands in the
command window:
Command Function
group g1 price gallons This is a “declaration” command. It creates a group object named “g1,”
consisting of the two series “price” and “gallons.” A group is just a collection of series. This command is necessary so that we can
refer to these series as a group in the next commands.
freeze(plot) g1.scat(r) This command does two things. First, reading right-to-left, it creates a
scatter plot of the series in the group g1, and includes the regression line
because of the “r” option. Then it
freezes the graph, gives it the name “plot,” and saves it in the workfile. The Freeze command does not produce any
output that is visible on your screen, other than adding the name to the
workfile window. Later, we can use the
Show command to view the graph.
freeze(sampstat) g1.stats This calculates sample statistics for the series in g1, and
freezes the output in a table with the name “sampstat.”
freeze(corr) g1.cor Ditto for the correlation matrix.
equation eq1 This
is a “declaration” command. It simply
defines an equation object with the name “eq1.”
At this point the equation object contains no output, but we have to
reserve the name in order to give it some output with the next command.
eq1.ls gallons c price This is a new form of the LS command. By using the prefix “eq1.” we direct the
results of the regression to be stored in the equation eq1. We can use this name later to refer to the
results. (Actually, this and the previous
command could have been combined into one, as:
“equation eq1.ls gallons c price.”
This saves one step.)
freeze(results) eq1.stats Freezes the coefficient estimates and summary regression
statistics (the default regression output) in a table named “results.”
freeze(covar) eq1.cov Freezes the view of the coefficient variance-covariance
matrix in a table named “covar.”
show plot Now
look at the scatter diagram. If you
like, you can copy and paste into your Word document.
show sampstat Here
are the descriptive statistics.
show corr Correlations
among series.
show results Regression
results.
show covar Coefficient
variance-covariance matrix.
Now, when you exit from EViews you should save the
the workfile with these new objects in case you want to access them again
quickly later on.
VIII. Running EViews Programs
(Note: This feature is not available in the EViews Student Version. It is only available in the full version of
EViews that is available in the PH 210 computer lab.)
So far we’ve only used EViews interactively, either
via the menu system or by typing commands in the command window. This is very fast and convenient, but it has
one major drawback: we have no permanent
record of the procedures that generated the results. This is especially a problem when we have
manipulated the data significantly. For
example, suppose you estimate a model using a variable called “dlpusca.” You might remember that this is a mnemonic
for “change in the log of the exchange-rate-adjusted real U.S./Canadian price
ratio,” but you might not remember that it was created using the commands:
genr
pusca = cpius*exchrate/cpica
genr
dlpusca = log(pusca) – log(pusca(–1)).
You get the idea.
So it’s good practice to have some permanent record of all data manipulation
and analysis.
The best way to do this is to create a program file that contains your EViews
commands, and then execute the commands from within EViews. The program file must be a plain text file
with the extension “.prg” (not a
word-processor-formatted file such as a Word “.doc” file!). You can create a program file using the
Windows Notepad application, but the easiest way is to use the program file
editor within EViews. From the EViews
main menu, select File / New / Program. This opens a “Program” window in which you
can type the commands. (Alternatively,
you can create the file using the Windows Notepad application, or “File / Save
As / Text Only” from Word.) Here are the
steps:
1. From the EViews main menu, select File / New / Program. This opens a “Program” window with the title
“Program: UNTITLED.” Type the following commands in the Program
window:
create u 4
read a:\example1.txt gallons price
group g1
price gallons
freeze(plot) g1.scat(r)
freeze(stats) g1.stats
freeze(corr) g1.cor
equation eq1.ls
gallons c price
freeze(results) eq1. stats
freeze(covar) eq1.cov
show plot
show stats
show corr
show results
show covar
2. Select Save
from the Program window, and provide a file name. For example, the commands above could be
stored in a file called example1.prg.
3. To execute the commands, select Run from the Program window.
When you execute commands in a program file, the
data must be read from an external file.
That’s what the “read” command is for.
The data for this program are stored in a plain text file called
example1.txt. This file contains the
data for this example:
10 1
4 2
4 3
2 4
A data .txt file can be created using Windows
Notepad or exported from a spreadsheet program such as Excel.
To edit a previously-created program file, select File / Open from the EViews main menu,
then select “Program .prg” from the
“Select Files of Type” box, and select the file that you want to edit. Remember to Save changes that you make before exiting from EViews.
[1] Under some conditions, Eviews will not open on computers. This is often because another drive is active on the computer. The usual suspect is the “S” drive. If Eviews does not open, go to “My Computer,” right click on the “S” drive under “Network Drives” and choose disconnect. Then try to restart Eviews.