Chapter 7, “Look At Your Data,” for both simple and advanced techniques for describing your data, or to Chapter 5, “Picture This!,” if it’s graphs and plots you’re after. If you like the more orderly approach, continue on to the next chapter where we’ll start the adventure of setting up your own workfile and entering your own data.
Chapter 2. EViews—Meet Data
When you embark on an econometric journey, your first step will be to bring your data into EViews. In this chapter we talk about a variety of methods for getting this journey started on the right foot.
Unlike the blank piece of paper that appears (metaphorically speaking) when you fire up a word processor or the empty spreadsheet provided by a spreadsheet program, the basic EViews document—the workfile—requires just a little bit of structuring information. We begin by talking about how to set up a workfile. Next we turn to manual entry, typing data by hand. While typing data is sometimes necessary, it’s awfully nice when we can just trans- fer the data in from another program. So a good part of the chapter is devoted to data import.
To get started, here’s an excerpt from the file “AcadSalaries.wf1”. This file, available on the EViews website, excerpts data from a September 1994 article in Academe, the journal of the American Association of University Professors. The data give information from a survey of salaries in a number of academic disciplines. The excerpt in Table 1: Academic Salary Data
Excerpt shows average academic salaries and corresponding salaries outside of academics.
Table 1: Academic Salary Data Excerpt
OBS DISCIPLINE SALARY NONACADSAL
1 Dentistry 44,214 40,005 2 Medicine 43,160 50,005 3 Law 40,670 30,518 4 Agriculture 36,879 31,063 5 Engineering 35,694 35,133 6 Geology 33,206 33,602 7 Chemistry 33,069 32,489 8 Physics 32,925 33,434 9 Life Sciences 32,605 30,500 10 Economics 32,179 37,052 … … … … 28 Library Science 23,658 15,980
The Structure of Data and the Structure of a Workfile
Look at Table 1: Academic Salary Data Excerpt .First thing to notice: data come arranged in rows and columns. Every column holds one
series of data; for example, the values of SALARY for every discipline. Every row holds one observation; an example being the value of SALARY, NONACADSAL, and the name of the discipline for “dentistry.” When data come arranged in a neat rectangle, as it does here, stat- isticians call the arrangement a “data rectangle.”
Second thing to notice: the observations (rows) come in order. In the column marked “obs”
the observations are numbered 1, 2, 3, 4…28. The observation numbers are sometimes called, well, “observation numbers.” Sometimes the entire set of observation numbers is called an “identifier” or an “id series.” When appropriate, dates are used in place of plain numbers.
EViews needs to know how observations are numbered. When you set up a workfile, the first thing you need to do is tell EViews how the identifier of your data is structured: monthly, annual, just numbered 1, 2, 3, …, etc. Your second task is to tell EViews the range your observations take: January 1888 through January 2004, 1939 through 1944, 1 through 28, etc.
And that’s all you need to know.
Hint: When thinking of an econometric model, a data series is often just called a “vari- able.”
Hint: Series (columns) don’t have any inherent order, but observation numbers (rows) do. SALARY is neither before nor after DISCIPLINE in any important sense. In contrast, 2 really is the number after 1.
Hint: Every variable in an EViews workfile shares a common identifier series. You can’t have one variable that’s measured in January, February, and March and a different variable that’s measured in the chocolate mixing bowl, the vanilla mixing bowl, and the mocha mixing bowl.
Subhint: Well, yes actually, you can. EViews has quite sophisticated capabilities for handling both mixed frequency data and panel data. These are covered later in the book.
Creating a New Workfile—27
Creating a New Workfile
Open EViews and use the menu to choose File/New/Workfile… The
Workfile Create dialog pops up.
You’ll notice in the dialog that EViews defaults to “Dated – regular frequency” and
“Annual.” However, the data shown in Table 1: Academic Salary Data Excerpt are just num- bered sequentially. They aren’t dated.
Choosing the Workfile structure type dropdown menu offers three choices:
Our data are Unstructured/Undated. Select this option. Later in this chapter we’ll discuss
Dated – regular frequency. (Balanced Panel is deferred to Chapter 11, “Panel—What’s My Line?.”)
Hint: Alternatively, you can type
wfcreate
in the command pane to bring up the same dialog.
Hint: Changing the type of workfile structure can be mildly inconvenient, so it pays to think a little about this decision. In contrast, simply increasing or decreasing the range of observations in the workfile is quite easy.
Unstructured/Undated instructs
EViews to number the observations from 1 through however-many-obser- vations-you-have. In our example we have 28 observations. Enter “28” in the field marked “Observations:” If you’d like to give your workfile a name you can enter the name in the “WF:” field at the lower right. You can also name the workfile when you save it, so giving a name now or later is purely a matter of personal prefer- ence.
Hit and the workfile is cre- ated for you.
Deconstructing the Workfile
There’s no data yet, but let’s dissect what EViews starts you off with. The initial workfile window looks something like the picture to the right. The title bar shows the name of the workfile. Since we didn’t enter a name for the workfile in the dialog, EViews uses “UNTITLED” in the title bar.
The workfile window has buttons at the top and
tabs at the bottom. The buttons provide menus linked to each EViews window type. The tabs mark pages, essentially workfiles within a workfile. We’ll come back to pages in
Chapter 9, “Page After Page After Page”; they’re particularly useful for holding sets of data with different indices.
Hint: Alternatively, we can enter
wfcreate u
in the command pane.
Hint: If you like, the workfile can be created with the single command
Time to Type—29
Let’s look at the main window area, which is divided into a upper pane holding information about the workfile and a lower pane displaying information about the objects—series, equa- tions, etc.—that are held in the workfile.
Range tells you the identifying numbers or dates of the first and last observation in the
workfile—1 and 28 in this example—as well as the count of the number of observations.
Sample describes the subset of the observations range being used for current operations.
Since all we’ve done so far is to set up a workfile with 28 observations, both Range and
Sample are telling us that we have 28 observations. (Later we’ll see how to change the num-
ber of observations in the workfile by double-clicking on Range, and how to change the sample by double-clicking on Sample.)
Display Filter is used to control which objects are displayed in the workfile window. Dis- play Filter is useful if you have hundreds of objects: Otherwise it’s safely ignored.
Let’s move to the lower panel. Our brand new workfile comes with two objects preloaded: and . The series RESID is designated specially to hold the residuals from the last regression, or other statistical estimation. (See Chapter 3, “Getting the Most from Least Squares” for a discussion of residuals.) Since we have not yet run an estimation procedure, the RESID series is empty, i.e., all values are set to NA.
An EViews workfile holds a collection of objects, each kind of object designated by its own icon. Far and away the most important object is the series (icon ), because that’s where our data are stored. You’ll have noted that the object C has a different icon, a Greek letter . Instead of a data series, C holds values of coefficients. Right now C is filled with zeros, but if you ran a regression and then double-clicked on C you would find it had been filled with estimated coefficients from the last regression.
Time to Type
One Series at a Time
We sit with an empty workfile. How to bring in the data? The easiest way to bring data in is to import data that someone else has already entered into a computer file. But let’s assume that we’re going to type the data in from scratch. Table 1: Academic Salary Data Excerpt dis- plays three variables. You have a choice of entering one variable at a time or entering several in a table format. We’ll illustrate both methods.
Suppose first we’re going to enter one series at a time, starting with NONACADSAL. We want to create a new series and then fill in the appropriate values. The trick is to open a window with an empty series (and then fill it up). There are a bunch of ways to get the desired window to pop open.
These two methods pop open an Untitled series:
• Type the command “series” in the command pane. • Use the menu commands Object/New/Series
These two methods create a series named NONACADSAL and place it in the workfile: • Type the command “series nonacadsal” in the command window.
• Use the menu commands Object/New/Series and then enter NONACADSAL in the Name for object field.
The latter two methods place in the workfile. Double-click to open a series window. In contrast, the former two methods open a window automatically, but don’t name it. These methods open an untitled series win- dow.
To name the untitled series, click on the button and enter NONACADSAL.
• EViews doesn’t care about capitalization of names. NONACADSAL and nonacadsal are the same thing.
Time to Type—31
We’re ready to type numbers. But there’s a trick to entering your data. To protect against accidents, EViews locks the window so that it can’t be edited. To unlock, click on the button. Unlocked windows, as shown below for example, have an edit field just below the button bar. One way to know that a window is locked against editing is to observe the absence of the edit field. Alternatively, if you start typing and nothing happens, you’ll remember that you meant to click on the button—at least that’s what usually hap- pens to the author.
Initially all the entries in the window are NA, for not available. Click on the cell just to the right of the and type the first data point for nonacademic sala- ries, 40005. Hit Enter to complete the entry.
Enter the rest of the data displayed at the beginning of the chapter. You can use all the usual arrow and tab keys as well as the mouse to move around. In addition, when a cell is selected you can edit its contents in the edit field in the upper left of the window.
Hint: Naming a series (or other object) enters it in the workfile at the same time it attaches a moniker. In contrast, Untitled windows are not kept in the workfile. If you close an Untitled window: Poof! It’s gone. The key to remember is that named objects are saved and that Untitled ones aren’t. This design lets you try out things without cluttering the workfile.
Related hint: You can use the EViews menu item Options/General Options/Win-
dows/Window Behavior to control whether you get a warning before closing an Unti-
tled window. See Chapter 18, “Optional Ending.”
Hint for the terminally obedient: For goodness sakes, don’t really enter all the data at the beginning of the chapter. You’ll be bored out of your mind. Just type in a few num- bers until you’re comfortable moving around in the window.
Label View
We know that EViews provides several different views for looking at a series. We enter data in the spreadsheet view and if we need to make a change we can come back to the spreadsheet view to edit existing data. Use the but- ton to reach the label view where space is provided for you to enter a description, source, etc.
EViews automatically fills in the name and date the series was last updated. The other fields are optional. EViews
uses the Display Name for labeling output, so it’s well worth filling out this field. Make the label long enough to be meaningful, but short enough to fit in scarce space on a graph leg- end. EViews will occasionally make an entry in the Remarks: field. When you start making transformations to a series, a History: field is added with notes on the last ten or so changes.
Typing a Table at a Time
Now let’s turn to entering data in the form of a table. As an example, we’ll enter the name of the academic discipline and the academic salary together. We begin with the same choice— do we name the series before or after we open the window? If you like to name first, do the following:
• Type the following commands in the command window:
series salary alpha discipline
• Select DISCIPLINE and then SALARY in the workfile window (hold down the Ctrl key to select both series), double-click and choose Open Group to open a group window. Hint: It’s worth the trouble to add as much documentation as possible in the series label. Later, you’ll be glad you did.
Hint: Series in a group window are displayed from left to right in the same order as you click on them in the workfile window.
Time to Type—33
Note that the series DISCIPLINE is displayed with the icon to signal a series holding alphabetic data, as contrasted with the icon for ordinary numeric series.
If you like to open a window before creating a series, do the following: Use the menu Quick/Empty Group (Edit Series).
Move up one cell from the default (you may want to use the scroll bar on the right hand side) and enter the word DISCIPLINE. EViews determines if you are specifying a series with numbers or with letters. Since DISCIPLINE is an empty alpha series, you will see empty val- ues in the DISCIPLINE column.
Then move one cell to the right of DISCI- PLINE and enter SALARY. EViews fills out the series with NAs.
Click the button and type away. When editing a group window, the Enter key moves across the row rather than down a column. This lets you enter a table of data an observation at a time rather than one variable after the other; the observation at a time technique is fre- quently more convenient.
Hint: You can name a group and store it in the workfile just as you can with a series. Internally, a group is a list of series names. It’s not a separate copy of the data. A series can be a member of as many different groups as you like.
Hint: EViews uses NA to indicate “not available” for numeric series and just an empty string for a “not available” alpha value. The latter explains why the observations for DISCIPLINE are blank.
Identity Noncrisis
An important side effect of thinking of our data as being arranged in a rectangle is that each row has an observation number that identifies each observation. In a group window as above, or in a series window, the id series is called “obs” and appears on the left-hand side of the window. Obs isn’t really a series, in that you can’t access it or manipulate it. It serves to give a name to each observation.
When we set up an Unstructured/Undated workfile, EViews just numbers the observations 1, 2, 3, etc. (In dated workfiles, see below, dates are used for ids rather than sequence num- bers.) Rather than calling data for dentistry “observation 1” and data for medicine “observa- tion 2,” it might be a lot more meaningful to label them “dentistry” and “medicine.” EViews lets us specify that one of the existing series—obviously DISCIPLINE is the sensible choice— should be used as the id series.
Changing the id series requires “restructuring” the workfile. This is no big deal: “restructuring” amounts essentially to telling EViews to use an id series. Dou- ble-click on Range in the upper pane of the workfile window or choose the menu item
Proc/Structure/Resize Current Page…. Then choose Undated with ID series and fill in the
series you want used for the id, as illustrated here.
Hint: To change the left-to-right order of series in a group use the menu View/Group Members. You’ll see a list of series in the group. Edit the text—cut-and-paste is useful here—re-arranging the names into the desired order and
click to accept the changes. Alternatively, there’s no law against closing the group window and opening a new one. Sometimes that’s faster.
Identity Noncrisis—35
You’ll notice that the Range field in the work- file window is now marked “(indexed).”
Now if we look at a spreadsheet view of SAL-
ARY the rows are labeled with DISCIPLINE in place of an uninformative observation number.
Hint: If you want to be able to see more or less of the id series in the left-hand column, just grab the col- umn divider and drag it over to the right. All column widths are adjust- able in the same way.
Counting Hint: If you want to add the observation number to the label right-click and select ObsID +/-. To return to the original display, just do it again.
Dated Series
Let’s set aside our academic salary example for a bit and talk about more options for the identification series and the parallel options for structuring a workfile.
EViews comes with a rich, built-in knowledge of the calendar. Lots of data—lots and lots of data—is dated at regular intervals. Observations are taken annually, quarterly, monthly, etc. EViews understands a variety of such frequencies. The only difference between creating an undated workfile and a dated workfile is that for an undated workfile you enter the total number of observations, while for a dated workfile you provide a beginning date and an ending date.
Let’s create a couple of workfiles for practice. As a first example, let’s make an annual workfile for the Roosevelt years (Franklin, not Teddy). Use the menu command File/New/Work-
file… to bring up the Workfile Create
dialog. Fill in the fields as shown.
Note that when the workfile window
pops open, Range shows 1933 to 1945 and that there are 13 observations in the workfile.
Hint: Even when data are measured at regular intervals, measurements are sometimes missing. Not a problem, just leave missing measurements marked NA.
Dated Series—37
A second example. Most national income accounting macro data for the United States is available on a quar- terly basis starting in 1947. To set up a quarterly workfile use
File/New/Workfile… and change the
drop down menu Date Specifica-
tion/Frequency: to Quarterly. A new
issue arises: what are the formats for specifying dates? Rules for date for-