Last modified: 2003 Jun 06
This is very much in progress.
I'd say it's about half done.
Perhaps it will prove of some use in its current state.
EViews is a state-of-the-art, user-friendly econometric package with a strength in time-series analysis. It is currently available only for the Windows operating system. On the AU campus, EViews is available as an EagleNet application.
EViews comes with extensive documentation in the form of two online books: the Command and Programming Reference and the User's Guide. You should read chapter 3 ("EViews Basics") of the User's Guide. You should always read about each command and option you use in the Command and Programming Reference. Aside from that, read these resources selectively. They are very helpful, but the User's Guide focuses unfortunately on the "point-and-click" approach to data analysis, which is a very bad approach to serious empirical research. (Specifically, it renders replicability impossible.) Much of what follows below is just text from the User's Guide, altered to be more command oriented.
I have seen students try to program with "hunt and peck" typing. Do yourself a favor and acquire some basic keyboarding skills. These can be quickly acquired. There are surely many sources of cheap software assistance. On Linux and Windows there is the free, open source TuxType. The GNU Typist has multi-language support, but I did not find a Windows version. (There is also the console based TypingTutor, but development seems to have ground to a halt.) Here is one inexpensive commercial product that I am aware of: MavisBeacon. I welcome recommendations of competitive products.
In your courses, you are often given your data in a format ready to use with your data analysis program. The "real world" is not so coddling. Often you will get data from a CD or off the web in a format that needs to be "cleaned" before you can use it. Sometimes you will need to enter data from "hard copy" sources.
Your data may be available in a variety of forms: machine readable spreadsheet, a text file that you created yourself or downloaded from the World Wide Web, or perhaps even as hardcopy or a graphics file. We want to input this data into series and group objects. (We omit for now any discussion of input into EViews matrix, vector and pool objects.) The question you face is: how can you get this data into EViews? There are four basic answers. i. If the data are preformatted for you, you may be able to copy and paste into EViews. I have had best luck with single series. ii. If the data are not quite so well arranged, you may still be able to read them into a modern spreadsheet and then export them to EViews. Recent versions of Excel seem pretty good at importing HTML tables. iii. You may have to clean up the data with a text editor, and then import it into EViews. iv. In the worst case, when the data is presented as graphics instead of text or is otherwise difficult to download, you will have to copy the data observation by observation.
For small data sets in printed form, you may wish to enter the data by typing at the keyboard. For larger data sets only available in hardcopy (or as graphics), OCR programs such as TextBridge are also useful. In generaly, however, these should be last choices: they are time consuming and error prone methods of data set creation.
To open a spreadsheet window in which you will enter the data,
first declare your series.
For example,
series series1.
Second, create a group of these series.
For example,
group mygroup series1 series2.
Display the sheet view of this group either by double-clicking the group name or with the sheet command.
For example,
mygroup.sheet.
To enter the data, click on the appropriate cell and type the number.
(You may need to click the Edit +/- button.)
Pressing Enter after entering a number will move you to the next cell.
If you prefer, you can use the cursor keys.
You can also use the Windows clipboard. The following discussion involves an example using an Excel spreadsheet, but the basic principles apply to other Windows applications. Begin in EViews by creating an empty group, just as we did for data entry by hand. Make sure to set your sample to match the sample of the data you are importing.
Open your spreadsheet in Excel. Highlight the cells to be imported into EViews. If there are column headings containing the variable names, highlight them as well. Do not copy the date column unless you need it for some reason. Click and drag across the data you want. You should see this data highlighted. Select Edit/Copy to copy the highlighted data to the clipboard. Make sure your EViews sample matches the sample for the data you copied, and then paste the new series into an empty group. (If you are pasting in the series names, first click on the up arrow in the scroll bar to make room for the series names.)
Note that when importing data from the clipboard, EViews follows the Windows standard of tab-delimited free-format data with one observation per line. Since different applications use different whitespace a#d delimiter characters, attempting copy-and-paste from nonstandard applications may produce unanticipated results.
You can also read data directly from spreadsheet file in Lotus (.wks, .wk1 or .wk3) or Excel (.xls) spreadsheet formats. If you are reading data from a multi-sheet Excel workbook file, you can also enter the name of the sheet containing your data. (If you do not enter a name, EViews will read the topmost sheet in the Excel workbook.) First, you need to tell whether the data are ordered by observation or by series. By observation means that all of the data for the first observation are followed by all of the data For the second observation, etc. By series means that all of the data for the first variable are followed by all data for the second variable, etc. That is, ``by observation'' means that variables are arranged in columns, while ``by row'' means that all of the observations for a single variable are in a single row. Next tell EViews the location of the beginning cell (upper left-hand corner) of your actual data, not including any label or date inormation. Enter the names of the series that you wish to read. EViews reads spreadsheet data in contiguous blocks, so you should provide a name for each column or row (depending on the orientation of the data), even if you only wish to read selected rows. If the names that you wish to use for your series are contained in the file, you can simply provide the number of series to be read. The names must be adjacent to your data. If the data are organized by row and the starting cell is B2, then the names must be in column A, beginning at cell A2. If the data are organized by column beginning in B2, then the names must be in row 1, starting in cell B1. Finally, you need to tell EViews the sample of data that you wish to import. EViews begins with the first observation in the file and assigns it to the first date in the sample for each variable. Each successive observation in the file is associated with successive observations in the sample. Thus, in an annual workfile, if you enter the sample: 1971 1975 1990 1991 the first 5 observations will be assigned to the dates 1971–1975, and the sixth and seventh observations will be assigned to the dates 1990–1991. The data in the intermediate period will be unaffected by the importing procedure. If you read into a sample which has more observations than are present in your input file, observations for which there are no corresponding inputs will be assigned missing value codes.
ASCII file import is considerably more complicated than spreadsheet import since there is no standard format for ASCII files. EViews provides you with a range of options to handle various types of ASCII files. ASCII file importing is explained in considerable detail in chapter 4 of the EViews User's Guide, and the ``Addendum: Reading ASCII Files'' is particularly helpful.
series cpi.
cpi.sheet.
Click the Edit +/- button to make this view editable and place the cursor in the cell first observation (which will have an NA in it).
read command.
workfile command,
you can import your data with the read command.
(Be sure to read about these commands in the EViews help.)
For example, assuming you have the data in hist1800.dat,
and that you have added a single line above the data that contains the three series names,
and you have changed one missing value to NA,
then you can read the data into a new workfile as follows:
workfile cpitest a 1800 2002
read(t=dat,rect,name,label=1,d=s,mult) g:\hist1800.dat 3
EViews offers a "user-friendly", mouse-oriented environment. This "point-and-click" environment is very nice for getting acquainted with a data set, but is does not allow you to keep track of all that you have done when you are conducting empirical research. For this reason, after any initial exploration, you should always conduct your analysis by means of an EViews program. For this purpose, EViews allows you to create program (.prg) files. To start a new program file, pick File, New, Program from the EViews menus. A new program window will open. Enter EViews commands into the program window, the Save your program and Run it.
In EViews we work with "objects". Examples are series, groups, graphs, and tables. Series and groups hold data. Graphs and tables display data.
All objects must be contained in an object container. The basic object container is the workfile. So generally the first thing you do when starting an EViews project is create a workfile.
To create a workfile you need to know three things: a name for the workfile, a frequency of observation, and a range of dates. Create an workfile named temp intended to contain annual observations from 1800 to 2010 as follows: workfile temp a 1800 2010
The process of entering, reading, editing, manipulating,and generating data forms the foundation of most data analyses. Accordingly, most of your time in EViews will probably be spent working with data.
There are two cornerstones of data handling in EViews: data objects (especially series and groups), and the use of samples.
The actual numeric values that make up your data will generally be held in one or more of EViews' data objects (series, groups, matrices, vectors, scalars). For most users, series and groups will be, by far, the most important objects.
An EViews series contains a set of observations on a variable. Associated with each observation in the series is a date or observation label. For series in dated workiles, the observations are presumed to be observed regularly over time. For undated data, the observations are not assumed to follow any particular frequency.
Suppose we have an active workfile in which we wish to "create" a series named x1. We do this by "declaring" the series with the "series" command series x1 Let us take a look at what we have created by looking at the "spreadsheet view" of this series. This is done with the "sheet" command. x1.sheet This command causes EViews to open a spreadsheet view of the new series object. Note that all of the elements of the series have been assigned the missing value code ``NA''. This is because we have not yet assigned any values to this series.
There are many ways to assign values to the elements of a series. Two of the most common are: i. Assign values resulting from the mathematical manipulation of other series. ii. Assign values element by element.
Example:
Suppose our workfile contains a money supply series, M,
and a price level series, P.
We can set our new series mp equal to real money supply with the command
mp=M/P
Note that the division operation will be done element-by-element for every observation where both M and P do not have a missing value.
Example: Suppose we want to set the first element of x1 to the value 15. We do this as x1(1)=15
Once you see the sheet view of a series, EViews provides you with some menu driven options for altering it. The default display has the observations for the series in a single column, with date labels in the margin. The wide display arranges the observations from left to right and top to bottom, matching the frequency of the data when this is sensible. Toggle between the wide and narrow views with the button labeled Wide +/-.
You can also restrict the data dispaly to the current sample. By default, all observations in the workfile are displayed. Click Smpl +/- to toggle between showing all observations in the workfile and showing only those observations in the current sample.
When working with multiple series, you will often want to create a group object to help you manage your data. A group is a list of series names (and potentially, mathematical expressions) that provides simultaneous access to all of the elements in the list.
With a group, you can refer to sets of variables using a single name. Thus, a set of variables may be analyzed, graphed, or printed using the group object, rather than each one of the individual series. Therefore, groups are often used in place of entering a lengthy list of names. Once a group is defined, you can use the group name in many places to refer to all of the series contained in the group.
You will also create groups of series when you wish to analyze or examine multiple series at the same time. For example, groups are used in computing correlation matrices, testing for cointegration and estimating a VAR or VEC, and graphing series against one another.
There are several ways to create a group. You should enter the names of the series to be included in the group. You can use group names as well as series names. If you include a group name, all of the series in the named group will be included in the new group. Note that only the series are contained in the new group, not the old groups itself. (That is, if you later add series to the old group, they will not be added to the new group.) Finally, you can include series expressions. Series expressions are mathematical expressions that may involve one or more series. EViews will evaluate the series expressions for each observation and display the results as if they were an ordinary series.
You can also create an empty group that may be used for entering new data from the keyboard or pasting data copied from another Windows program. See ``Copying-and-Pasting'' on page 65.
EViews allows easy setting of the sample of observations. The sample is the set of observations in the workfile to be included in displays and in statistical procedures. Samples may be specified using ranges of observations and/or ``if conditions'' that observations must satisfy to be included. For example, you can tell EViews that you want to work with observations from 1953:1 to 1970:12 and 1995:1 to 1996:12. Or you may want to work with data from 1953:1 to 1958:12 where observations on a specified series exceed 0.
When you create a workfile, the global or workfile sample is set initially to be the entire range of the workfile. The workfile sample tells EViews what set of observations you wish to use for subsequent operations. Unless you want to work with a different set of observations, you will not need to reset the workfile sample.
The current workfile sample of observations is displayed at the top of your workfile window.
The workfile sample is set with the smpl command.
For example,
smpl 1955 1973 1990 2000 tells EViews to use observations for 1955 through 1973 and observations for 1990 through 2000 in subsequent operations;
observations from 1974 through 1989 will be excluded.
EViews lets you restrict the sample by adding if conditions
:
smpl 1955 1973 if var1>var1(-1) tells
EViews to use in subsequent operations those observations for 1955 through 1973 for which var1 has risen relative to its previous period's value.
Your if conditions
can contain ``or'' and ``and'' operators:
smpl 1955 1973 if var1>var1(-1) and var2<var2(-1) tells
EViews to use in subsequent operations those observations for 1955 through 1973 for which var1 has risen relative to its previous period's value and var2 has
fallen relative to its previous period's value.
(Use parentheses to group the conditions and operators whenever the order of evaluation is otherwise ambiguous.)
Should a comparison in the if condition
encounters a missing value,
EViews evaluates the condition to false (so the observation will not be included in the sample).
EViews provides some keywords that make entering sample ranges easier. The keyword ``@all'' refers to the entire workfile range. The keywords ``@first'' and ``@last'' refer to the first and last observation in the workfile. Thus, the following sample ranges are identical:
smpl @all smpl @first @last
Sample range elements may contain mathematical expressions.
For example, the sample string 1955:1 1955:1+11 defines a sample that includes the 12 observations in the calendar year beginning in 1955:1.
EViews expects date offsets that are integer values:
use the ``@round'', ``@floor'' or ``@ceil'' functions to force non-integer numbers to integer values.
This feature can be used to set up a fixed width window of observations.
If you work with well-defined subsets of your data, you will find sample objects to be indispensable.
Declare a sample object named period1 with the command
sample period1 1970 1980.
Note that a sample object cannot be declared without an assignment (up through EViews 4).
Type the keyword smpl followed by the name of the sample object:
smpl period1.
You can also type the keyword smpl followed by the name of the sample string: smpl 1955:1 1958:12 if rc>3.6.