EViews 7 Users Guide I
EViews 7 Users Guide I
EViews 7 Users Guide I
ISBN: 978-1-880411-40-7
This software product, including program code and manual, is copyrighted, and all rights are
reserved by Quantitative Micro Software, LLC. The distribution and sale of this product are
intended for the use of the original purchaser only. Except as permitted under the United States
Copyright Act of 1976, no part of this product may be reproduced or distributed in any form or
by any means, or stored in a database or retrieval system, without the prior written permission
of Quantitative Micro Software.
Disclaimer
The authors and Quantitative Micro Software assume no responsibility for any errors that may
appear in this manual or the EViews program. The user assumes all responsibility for the selec-
tion of the program to achieve intended results, and for the installation, use, and results
obtained from the program.
Trademarks
Windows, Excel, and Access are registered trademarks of Microsoft Corporation. PostScript is a
trademark of Adobe Corporation. X11.2 and X12-ARIMA Version 0.2.7 are seasonal adjustment
programs developed by the U. S. Census Bureau. Tramo/Seats is copyright by Agustin Maravall
and Victor Gomez. Info-ZIP is provided by the persons listed in the infozip_license.txt file.
Please refer to this file in the EViews directory for more information on Info-ZIP. Zlib was written
by Jean-loup Gailly and Mark Adler. More information on zlib can be found in the
zlib_license.txt file in the EViews directory. All other product names mentioned in this manual
may be trademarks or registered trademarks of their respective companies.
CHAPTER 2. A DEMONSTRATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Getting Data into EViews . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Examining the Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Estimating a Regression Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Specification and Hypothesis Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Modifying the Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Forecasting from an Estimated Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Additional Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .639
CHAPTER 33. STATE SPACE MODELS AND THE KALMAN FILTER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487
Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487
Specifying a State Space Model in EViews . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492
Working with the State Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503
Converting from Version 3 Sspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509
Technical Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .787
xii—Table of Contents
Preface
The first two User’s Guide volumes provide basic documentation on using EViews. User’s
Guide I, describes EViews fundamentals and describes using EViews to perform basic data
analysis and display results. The second volume, User’s Guide II, offers a description of
EViews’ more advanced statistical and estimation features.
The remaining volumes document the use of commands and programming in EViews. The
Command and Programming Reference offers details on specific commands and functions,
while the Object Reference documents the commands for working with views and proce-
dures of objects in EViews.
The material in the User’s Guide I may be divided into three distinct parts:
You need not read the manuals from cover-to-cover in order to use EViews. Once you gain a
basic familiarity with the program you should be able to perform most operations without
consulting the documentation. We do recommend, however, that you glance at most of
Part I. “EViews Fundamentals” to gain familiarity with the basic concepts and operation of
the program.
volume
2—Preface
Part I. EViews Fundamentals
We recommend that you browse through most of the material in the above sections
before beginning serious work with EViews.
The remaining material is somewhat more advanced and may be ignored until needed:
• Chapter 7. “Working with Data (Advanced),” Chapter 8. “Series Links,” and
Chapter 9. “Advanced Workfiles” describe advanced tools for working with
numeric data, and tools for working with different kinds of data (alphanumeric
and date series, irregular and panel workfiles).
• Chapter 10. “EViews Databases” describes the EViews database features and
advanced data handling features.
This material is relevant only if you wish to work with the advanced tools.
4—Part I. EViews Fundamentals
Chapter 1. Introduction
What is EViews?
EViews provides sophisticated data analysis, regression, and forecasting tools on Windows-
based computers. With EViews you can quickly develop a statistical relation from your data
and then use the relation to forecast future values of the data. Areas where EViews can be
useful include: scientific data analysis and evaluation, financial analysis, macroeconomic
forecasting, simulation, sales forecasting, and cost analysis.
EViews is a new version of a set of tools for manipulating time series data originally devel-
oped in the Time Series Processor software for large computers. The immediate predecessor
of EViews was MicroTSP, first released in 1981. Though EViews was developed by econo-
mists and most of its uses are in economics, there is nothing in its design that limits its use-
fulness to economic time series. Even quite large cross-section projects can be handled in
EViews.
EViews provides convenient visual ways to enter data series from the keyboard or from disk
files, to create new series from existing ones, to display and print series, and to carry out
statistical analysis of the relationships among series.
EViews takes advantage of the visual features of modern Windows software. You can use
your mouse to guide the operation with standard Windows menus and dialogs. Results
appear in windows and can be manipulated with standard Windows techniques.
Alternatively, you may use EViews’ powerful command and batch processing language. You
can enter and edit commands in the command window. You can create and store the com-
mands in programs that document your research project for later execution.
We have also provided detailed installation instructions in a separate sheet and in the
EViews 7 Getting Started booklet, one of which you should have received with your EViews
package. If you did not receive either the sheet or booklet, please contact our office.
6—Chapter 1. Introduction
You should familiarize yourself with the following main areas in the EViews window.
To toggle between the active window and the command window, press F5.
See “Window Behavior” on page 622 of User’s Guide I for a discussion of focus settings
which affect the use of the command window.
8—Chapter 1. Introduction
Command Editing
The command window supports Windows cut-and-paste so that you can easily move text
between the command window, other EViews text windows, and other Windows programs.
The contents of the command area may also be saved directly into a text file for later use:
make certain that the command window is active by clicking anywhere in the window, and
then select File/Save As… from the main menu.
If you have entered more commands than will fit in your command window, EViews turns
the window into a standard scrollable window. Simply use the scroll bar or up and down
arrows on the right-hand side of the window to see various parts of the list of previously
executed commands. You may move the insertion point to previously executed commands,
edit the existing command, and then press ENTER to execute the edited version of the com-
mand.
Alternately, to display a list of previous commands in the order in which they were entered,
press the Control key and the UP arrow (CTRL+UP). The last command will be entered into
the command window. Holding down the CTRL key and pressing UP repeatedly will display
the next prior commands. Repeat until the desired command is recalled.
To examine a history of the last 30 commands, press the Control Key and the J key
(CTRL+J). In the popup window you may use the UP and DOWN arrows to select the
desired command and then press the ENTER key to add it to the command window, or sim-
ply double click on the command. To close the history window without selecting a com-
mand, click elsewhere in the command window or press the Escape (ESC) key.
To execute the retrieved command, simply press ENTER again. You may first edit the com-
mand if you wish to do so.
You may find that the default size of the command window is too large or small for your
needs. You can resize the command window by placing the cursor at the bottom of the com-
The EViews Window—9
mand window, holding down the mouse button and dragging the window up or down.
Release the mouse button when the command window is the desired size.
When a window is partly covered, you can bring it to the top by clicking on its titlebar or on
a visible portion of the window. You can also cycle through the displayed windows by
pressing the F6 or CTRL-TAB keys.
Alternatively, you may select a window by clicking on the Window menu item, and select-
ing the desired name.
10—Chapter 1. Introduction
You can move a window by clicking on its title bar and dragging the window to a new loca-
tion. You can change the size of a window by clicking on any corner and dragging the cor-
ner to a new location.
Closing EViews
There are a number of ways to close EViews. You can always select File/Exit from the main
menu, or you can press ALT-F4. Alternatively, you can click on the close box in the upper
right-hand corner of the EViews window, or double click on the EViews icon in the upper
left-hand corner of the window. If necessary, EViews will warn you and provide you with
the opportunity to save any unsaved work.
Though we have tried to be complete, it is not possible to document every aspect of EViews.
There are almost always several ways to do the same thing in EViews, and we cannot
describe them all. In fact, one of the strengths of the program is that you will undoubtedly
discover alternative, and perhaps more efficient, ways to get your work done.
Most of the User’s Guide explains the visual approach to using EViews. It describes how you
can use your mouse to perform operations in EViews. To keep the explanations simple, we
do not tell you about alternative ways to get your work done. For example, we will not
remind you about the ALT- keyboard alternatives to using the mouse.
When we get to the discussion of the substantive statistical methods available in EViews,
we will provide some technical information about the methods, and references to economet-
rics textbooks and other sources for additional information.
EViews Updates—11
In addition, the Help system will contain updates to the documentation that were made after
the manuals went to press.
EViews Updates
QMS occasionally releases patches to the EViews program, and we strongly recommend that
you keep your copy of EViews as up-to-date as possible.
You may also check for updates to the EViews program or for updates to supplementary
components such as the EViews documentation or sample data and programs manually by
visiting the Download section of the EViews website (www.eviews.com).
12—Chapter 1. Introduction
Chapter 2. A Demonstration
Before we describe the process of reading a foreign data file, note that the data for this
demonstration have been included in both Excel spreadsheet and EViews workfile for-
mats in your EViews installation directory (“./Example Files/Data”).
If you wish to skip the discussion of opening foreign files, going directly to the analysis
part of the demonstration, you may load the EViews workfile by selecting File/Open/
Foreign Data as Workfile… and opening “Demo.WF1”, or by navigating to the direc-
tory and drag-and-dropping “Demo.WF1” onto your open EViews application window
or icon.
The easiest way to read the data from Excel file “Demo.XLS” is to drag-and-drop the
file into an open EViews application window. You may also drag-and-drop the file
onto the EViews icon. In the latter case, Windows will first start the EViews applica-
tion and will then open the demonstration Excel workfile.
Alternately, you may use the File/Open/EViews workfile... dialog, selecting Files of
type Excel and selecting the desired file.
14—Chapter 2. A Demonstration
When EViews opens “Demo.XLS”, it determines that the file is in Excel file format, analyzes
the contents, and opens the Excel Read wizard.
adjust the options that appear on the second page of the wizard. In our example, the data
appear to be correct, so we simply click on Finish to accept the default settings.
When you accept the settings, EViews automatically creates a workfile that is sized to hold
the data, and imports the series into the workfile. The workfile ranges from 1952 quarter 1
to 1996 quarter 4, and contains five series (GDP, M1, OBS, PR, and RS) that you have read
from the Excel file. There are also two objects, the coefficient vector C and the series RESID,
that are found in all EViews workfiles.
In addition, EViews opens the imported data in a spreadsheet view, allowing you to perform
a initial examination of your data. You should compare the spreadsheet views with the
Excel worksheet to ensure that the data have been read correctly. You can use the scroll
bars and scroll arrows on the right side of the window to view and verify the reminder of
the data.
You may wish to click on Name in the group toolbar to provide a name for your UNTITLED
group. Enter the name ORIGINAL, and click on OK to accept the name.
Once you are satisfied that the data are correct, you should save the workfile by clicking on
the Save button in the workfile window. A saved dialog will open, prompting you for a
workfile name and location. You should enter “Demo2.WF1”, and then click OK. A second
dialog may be displayed prompting you to set storage options. Click OK to accept the
defaults. EViews will save the workfile in the specified directory with the name
16—Chapter 2. A Demonstration
Similarly, to examine a line graph of the series, simply select View/Graph... to bring up the
Graph Options dialog, and select Line & Symbol from the list of graph types on the left-
hand side. EViews will change the M1 series window to display a line graph of the data in
the M1 series.
Examining the Data—17
At this point, you may wish to explore the contents of the View and Proc menus in the M1
series window to see the various tools for examining and working with series data. You may
always return to the spreadsheet view of your series by selecting View/Spreadsheet from
the toolbar or main menu.
Since our ultimate goal is to perform regression analysis with our data expressed in natural
logarithms, we may instead wish to work with the log of M1. Fortunately, EViews allows
you to work with expressions involving series as easily as you work with the series them-
selves. To open a series containing this expression, select Quick/Show… from the main
menu, enter the text for the expression, log(m1), and click OK. EViews will open a series
window for containing LOG(M1). Note that the titlebar for the series shows that we are
working with the desired expression.
You may work with this auto-series in exactly the same way you worked with M1 above.
For example, clicking on View in the series toolbar and selecting Descriptive Statistics &
18—Chapter 2. A Demonstration
Tests/Histogram and Stats displays a view containing a histogram and descriptive statistics
for LOG(M1):
Suppose that you wish to examine multiple series or series expressions. To do so, you will
need to construct a group object that contains the series of interest.
Earlier, you worked with an EViews created group object containing all of the series read
from your Excel file. Here, we will construct a group object containing expressions involv-
ing a subset of those series. We wish to create a group object containing the logarithms of
the series M1 and GDP, the level of RS, and the first difference of the logarithm of the series
PR. Simply select Quick/Show... from the main EViews menu, and enter the list of expres-
sions and series names:
Examining the Data—19
Click on OK to accept the input. EViews will open a group window containing a spreadsheet
view of the series and expressions of interest.
As with the series object, you will use the View and Proc menus of the group to examine
various characteristics of the group of series. Simply click on the buttons on the toolbar to
access these menu entries or select View or Proc from the main menu to call up the relevant
entries. Note that the entries for a group object will differ from those for a series object since
the kinds of operations you may perform with multiple series differ from the types of opera-
tions available when working with a single series.
For example, you may select View/Graph... from the group object toolbar, and then select
Line & Symbol from the list on the left side of the dialog to display a single graph contain-
ing line plots of each of the series in the group:
20—Chapter 2. A Demonstration
Alternately, you may select View/Graph... and choose Multiple graphs from the Multiple
series drop-down on the right side of the dialog to display the same information, but with
each series expression plotted in an individual graph:
Note that the number of observations used for computing descriptive statistics for
DLOG(PR) is one less than the number used to compute the statistics for the other expres-
sions. By electing to compute our statistics using “Individual Samples”, we informed
EViews that we wished to use the series specific samples in each computation, so that the
loss of an observation in DLOG(PR) to differencing should not affect the samples used in
calculations for the remaining expressions.
Estimating a Regression Model—21
We may instead choose to use “Common Samples” so that observations are only used if the
data are available for all of the series in the group. Click on View/Covariance Analysis...
and select the Correlation checkbox to display the correlation matrix of the four series for
the 179 common observations:
Once again, we suggest that you may wish to explore the contents of the View and Proc
menus for this group to see the various tools for examining and working with sets of series
You can always return to the spreadsheet view of the group by selecting View/Spreadsheet.
where log(M1) is the logarithm of the money supply, log(GDP) is the log of income, RS is
the short term interest rate, and Dlog ( PR ) is the log first difference of the price level (the
approximate rate of inflation).
To estimate the model, we will create an equation object. Select Quick from the main menu
and choose Estimate Equation… to open the estimation dialog. Enter the following equa-
tion specification:
22—Chapter 2. A Demonstration
Here we list the expression for the dependent variable, followed by the expressions for each
of the regressors, separated by spaces. The built-in series name C stands for the constant in
the regression.
The dialog is initialized to estimate the equation using the LS - Least Squares method for
the sample 1952Q1 1996Q4. You should change text in the Sample edit box to “1952Q1
1992Q4” to estimate the equation for the subsample of observations.
Click OK to estimate the equation using least squares and to display the regression results:
Depend ent Variable: LOG( M1)
Method: Least Squares
Date: 08/18/09 Ti me: 14:14
Sample (adjusted): 1952Q2 1992Q4
Included observations: 163 after adjustments
Note that the equation is estimated from 1952Q2 to 1992Q4 since one observation is
dropped from the beginning of the estimation sample to account for the DLOG difference
term. The estimated coefficients are statistically significant, with t-statistic values well in
2
excess of 2. The overall regression fit, as measured by the R value, indicates a very tight
fit. You can select View/Actual, Fitted, Residual/Actual, Fitted, Residual Graph in the
equation toolbar to display a graph of the actual and fitted values for the dependent vari-
able, along with the residuals:
Note that the coefficients are assigned in the order that the variables appear in the specifica-
tion so that the coefficient for the PR term is labeled C(4). To test the restriction on C(4) you
should select View/Coefficient Diagnostics/Wald Test–Coefficient Restrictions…, and
enter the restriction “c(4)=2”. EViews will report the results of the Wald test:
Wald Test:
Equation: UNITITLED
Null Hyp othesis: C(4)=2
The low probability values indicate that the null hypothesis that C(4)=2 is strongly
rejected.
We should, however, be somewhat cautious of accepting this result without additional anal-
ysis. The low value of the Durbin-Watson statistic reported above is indicative of the pres-
ence of serial correlation in the residuals of the estimated equation. If uncorrected, serial
correlation in the residuals will lead to incorrect estimates of the standard errors, and
invalid statistical inference for the coefficients of the equation.
Test Equation:
Depend ent Variable: RESID
Method: Least Squares
Date: 08/18/09 Ti me: 14:10
Sample: 1952Q2 1 992Q4
Included observations: 163
Presample missin g value la gged residuals set to ze ro.
The top part of the output presents the test statistics and associated probability values. The
test regression used to carry out the test is reported below the statistics.
The statistic labeled “Obs*R-squared” is the LM test statistic for the null hypothesis of no
serial correlation. The (effectively) zero probability value strongly indicates the presence of
serial correlation in the residuals.
One approach is to include lags of the independent variables. To add variables to the exist-
ing equation, click on the Estimate button in the equation toolbar and edit the specification
to include lags for each of the original explanatory variables:
log(m1) c log(gdp) rs dlog(pr) log(m1(-1)) log(gdp(-1)) rs(-1)
dlog(pr(-1))
26—Chapter 2. A Demonstration
Note that lags are specified by including a negative number, enclosed in parentheses, fol-
lowing the series name. Click on OK to estimate the new specification and to display the
results:
Note that EViews has automatically adjusted the estimation sample to accommodate the
additional lagged variables. We will save this equation in the workfile for later use. Press
the Name button in the toolbar and name the equation EQLAGS.
One common method of accounting for serial correlation is to include autoregressive (AR)
and/or moving average (MA) terms in the equation. To estimate the model with an AR(1)
Forecasting from an Estimated Equation—27
error specification, you should make a copy of the EQLAGS equation by clicking Object/
Copy Object… in the EQLAGS window. EViews will create a new untitled equation contain-
ing all of the information from the previous equation. Press Estimate on the toolbar of the
copy and modify the specification to read
log(m1) c log(gdp) rs dlog(pr) ar(1)
This specification removes the lagged terms, replacing them with an AR(1) specification:
log ( M1 t ) = b1 + b 2 log ( GDPt ) + b 3 RS t + b4 Dlog ( PR t ) + u t
(2.2)
u t = ru t – 1 + e t
Click OK to accept the new specification. EViews will estimate the equation and will report
the estimation results, including the estimated first-order autoregressive coefficient of the
error term:
Depend ent Variable: LOG( M1)
Method: Least Squares
Date: 08/18/09 Ti me: 14:12
Sample (adjusted): 1952Q3 1992Q4
Included observations: 162 after adjustments
Convergence achieved afte r 32 iterations
The fit of the AR(1) model is roughly comparable to the lag model, but its somewhat higher
values for both the Akaike and the Schwarz information criteria indicate that the previous
lag model may be preferred. Accordingly, we will work with the lag model in EQLAGS for
the remainder of the demonstration.
Click on the Forecast button in the EQLAGS equation toolbar to open the forecast dialog:
We set the forecast sample to 1993Q1–1996Q4 and provide names for both the forecasts and
forecast standard errors so both will be saved as series in the workfile. The forecasted val-
ues will be saved in M1_F and the forecast standard errors will be saved in M1_SE.
Note also that we have elected to forecast the log of M1, not the level, and that we request
both graphical and forecast evaluation output. The Dynamic option constructs the forecast
for the sample period using only information available at the beginning of 1993Q1. When
you click OK, EViews displays both a graph of the forecasts, and statistics evaluating the
quality of the fit to the actual data:
Alternately, we may also choose to examine forecasts of the level of M1. Click on the Fore-
cast button in the EQLAGS toolbar to open the forecast dialog, and select M1 under the
Forecasting from an Estimated Equation—29
Series to forecast option. Enter a new name to hold the forecasts, say M1LEVEL_F, and
click OK. EViews will present a graph of the forecast of the level of M1, along with the
asymmetric confidence intervals for this forecast:
The series that the forecast procedure generates are ordinary EViews series that you may
work with in the usual ways. For example, we may use the forecasted series for LOG(M1)
and the standard errors of the forecast to plot actuals against forecasted values with
(approximate) 95% confidence intervals for the forecasts.
We will first create a new group object containing these values. Select Quick/Show... from
the main menu, and enter the expressions:
m1_f+2*m1_se m1_f-2*m1_se log(m1)
to create a group containing the confidence intervals for the forecast of LOG(M1) and the
actual values of LOG(M1):
30—Chapter 2. A Demonstration
There are three expressions in the dialog. The first two represent the upper and lower
bounds of the (approximate) 95% forecast interval as computed by evaluating the values of
the point forecasts plus and minus two times the standard errors. The last expression repre-
sents the actual values of the dependent variable.
When you click OK, EViews opens an untitled group window containing a spreadsheet view
of the data. Before plotting the data, we will change the sample of observations so that we
only plot data for the forecast sample. Select Quick/Sample… or click on the Sample but-
ton in the group toolbar, and change the sample to include only the forecast period:
To plot the data for the forecast period, select View/Graph... from the group window and
choose Line & Symbol from the list on the left of the Graph Options dialog:
The actual values of log(M1) are within the forecast interval for most of the forecast period,
but fall below the lower bound of the 95% confidence interval beginning in 1996:1.
For an alternate view of these data, you can select View/Graph... and Error Bar from the
list in the dialog, which displays the graph as follows:
Additional Testing—31
Additional Testing
Note that the above specification has
been selected for illustration purposes
only. Indeed, performing various
specification tests on EQLAGS sug-
gests that there may be a number of
problems with the existing specifica-
tion.
For one, there is quite a bit of serial correlation remaining even after estimating the lag spec-
ification. A test of serial correlation in the EQLAGS equation (by selecting View/Residual
Diagnostics/Serial Correlation LM Test…, and entering “1” for the number of lags) rejects
the null hypothesis of no serial correlation in the reformulated equation. The top portion of
the output is:
In addition to serial correlation and ARCH, there is an even more fundamental problem with
the above specification since, as the graphs attest, LOG(M1) exhibits a pronounced upward
trend, suggesting that we should perform a unit root in this series. The presence of a unit
root will indicate the need for further analysis.
We once again display the LOG(M1) series window by clicking on Window and selecting
the LOG(M1) series window from the menu. If the series window for LOG(M1) is not
32—Chapter 2. A Demonstration
present (if you previously closed the window), you may again open a new window by
selecting Quick/Show…, entering “log(m1)”, and clicking OK.
Before computing the test statistic, we will reset the workfile sample to all of the observa-
tions by clicking on Quick/Sample... and entering “@all” in the dialog.
Next, to perform an Augmented Dickey-Fuller (ADF) test for nonstationarity of this series,
select View/Unit Root Test… and click on OK to accept the default options. EViews will
perform an ADF test and display the test results. The top portion of the output reads:
t-Statistic Prob.*
EViews performs the ADF test statistic with the number of lagged difference terms in the test
equation (here, four) determined by automatic selection. The ADF test statistic value has a
probability value of 0.9911, providing little evidence that we may reject the null hypothesis
of a unit root.
If a unit root were present in our data, we may wish to adopt more sophisticated statistical
models. These techniques are discussed in Chapter 21. “Time Series Regression”,
Chapter 25. “Cointegrating Regression”, and Chapter 32. “Vector Autoregression and Error
Correction Models” (all in User’s Guide II) which deal with basic time series, cointegrating
regression models, and vector error correction specifications, respectively).
Chapter 3. Workfile Basics
Managing the variety of tasks associated with your work can be a complex and time-
consuming process. Fortunately, EViews’ innovative design takes much of the effort
out of organizing your work, allowing you to concentrate on the substance of your
project. EViews provides sophisticated features that allow you to work with various
types of data in an intuitive and convenient fashion.
Before describing these features, we begin by outlining the basic concepts underlying
the EViews approach to working with datasets using workfiles, and describing simple
methods to get you started on creating and working with workfiles in EViews.
What is a Workfile?
At a basic level, a workfile is simply a container for EViews objects (see Chapter 4.
“Object Basics,” on page 67). Most of your work in EViews will involve objects that
are contained in a workfile, so your first step in any project will be to create a new
workfile or to load an existing workfile into memory.
Every workfile contains one or more workfile pages, each with its own objects. A
workfile page may be thought of as a subworkfile or subdirectory that allows you to
organize the data within the workfile.
For most purposes, you may treat a workfile page as though it were a workfile (just as
a subdirectory is also a directory) since there is often no practical distinction between
the two. Indeed, in the most common setting where a workfile contains only a single
page, the two are completely synonymous. Where there is no possibility of confusion,
we will use the terms “workfile” and “workfile page” interchangeably.
Key to the notion of a dataset is the idea that each observation in the dataset has a
unique identifier, or ID. Identifiers usually contain important information about the
observation, such as a date, a name, or perhaps an identifying code. For example,
annual time series data typically use year identifiers (“1990”, “1991”, ...), while cross-
34—Chapter 3. Workfile Basics
sectional state data generally use state names or abbreviations (“AL”, “AK”, ..., “WY”).
More complicated identifiers are associated with longitudinal data, where one typically uses
both an individual ID and a date ID to identify each observation.
Observation IDs are often, but not always, included as a part of the dataset. Annual
datasets, for example, usually include a variable containing the year associated with each
observation. Similarly, large cross-sectional survey data typically include an interview num-
ber used to identify individuals.
In other cases, observation IDs are not provided in the dataset, but external information is
available. You may know, for example, that the 21 otherwise unidentified observations in a
dataset are for consecutive years beginning in 1990 and continuing to 2010.
In the rare case were there is no additional identifying information, one may simply use a
set of default integer identifiers that enumerate the observations in the dataset (“1”, “2”,
“3”, ...).
Since the primary purpose of every workfile page is to hold the contents of a single dataset,
each page must contain information about observation identifiers. Once identifier informa-
tion is provided, the workfile page provides context for working with observations in the
associated dataset, allowing you to use dates, handle lags, or work with longitudinal data
structures.
Creating a Workfile
There are several ways to create and set up a new workfile. The first task you will face in
setting up a workfile (or workfile page) is to specify the structure of your workfile. We focus
here on three distinct approaches:
First, you may simply describe the structure of your workfile (“Creating a Workfile by
Describing its Structure” on page 35). EViews will create a new workfile for you to enter or
import your data).
Describing the workfile is the simplest method, requiring only that you answer a few simple
questions—it works best when the identifiers follow a simple pattern that is easily described
(for example, “annual data from 1950 to 2000” or “quarterly data from 1970Q1 to 2002Q4”).
This approach must be employed if you plan to enter data into EViews by typing or copy-
and-pasting data.
In the second approach, you simply open and read data from a foreign data source (“Creat-
ing a Workfile by Reading from a Foreign Data Source” on page 39). EViews will analyze
the data source, create a workfile, and then automatically import your data.
The final approach, which should be reserved for more complex settings, involves two dis-
tinct steps. In the first, you create a new workfile using one of the first two approaches (by
Creating a Workfile—35
describing the structure of the workfile, or by opening and reading from a foreign data
source). Next, you will structure the workfile, by instructing EViews to construct unique
identifiers, in some cases using values of variables contained in the dataset.
We begin by describing the first two methods. The third approach, involving the more com-
plicated task of structuring a workfile, will be taken up in “Structuring a Workfile” on
page 213.
To create a new workfile, select File/New/Workfile... from the main menu to open the
Workfile Create dialog.
On the left side of the dialog is a combo box for describing the underlying structure of your
dataset. You will choose between the Dated - regular frequency, the Unstructured, and
the Balanced Panel settings. Generally speaking, you should use Dated - regular frequency
if you have a simple time series dataset, for a simple panel dataset you should use Balanced
Panel, and in all other cases, you should select Unstructured. Additional detail to aid you
in making a selection is provided in the description of each category.
EViews also prompts you to enter a Start date and End date for your workfile. For Daily -
custom week or Intraday, you will also need to enter Day and/or Time information as
described below. When you click on OK, EViews will create a regular frequency workfile
with the specified number of observations and the associated identifiers.
Suppose, for example, that you wish to create a quarterly workfile that begins with the first
quarter of 1970 and ends in the last quarter of 2020.
• First, select Dated - regular frequency for the workfile structure, and then choose the
Quarterly frequency.
• Next, enter the Start date and End date. There are a number of ways to fill in the
dates. EViews will use the largest set of observations consistent with those dates, so if
you enter “1970” and “2020”, your quarterly workfile will begin in the first quarter of
1970, and end in the last quarter of 2020. Entering the date pair “Mar 1970” and “Nov
2020”, or the start-end pair “3/2/1970” and “11/15/2020” would have generated a
workfile with the same structure, since the implicit start and end quarters are the
same in all three cases.
This latter example illustrates a fundamental principle regarding the use of date information
in EViews. Once you specify a date frequency for a workfile, EViews will use all available
calendar information when interpreting date information. For example, given a quarterly
frequency workfile, EViews knows that the date “3/2/1990” is in the first quarter of 1990
(see “Dates” on page 82 of the Command and Programming Reference for details).
Creating a Workfile—37
Note that the workfile created will have ten observations per day, the first at 8 a.m. and the
last at 5 p.m. Though you may have intended to create a workfile to record nine hours of
data, specifying an end time of 17:00:00 defines the period from 5 p.m. to 6 p.m., adding an
extra hour to the day specification. This may be desirable for recording discrete measure-
ments on the hour from 8 a.m. to 5 p.m., but if you wish to measure the hours as intervals
(from 8 a.m. to 9 a.m., 9 a.m. to 10 a.m., ..., and 4 p.m. to 5 p.m.), with one observation for
each interval, you should specify an end time of 16:00:00, or 4 p.m. An end time of 16:00:00
defines the last interval as 4 p.m. to 5 p.m (see “Specifying Start and End Times,” on
page 225 for a thorough discussion of how start and end times are defined).
Lastly, you may optionally provide a name to be given to your workfile and a name to be
given to the workfile page.
38—Chapter 3. Workfile Basics
After creating a workfile, you can see EViews’ interpretation of your workfile specification
by looking at the Workfile structure dialog. Select Proc/Structure/Resize Current Page...
or click on the Range area at the top of the new workfile to bring up the Workfile structure
dialog (see “Applying a Structure to a Workfile,” on page 223 for detailed discussion of
structuring a workfile and the settings in this dialog).
For the previous example, you may take note of two things in the dialog. First, the Start
date is displayed as “1/03/2005 08:00”, which corresponds to 8 a.m. this is the first Monday
in 2005. Similarly, the End date is “12/30/2005 17:00”, the last Friday in 2005. Second,
notice that the time in the End date field is different from the time displayed in the Time
end field. This illustrates that because the End date is specified in hours, an end time of
17:00 defines the period from 5 p.m. to 6 p.m. Alternately, the Time field denotes the last
second that is part of the specification, 17:59:59.
In many cases, the integer identifiers will be sufficient for you to work with your data. In
more complicated settings, you may wish to further refine your identifiers. We describe this
process in “Applying a Structure to a Workfile” on page 223.
This entry may be used when you wish to create a balanced structure in which every cross-
section follows the same regular frequency with the same date observations. Only the barest
outlines of the procedure are provided here since a proper discussion requires a full descrip-
tion of panel data and the creation of the advanced workfile structures. Panel data and
structured workfiles are discussed at length in “Structuring a Workfile” on page 213.
Unbalanced panel workfiles or workfiles involving more complex panel structures should be
created by first defining an unstructured workfile, and then applying a panel workfile struc-
ture.
One way to read foreign data into a new workfile is to copy the foreign data source to the
Windows clipboard, right click on the gray area in your EViews window, and select Paste as
new Workfile. EViews will automatically create a new workfile containing the contents of
the clipboard. Such an approach, while convenient, is only practical for small amounts of
data.
Alternately, you may open a foreign data source as an EViews workfile. There are two ways
to proceed. First, you may select File/Open/Foreign Data as Workfile..., to bring up the
standard file Open dialog. Clicking on the Files of type combo box brings up a list of the file
types that EViews currently supports for opening a workfile. Select a file type to narrow the
list of files in the dialog, then choose the file you wish to open.
40—Chapter 3. Workfile Basics
EViews offers drag-and-drop support for the file open operation. Simply select the file you
wish to open in Windows, then drag-and-drop the file on the gray area in your EViews win-
dow.
Whichever your approach, EViews will open the specified foreign data as an EViews work-
file.
If you select a time series database file (e.g., Aremos TSD, GiveWin/Pc-Give, Rats 4.x, Rats
Portable, TSP Portable), EViews will create a new, regular frequency workfile containing the
contents of the entire file. If there are mixed frequencies in the database, EViews will select
the lowest frequency, and convert all of the series to that frequency using the default con-
version settings (we emphasize here that all of these database formats may also be opened
as databases by selecting File/Open/Database... and filling out the dialogs, allowing for
additional control over the series to be read, the new workfile frequency, and any frequency
conversion).
If you choose one of the remaining source types, EViews will create a new unstructured
workfile. First, EViews will open a series of dialogs prompting you to describe and select
data to be read. The data will be read into the new workfile, which will be resized to fit. If
possible, EViews will attempt to structure the workfile using information in the file. If this is
not possible but you still wish to apply a specific workfile structure with these data, you will
have to define a structured workfile using the advanced workfile structure tools (see “Struc-
turing a Workfile” on page 213).
The import as workfile interface is available for Microsoft Access files, Gauss Dataset files,
ODBC Dsn files, ODBC Query files, SAS Transport files, native SPSS files (using the SPSS
Input/output .DLL that should be installed on your system), SPSS Portable files, Stata files,
Excel files, raw ASCII or binary files, or ODBC Databases and queries (using an ODBC driver
already present on your system).
An Illustration
Perhaps the most common form of foreign data files are Excel files, followed by text files
(ASCII). We offer examples of reading Excel, ASCII, and Stata files to illustrate the basic pro-
cess of creating a new workfile (or a workfile page) by opening a foreign source file.
Creating a Workfile—41
Alternately, you
may specify the for-
eign file using the
File/Open/Foreign
Data as Workfile...
dialog, first navi-
gate to the appropri-
ate directory and
select the Files of
type entry to match
the file you wish to
open. In this exam-
ple, we see the if we
select Stata files
(*.dta) the dialog
displays a list of
Stata files that may
be opened.
Double-click on the
name to select and
open the file, or
enter the filename in
the dialog and click
on Open to accept
the selection. Note
that the Open dialog
displayed here is the
one for the Win-
dows XP operating system. The dialog may look different in other versions of Windows.
Creating a Workfile—43
If you are happy with the way the previewed data looks, you can click Finish, and EViews
will open up a new workfile containing the Excel data. For further adjustments to the data
import, you can click Next rather than Finish and open up Step 2 of the Spreadsheet Read
dialog.
44—Chapter 3. Workfile Basics
If the data in your Excel file has special coding for missing values, you can set the Text rep-
resenting NA box to whatever value your data uses.
EViews will fill out the Column info box automatically, based upon your choices in the Col-
umn headers box, and by analyzing the data in your file. If you would like to change the
name, description or data type (Character, Number or Date) of a specific column, select
that column in the preview box at the bottom of the dialog, and then change the informa-
tion.
Once you are happy with the way the data looks in the preview window you can click Fin-
ish to bring the data into a new EViews workfile.
Creating a Workfile—45
If your text file has lines of text at the start of the file that come before the actual columns of
data (such as text explaining what the data is, or where it came from), you should can tell
EViews to skip these lines as part of the data read in the Start of data/header box.
Most text files containing data will have a row of text for each observation, and EViews, by
default, will read in the data assuming this is the case. For more complicated structures, you
should press the Show row options button, which will then display a set of options that
allow you to specify how each row of your file is formatted.
The Column specification box lets you specify how each column of data is separated from
each other. The most common method of separating columns in a text file is through the use
of a delimiter character, such as a comma or space or a tab, between each column. A second
form of separation is through fixed width columns - each column has the same number of
characters in it for every row. If your data has a fixed width, you should select Fixed width
fields. If your text file uses neither delimiters nor fixed widths, you should select An
explicit format (to be provided).
46—Chapter 3. Workfile Basics
If you chose Fixed width fields as your column separator, Step 2 will let you specify the
width of each column. If you chose An explicit format, Step 2 lets you specify the format
string.
Step 3 of the ASCII Read dialog is exactly the same as Step 2 of the Spreadsheet Read dia-
log, explained above, and lets you set information regarding the data columns of your file.
Creating a Workfile—47
When the dialog first opens, all variables are selected for reading. You can change the cur-
rent state of any variable by checking or unchecking the corresponding checkbox. The num-
ber of variables selected is displayed at the bottom right of the list.
There may be times when checking and unchecking individual variables is inconvenient
(e.g., when there are thousands of variable names). The bottom portion of the dialog pro-
vides you with a control that allows you to select or unselect variables by name. Simply
enter the names of variables using wildcard characters if desired, choose the types of inter-
est, and click on the appropriate button.
For example, entering “A* B?” in the selection edit box, selecting only the Numeric check-
box, and clicking on Unselect will uncheck all numeric series beginning with the letter “A”
and all numeric series with two character names beginning in “B”. To select only series
beginning with the letter “A”, enter “*” and click on Unselect, then enter “A*” and click on
Select.
48—Chapter 3. Workfile Basics
In the title bar of the workfile window you will see the “Workfile” designation followed by
the workfile name. If the workfile has been saved to disk, you will see the name and the full
disk path. Here, the name of the workfile is “TESTFILE”, and it is located in the
“C:\EVIEWS\DATA” directory on disk. If the workfile has not been saved, it will be desig-
nated “UNTITLED”.
Just below the titlebar is a button bar that provides you with easy access to useful workfile
operations. Note that the buttons are simply shortcuts to items that may be accessed from
the main EViews menu. For example, the clicking on the Fetch button is equivalent to
selecting Object/Fetch from DB... from the main menu.
Below the toolbar are two lines of status information where EViews displays the range (and
optionally, the structure) of the workfile, the current sample of the workfile (the range of
observations that are to be used in calculations and statistical operations), and the display
filter (rule used in choosing a subset of objects to display in the workfile window). You may
change the range, sample, and filter by double clicking on these labels and entering the rel-
evant information in the dialog boxes.
Lastly, in the main portion of the window, you will see the contents of your workfile page in
the workfile directory. In normal display mode, all named objects are listed in the directory,
sorted by name, with an icon showing the object type. The different types of objects and
their icons are described in detail in “Object Types” on page 69. You may also show a sub-
set of the objects in your workfile page, as described below.
It is worth keeping in mind that the workfile window is a specific example of an object win-
dow. Object windows are discussed in “The Object Window” on page 73.
The Workfile Window—51
You can change the default workfile display to show additional information about your
objects. If you select View/Details+/–, or click on the Details +/- button on the toolbar,
EViews will toggle between the standard workfile display format, and a display which pro-
vides additional information about the date the object was created or updated, as well as the
label information that you may have attached to the object.
EViews will display only objects of the specified types whose names match those in the edit
field list.
The default string is “*”, which will display all objects of the specified types. However, if
you enter the string:
x*
only objects with names beginning with X will be displayed in the workfile window. Enter-
ing:
x?y
displays all objects that begin with the letter X, followed by any single character and then
ending with the letter Y. If you enter:
x* y* *z
all objects with names beginning with X or Y and all objects with names ending in Z will be
displayed. Similarly, the more complicated expression:
??y* *z*
tells EViews to display all objects that begin with any two characters followed by a Y and
any or no characters, and all objects that contain the letter Z. Wildcards may also be used in
more general settings—a complete description of the use of wildcards in EViews is provided
in Appendix A. “Wildcards,” on page 543 of the Command and Programming Reference.
When you specify a display filter, the Filter description in the workfile window changes to
reflect your request. EViews always displays the current string used in matching names.
Additionally, if you have chosen to display a subset of EViews object types, a “–” will be
displayed in the Display Filter description at the top of the workfile window.
Saving a Workfile—53
Saving a Workfile
You should name and save your workfile for future use. Push the Save button on the work-
file toolbar to save a copy of the workfile on disk. You can also save a file using the File/
Save As… or File/Save… choices from the main menu. EViews will display the Windows
common file dialog.
54—Chapter 3. Workfile Basics
You can specify the target directory in the upper file menu labeled Save in. You can navi-
gate between directories in the standard Windows fashion—click once on the down arrow
to access a directory tree; double clicking on a directory name in the display area gives you
a list of all the files and subdirectories in that directory. Once you have worked your way to
the right directory, type the name you want to give the workfile in the File name field and
push the Save button.
Alternatively, you could just type the full Windows path information and name in the File
name edit field.
In most cases, you will save your data as an EViews workfile. By default, EViews will save
your data in this format, using the specified name and the extension “.WF1”. You may, of
course, choose to save the data in your workfile in a foreign data format by selecting a dif-
ferent format in the combo box. We explore the subject of saving foreign formats below in
“Exporting from a Workfile” on page 265.
When you overwrite a workfile on disk, EViews will usually keep a backup copy of the
overwritten file. The backup copy will have the same name as the file, but with the first
Saving a Workfile—55
character in the extension changed to ~. For example, if you have a workfile named
“Mydata.WF1”, the backup file will be named “Mydata.~f1”. The existence of these
backup files will prove useful if you accidentally overwrite or delete the current version of
the workfile file, or if the current version becomes damaged.
If you wish to turn on or off the creation of these backup copies you should set the desired
global options by selecting Options/Workfile Storage Defaults..., and selecting the desired
settings.
You may also choose to save your data in compressed or non-compressed form. If you select
Use compression, EViews will analyze the contents of your series, choose an optimal (loss-
less) storage precision for each series, and will apply compression algorithms, all to reduce
the size of the workfile on disk. The storage savings may be considerable, especially for
large datasets containing lots of integer and 0, 1 variables. We caution however, that a com-
pressed workfile is not backward compatible, and will not be readable by versions prior to
EViews 5.
There is also a checkbox for showing the options dialog on each save operation. By default,
the dialog will be displayed every time you save a workfile. Unchecking the Prompt on
each Save option instructs EViews to hide this dialog on subsequent saves. If you later wish
to change the save settings or wish to display the dialog on saves, you must update your
global settings by selecting Options/General Options... from the main EViews menu and
going to the Data storage/Workfile save portion of the dialog.
Note that, with the exception of compressed workfiles, workfiles saved in EViews 7 may be
read by previous versions of EViews. Objects such as valmaps or alpha series that are not
supported by early versions will, however, be dropped when read by those versions of
EViews. You should take great caution when saving workfiles using older versions of
EViews as you will lose any deleted objects (see “Workfile Compatibility” in Getting
Started).
56—Chapter 3. Workfile Basics
Note also that only the first page of a multi-page workfile will be read by versions prior to
EViews 5; all other pages will be dropped. You may save individual pages of a multi-page
workfile to separate workfiles so that they may be read by versions that do not support mul-
tiple pages; see “Saving a Workfile Page” on page 65.
Loading a Workfile
You can use File/Open/EViews Workfile… to load into memory a previously saved work-
file. You may also drag-and-drop the workfile onto your EViews workspace. You will typi-
cally save a workfile containing all of your data and results at the end of the day, and later
load the workfile to pick up where you left off.
When you select File/Open/EViews Workfile… you will see a standard Windows file dia-
log. Simply navigate to the appropriate directory and double click on the name of the work-
file to load it into RAM. The workfile window will open and all of the objects in the workfile
will immediately be available.
For convenience, EViews keeps a record of the most recently used files at the bottom of the
File menu. Select an entry and it will be opened in EViews.
The current version of EViews can read workfiles from all previous versions of EViews. Due
to changes in the program, however, some objects may be modified when they are read into
the current version.
Multi-page Workfiles
While a great many of your workfiles will probably contain a single page, you may find it
useful to organize your data into multiple workfile pages. Multi-page workfiles are primarily
designed for situations in which you must work with multiple datasets.
For example, you may have both quarterly and monthly data that you wish to analyze. The
multi-page workfile allows you to hold both sets of data in their native frequency, and to
perform automatic frequency conversion as necessary. Organizing your data in this fashion
allows you to switch instantly between performing your analysis at the monthly and the
quarterly level.
Likewise, you may have a panel dataset on individuals that you wish to use along with a
cross-sectional dataset on state level variables. By creating a workfile with a separate page
for the individual level data, and a separate page for the state level data, you can move back
and forth between the individual and the state level analyses, or you can link data between
the two to perform dynamic match merging.
Multi-page Workfiles—57
EViews will create a new workfile page with the specified structure and the new page will
be given a default name and designated as the active workfile page. The default name will
be constructed from the next available name for the given workfile structure. For example,
if you create a regular frequency annual page, EViews will attempt to name the page
ANNUAL, ANNUAL1, and so forth. The active page is noted visually by the tab selection at
the bottom of the workfile window. With the exception of a few page-specific operations,
you may generally treat the active page as if it were a standard workfile.
As you change the selected method, the dialog will change to provide you with different
options for specifying identifiers.
EViews will take the set of series and will identify the unique values in the specified Sam-
ple. Note that when multiple identifiers are specified, the unique values are defined over the
values in the set of ID series, not over each individual series.
The new page will contain identifier series containing the unique values, and EViews will
structure the workfile using this information. If Date ID series were provided in the original
dialog, EViews will restructure the result as a dated workfile page.
EViews will create a new structured (undated - with identifier series) workfile page
UNDATED1 containing 157 observations. The new page will contain a series FCODE with
the 157 unique values found in the original series FCODE, and the workfile will be struc-
tured using this series.
If you select Union of common ID series from multiple pages, EViews will find, for each
source page, a set of unique ID values, and will create the new workfile page using the
union of these values. Simply enter the list of identifiers in the Cross-section ID series and
Date series and edit fields, and a list of pages in which the common identifiers may be
found. When you click on OK, EViews will first make certain that each of the identifier
series is found in each page, then will create the new workfile page using the union of the
observed ID values.
We may extend our earlier example where there are three distinct values for YEAR in the
original page (“1987,” “1988,” “1989”). To make things more interesting, suppose there is a
second page in the workfile, ANNUAL, containing annual data for the years 1985–1988 and
that this page contains also contains a series YEAR with those values (“1985,” “1986,”
“1987,” “1988”).
60—Chapter 3. Workfile Basics
Since we want to exploit the fact that YEAR contains date information, we create a page
using the union of IDs by selecting Union of common ID series from multiple pages, enter-
ing YEAR in the Date series field, and then entering “UNDATED” and “ANNUAL” in the
page field. When you click on OK, EViews will create a 5 observation, regular annual fre-
quency workfile page for 1987–1989, formed by taking the union of the unique values in the
YEAR series in the UNDATED panel page, and the YEAR series in the ANNUAL page.
Suppose for example, that you wish to create a page by crossing the 187 unique FCODE val-
ues in the UNDATED page with the 4 unique YEAR values in the ANNUAL page (“1985,”
Multi-page Workfiles—61
“1986,” “1987,” “1988”). Since the YEAR values may be used to create a dated panel, we
select Cross of one date and one non-date ID from our Method combo.
It is worth noting that had we had entered the same information in the Cross of two non-
date ID dialog, the result would be an undated panel with two identifier series.
In cases where the page is not available, but where we wish to cross our non-date ID series
with a regular frequency range, we may skip the intermediate page creation by selecting the
Cross of ID series with a date range method.
62—Chapter 3. Workfile Basics
Alternately, you may simply drag-and-drop a group of selected series from the current work-
file page onto the New Page tab on the bottom of the workfile window.
Multi-page Workfiles—63
If you select an existing EViews workfile, EViews will add a page corresponding to each
page in the source workfile. If you load a workfile with a single page named QUARTERLY,
EViews will attempt to load the entire workfile in the new page. If your workfile contains
multiple pages, each page of the workfile will be loaded into a new and separate page. The
active page will be the newest page.
If you select a foreign data source as described in “Creating a Workfile by Reading from a
Foreign Data Source” on page 39, EViews will load the data into a single newly created page
in the workfile. This method is exactly the same as that used when creating a new workfile
except that the results are placed in a new workfile page.
64—Chapter 3. Workfile Basics
Simply copy the data you wish to use in creating your page, then click on New Page and
select Paste from Clipboard as Page. EViews will first analyze the contents of the clip-
board. EViews then creates a page to hold the data and then will read the data into series in
the page.
Note that while EViews can correctly analyze a wide range of data representations, the
results may not be as expected in more complex settings.
You should note that it is possible to hide existing page tabs. If a page appears to be miss-
ing, for example if New Page is the only visible tab, the remaining tabs are probably hidden.
You should click on the left arrow located in the bottom right of the workfile window until
your page tabs are visible.
Alternatively, you may select Proc/Rename Current Page... from the main workfile menu
to call up the dialog.
Workfile page names must satisfy the same naming restrictions as EViews objects. Notably,
the page names must not contain spaces or other delimiters.
Saving a page as an individual workfile is quite useful when you wish to load a single page
into several workfiles, or if you wish to use the page in a previous version of EViews. Once
saved on disk, it is the same as any other single-page EViews workfile.
You can change the default directory by using the File/Open… or the File/Save As… menu
items, navigating to the new directory, and checking the Update Default Directory box in
the dialog. If you then open or save a workfile, the default directory will change to the one
you have selected. The default directory may also be set from the Options/File locations...
dialog. See “File Locations” on page 633 of User’s Guide I.
66—Chapter 3. Workfile Basics
An alternative method for changing the default EViews directory is to use the cd command.
Simply enter “CD” followed by the directory name in the command window (see cd for
details).
File Operations
Since EViews uses a variant of the Windows common file dialog for all open and save oper-
ations, you may use the dialog to perform routine file operations such as renaming, copying,
moving, and deleting files.
For example, to delete a file, click once of the file name to select the file, then right click
once to call up the menu, and select Delete. Likewise, you may select a file, right-mouse
click, and perform various file operations such as Copy or Rename.
Chapter 4. Object Basics
At the heart of the EViews design is the concept of an object. In brief, objects are collections
of related information and operations that are bundled together into an easy-to-use unit. Vir-
tually all of your work in EViews will involve using and manipulating various objects.
EViews holds all of its objects in object containers. You can think of object containers as fil-
ing cabinets or organizers for the various objects with which you are working. The most
important object container in EViews is the workfile, which is described in Chapter 3.
“Workfile Basics,” beginning on page 33.
The remainder of this chapter describes basic techniques for working with objects in a
workfile. While you may at first find the idea of objects to be a bit foreign, the basic con-
cepts are easy to master and will form the foundation for your work in EViews. But don’t
feel that you have to understand all of the concepts the first time through. If you wish, you
can begin working with EViews immediately, developing an intuitive understanding of
objects and workfiles as you go.
Subsequent chapters will provide a more detailed description of working with the various
types of objects and other types of object containers.
Note that the current discussion focuses on interactive methods for working with objects. If
you feel more comfortable using commands, Chapter 1. “Object and Command Basics,”
beginning on page 3 of the Command and Programming Reference, offers command equiva-
lents for the operations described in this chapter.
What is an Object?
Information in EViews is stored in objects. Each object consists of a collection of information
related to a particular area of analysis. For example, a series object is a collection of informa-
tion related to a set of observations on a particular variable. An equation object is a collec-
tion of information related to the relationship between a collection of variables.
Note that an object need not contain only one type of information. For example, an esti-
mated equation object contains not only the coefficients obtained from estimation of the
equation, but also a description of the specification, the variance-covariance matrix of the
coefficient estimates, and a variety of statistics associated with the estimates.
Associated with each type of object is a set of views and procedures which can be used with
the information contained in the object. This association of views and procedures with the
type of data contained in the object is what we term the object oriented design of EViews.
The object oriented design simplifies your work in EViews by organizing information as you
work. For example, since an equation object contains all of the information relevant to an
68—Chapter 4. Object Basics
estimated relationship, you can move freely between a variety of equation specifications
simply by working with different equation objects. You can examine results, perform
hypothesis and specification tests, or generate forecasts at any time. Managing your work is
simplified since only a single object is used to work with an entire collection of data and
results.
This brief discussion provides only the barest introduction to the use of objects. The remain-
der of this section will provide a more general description of EViews objects. Subsequent
chapters will discuss series, equations, and other object types in considerable detail.
Object Data
Each object contains various types of information. For example, series, matrix, vector, and
scalar objects, all contain mostly numeric information. In contrast, equations and systems
contain complete information about the specification of the equation or system, and the esti-
mation results, as well as references to the underlying data used to construct the estimates.
Graphs and tables contain numeric, text, and formatting information.
Since objects contain various kinds of data, you will want to work with different objects in
different ways. For example, you might wish to compute summary statistics for the observa-
tions in a series, or you may want to perform forecasts based upon the results of an equa-
tion. EViews understands these differences and provides you with custom tools, called
views and procedures, for working with an object’s data.
Object Views
There is more than one way to examine the data in an object. Views are tabular and graphi-
cal windows that provide various ways of looking at the data in an object.
For example, a series object has a spreadsheet view, which shows the raw data, a line graph
view, a bar graph view, a histogram-and-statistics view, and a correlogram view. Other
views of a series include distributional plots, QQ-plots, and kernel density plots. Series
views also allow you to compute simple hypothesis tests and statistics for various sub-
groups of your sample.
An equation object has a representation view showing the equation specification, an output
view containing estimation results, an actual-fitted-residual view containing plots of fitted
values and residuals, a covariance view containing the estimated coefficient covariance
matrix, and various views for specification and parameter tests.
Views of an object are displayed in the object’s window. Only one window can be opened
for each object and each window displays only a single view of the object at a time. You can
change views of an object using the View menu located in the object window’s toolbar or
the EViews main menu.
What is an Object?—69
Perhaps the most important thing to remember about views is that views normally do not
change data outside the object. Indeed, in most cases, changing views only changes the dis-
play format for the data, and not the data in the object itself.
Object Procedures
Most EViews objects also have procedures, or procs. Like views, procedures often display
tables or graphs in the object’s window. Unlike views, however, procedures alter data,
either in the object itself or in another object.
Many procedures create new objects. For example, a series object contains procedures for
smoothing or seasonally adjusting time series data and creating a new series containing the
smoothed or adjusted data. Equation objects contain procedures for generating new series
containing the residuals, fitted values, or forecasts from the estimated equation.
You select procedures from the Proc menu on the object’s toolbar or from the EViews main
menu.
Object Types
The most common objects in EViews are series and equation objects. There are, however, a
number of different types of objects, each of which serves a unique function. Most objects
are represented by a unique icon which is displayed in the object container (workfile or
database) window. The basic object icons are given by:
Despite the fact that they are also objects, object containers do not have icons since they
cannot be placed in other object containers—thus, workfiles and databases do not have
icons since they cannot be placed in other workfiles or databases.
Note also that there are special icons that correspond to special versions of the objects:
Auto-updating Series
Undefined Link
If you set a series object to be auto-updating (see “Auto-Updating Series” on page 155),
EViews will use the special icon to indicate that the series depends upon a formula. In con-
trast, an auto-updating alpha series (which we imagine to be less common) uses the original
alpha icon, with an orange color to indicate the presence of a formula.
When group data are stored in databases, you will be given the option of storing the group
definition (list of series names) alone, or both the group definition and the series contained
in the group (see “Store, Fetch, and Copy of Group Objects” on page 277). If the latter are
stored, the standard group icon will be modified, with the “+” indicating the additional
presence of the series data.
Lastly, a link object (see “Series Links” on page 183), is always in one of three states,
depending upon the definition contained in the link. If the link is to a numeric source series,
the link object is displayed using a series icon, since it may be used as though it were an
ordinary series, with a distinctive pink color used to indicate that the object depends on
linked data. If the link is to an alpha source series, the link will show up as an alpha series
icon, again in pink. If, however, the link object is unable to locate the source series, EViews
will display the “?” icon indicating that the series type is unknown.
Basic Object Operations—71
For example, if you select Equation, you will see a dialog box prompting you for additional
information. Alternatively, if you click on Series and then select OK, you will see an object
window (series window) displaying the spreadsheet view of an UNTITLED series.
Selecting Objects
Creating a new object will
not always be necessary.
Instead, you may want to
work with an existing object. One of the fundamental operations in EViews is selecting one
or more objects from the workfile directory.
The easiest way to select objects is to point-and-click, using the standard Windows conven-
tions for selecting contiguous or multiple items if necessary. Keep in mind that if you are
72—Chapter 4. Object Basics
selecting a large number of items, you may find it useful to use the display filter before
beginning to select items.
In addition, the View button in the workfile toolbar provides convenient selection shortcuts:
• Select All selects all of the objects in the workfile with the exception of the C coeffi-
cient vector and the RESID series.
• Deselect All eliminates any existing selections.
Opening Objects
Once you have selected your object or objects, you will want to open your selection, or cre-
ate a new object containing the selected objects. You can do so by double clicking anywhere
in the highlighted area.
If you double click on a single selected object, you will open an object window.
If you select multiple graphs or series and double click, a pop-up menu appears, giving you
the option of creating and opening new objects (group, equation, VAR, graph) or displaying
each of the selected objects in its own window.
(You may also select View/Open Selected or right-mouse click and select Open to access
menus for opening the multiple objects.)
Note that if you select multiple graphs and double click or select View/Open Selected/One
Window, all of the graphs will be merged into a single graph and displayed in a single win-
dow.
Other multiple item selections are not valid, and will either issue an error or will simply not
respond when you double click.
When you open an object, EViews will display the current view. In general, the current
view of an object is the view that was displayed the last time the object was opened (if an
object has never been opened, EViews will use a default view). The exception to this gen-
eral rule is for those views that require significant computational time. In this latter case, the
current view will revert to the default.
Showing Objects
An alternative method of selecting and opening objects is to “show” the item. Click on the
Show button on the toolbar, or select Quick/Show… from the menu and type in the object
name or names.
Showing an object works exactly as if you first selected the object or objects, and then
opened your selection. If you enter a single object name in the dialog box, EViews will open
The Object Window—73
the object as if you double clicked on the object name. If you enter multiple names, EViews
will always open a single window to display results, creating a new object if necessary.
The Show button can also be used to display functions of series, also known as auto-series.
All of the rules for auto-series that are outlined in “Database Auto-Series” on page 279 will
apply.
One of the more important features of EViews is that you can display object windows for a
number of items at the same time. Managing these object windows is similar to the task of
managing pieces of paper on your desk.
Here, we see the equation window for OLS_RESULTS. First, notice that this is a standard
window which can be closed, resized, minimized, maximized, and scrolled both vertically
and horizontally. As in other Windows applications, you can make an object window active
by clicking once on the titlebar, or anywhere in its window. Making an object window
74—Chapter 4. Object Basics
active is equivalent to saying that you want to work with that object. Active windows may
be identified by the darkened titlebar.
Second, note that the titlebar of the object window identifies the object type, name, and
object container (in this case, the BONDS workfile or the OLS_RESULTS equation). If the
object is itself an object container, the container information is replaced by directory infor-
mation.
Lastly, at the top of the window there is a toolbar containing a number of buttons that pro-
vide easy access to frequently used menu items. These toolbars will vary across objects—
the series object will have a different toolbar from an equation or a group or a VAR object.
There are several buttons that are found on all object toolbars:
• The View button lets you change the view that is displayed in the object window.
The available choices will differ, depending upon the object type.
• The Proc button provides access to a menu of procedures that are available for the
object.
• The Object button lets you manage your objects. You can store the object on disk,
name, delete, copy, or print the object.
• The Print button lets you print the current view of the object (the window contents).
• The Name button allows you to name or rename the object.
• The Freeze button creates a new object graph, table, or text object out of the current
view.
The toolbars and menus differ across objects. For example, the View and Proc drop-down
menus differ for every object type. When the active window is displaying a series window,
the menus provide access to series views and series procedures. Alternatively, when the
Working with Objects—75
active window is a group window, clicking on View or Proc in the main menu provides
access to the different set of items associated with group objects.
The figure above illustrates the relationship between the View toolbar button and the View
menu when the series window is the active window. In the left side of the illustration, we
see a portion of the EViews main window, as it appears, after you click on View in the main
menu (note that the RC series window is the active window). On the right, we see a depic-
tion of the series window as it appears after you click on the View button in the series tool-
bar. Since the two operations are identical, the two drop-down menus are identical.
In contrast to the View and Proc menus, the Object menu does not, in general, vary across
objects. An exception occurs, however, when an object container window (i.e., a workfile
or database window) is active. In this case, clicking on Object in the toolbar, or selecting
Object from the menu provides access to menu items for manipulating the objects in the
container.
You must name an object if you wish to keep its results. If you do not name an object, it will
be called “UNTITLED”. Unnamed objects are not saved with the workfile, so they are
deleted when the workfile is closed and removed from memory.
You can also rename an object from the workfile window by selecting Object/Rename
Selected… and then specifying the new object name. This method saves you from first hav-
ing to open the object.
The following names are reserved and cannot be used as object names: “ABS”, “ACOS”,
“AND”, “AR”, “ASIN”, “C”, “CON”, “CNORM”, “COEF”, “COS”, “D”, “DLOG”, “DNORM”,
“ELSE”, “ENDIF”, “EXP”, “LOG”, “LOGIT”, “LPT1”, “LPT2”, “MA”, “NA”, “NOT”,
“NRND”, “OR”, “PDL”, “RESID”, “RND”, “SAR”, “SIN”, “SMA”, “SQR”, and “THEN”.
EViews accepts both capital and lower case letters in the names you give to your series and
other objects, but does not distinguish between names based on case. Its messages to you
will follow normal capitalization rules. For example, “SALES”, “sales”, and “sAles” are all
the same object in EViews. For the sake of uniformity, we have written all examples of
input using names in lower case, but you should feel free to use capital letters instead.
Despite the fact that names are not case sensitive, when you enter text information in an
object, such as a plot legend or label information, your capitalization will be preserved.
By default, EViews allows only one untitled object of a given type (one series, one equation,
etc.). If you create a new untitled object of an existing type, you will be prompted to name
the original object, and if you do not provide one, EViews will replace the original untitled
object with the new object. The original object will not be saved. If you prefer, you can
instruct EViews to retain all untitled objects during a session but you must still name the
ones you want to save with the workfile. See “Window Behavior” on page 622.
Labeling Objects
In addition to the display name described above, EViews objects have label fields where you
can provide extended annotation and commentary. To view these fields, select View/Label
from the object window:
Working with Objects—77
These annotated fields are most useful when you want to search for an object stored in an
EViews database. Any text that is in the fields is searchable in an EViews database; see
“Querying the Database” on page 283 for further discussion.
Copying Objects
There are two distinct methods of duplicating the information in an object: copying and
freezing.
If you select Object/Copy from the menu, EViews will create a new untitled object contain-
ing an exact copy of the original object. By exact copy, we mean that the new object dupli-
cates all the features of the original (except for the name). It contains all of the views and
procedures of the original object and can be used in future analyses just like the original
object.
You may also copy an object from the workfile window. Simply highlight the object and
click on Object/Copy Selected… or right mouse click and select Object/Copy..., then spec-
ify the destination name for the object.
We mention here that Copy is a very general and powerful operation with many additional
features and uses. For example, you can copy objects across both workfiles and databases
using wildcards and patterns. See “Copying Objects” on page 275 for details on these addi-
tional features.
Copy-and-Pasting Objects
The standard EViews copy command makes a copy of the object in the same workfile.
When two workfiles are in memory at the same time, you may copy objects between them
using copy-and-paste.
78—Chapter 4. Object Basics
Highlight the objects you wish to copy in the source workfile. Then select Edit/Copy from
the main menu.
Select the destination workfile by clicking on its titlebar. Then select either Edit/Paste or
Edit/Paste Special... from the main menu or simply Paste or Paste Special... following a
right mouse click.
Edit/Paste will perform the default paste operation. For most objects, this involves simply
copying over the entire object and its contents. In other cases, the default paste operation is
more involved. For example, when copy-and-pasting series between source and destination
workfiles that are of different frequency, frequency conversion will be performed, if possi-
ble, using the default series settings (see “Frequency Conversion” on page 117 for additional
details). EViews will place named copies of all of the highlighted objects in the destination
workfile, prompting you to replace existing objects with the same name.
If you elect to Paste Special..., EViews will open a dialog prompting you for any relevant
paste options. For example, when pasting series, you may use the dialog to override the
default series settings for frequency conversion, to perform special match merging by creat-
ing links (“Series Links” on page 183). In other settings, Paste Special... will simply prompt
you to rename the objects in the destination workfile.
Freezing Objects
The second method of copying information from an object is to freeze a view of the object. If
you click Object/Freeze Output or press the Freeze button on the object’s toolbar, a table
or graph object is created that duplicates the current view of the original object.
Before you press Freeze, you are looking at a view of an object in the object window. Freez-
ing the view makes a copy of the view and turns it into an independent object that will
remain even if you delete the original object. A frozen view does not necessarily show what
is currently in the original object, but rather shows a snapshot of the object at the moment
you pushed the button. For example, if you freeze a spreadsheet view of a series, you will
see a view of a new table object; if you freeze a graphical view of a series, you will see a
view of a new graph object.
Frozen graphs are a bit more sophisticated than other frozen objects. While frozen tables do
not change when the workfile sample or data change, you may select if and when a frozen
graph should update as the sample or its underlying data change. You may treat a frozen
graph as a snapshot of the data at the time it was frozen, or update it at will. For a complete
discussion of graph updating, see “Freezing a Graph View” on page 558.
The primary feature of freezing an object is that the tables and graphs created by freezing
may be edited for presentations or reports. Many options for customization are only avail-
able for frozen objects or may be deleted when the object is refreshed, so you should be
sure to freeze an object before customizing it.
Working with Objects—79
Deleting Objects
To delete an object or objects from your workfile, select the object or objects in the workfile
directory. When you have selected everything you want to delete, click Delete or Object/
Delete Selected on the workfile toolbar. EViews will prompt you to make certain that you
wish to delete the objects.
Printing Objects
To print the currently displayed view of an object, push the Print button on the object win-
dow toolbar. You can also choose File/Print or Object/Print on the main EViews menu bar.
EViews will open a Print dialog containing the default print settings for the type of output
you are printing. Here, we see the dialog for printing text information; the dialog for printing
from a graph will differ slightly.
Storing Objects
EViews provides three ways to save your data on disk. You have already seen how to save
entire workfiles, where all of the objects in the workfile are saved together in a single file
with the .WF1 extension. You may also store individual objects in their own data bank files.
They may then be fetched into other workfiles.
We will defer a full discussion of storing objects to data banks and databases until
Chapter 10. “EViews Databases,” on page 267. For now, note that when you are working
with an object, you can place it in a data bank or database file by clicking on the Object/
Store to DB… button on the object's toolbar or menu. EViews will prompt you for addi-
tional information.
80—Chapter 4. Object Basics
You can store several objects, by selecting them in the workfile window and then pressing
the Object/Store selected to DB… button on the workfile toolbar or menu.
Fetching Objects
You can fetch previously stored items from a data bank or database. One of the common
methods of working with data is to create a workfile and then fetch previously stored data
into the workfile as needed.
To fetch objects into a workfile, select Object/Fetch from DB… from the workfile menu or
toolbar. You will see a dialog box prompting you for additional information for the fetch:
objects to be fetched, directory and database location, as applicable.
See “Fetching Objects from the Database” on page 273 for details on the advanced features
of the fetch procedure.
Updating Objects
Updating works like fetching objects, but requires that the objects be present in the work-
file. To update objects in the workfile, select them from the workfile window, and click on
Object/Update from DB… from the workfile menu or toolbar. The Fetch dialog will open,
but with the objects to be fetched already filled in. Simply specify the directory and database
location and click OK.
The selected objects will be replaced by their counterparts in the data bank or database.
See “Fetching Objects from the Database” on page 273 and “Database Auto-Series” on
page 279 for additional details.
If only object names and icons are displayed in the window, EViews will copy a single line
containing the highlighted names to the clipboard, with each name separated by a space. If
the window contains additional information, either because View/Display Comments
(Label+/–) has been chosen in a workfile window or a query has been carried out in a
database window, each name will be placed in a separate line along with the additional
information.
Note that if you copy-and-paste the list of objects into another EViews workfile, the objects
themselves will be copied.
Chapter 5. Basic Data Handling
The process of entering, reading, editing, manipulating, and generating data forms the foun-
dation of most data analyses. Accordingly, much of your time in EViews will probably be
spent working with data. EViews provides you with a sophisticated set of data manipulation
tools that make these tasks as simple and straightforward as possible.
This chapter describes the fundamentals of working with data in EViews. There are three
cornerstones of data handling in EViews: the two most common data objects, series and
groups, and the use of samples which define the set of observations in the workfile that we
wish to use in analysis.
We begin our discussion of data handling with a brief description of series, groups, and
samples, and then discuss the use of these objects in basic input, output, and editing of
data. Lastly, we describe the basics of frequency conversion.
In Chapter 6. “Working with Data,” on page 131, we discuss the basics of EViews’ powerful
language for generating and manipulating the data held in series and groups. Subsequent
chapters describe additional techniques and objects for working with data.
Data Objects
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, and scalars). For most users, series
and groups will by far be the most important objects, so they will be the primary focus of
our discussion. Matrices, vectors, and scalars are discussed at greater length in Chapter 8.
“Matrix Language,” on page 159 in the Command and Programming Reference.
The following discussion is intended to provide only a brief introduction to the basics of
series and groups. Our goal is to describe the fundamentals of data handling in EViews. An
in-depth discussion of series and group objects follows in subsequent chapters.
Series
An EViews series contains a set of observations on a numeric variable. Associated with each
observation in the series is a date or observation label. For series in regularly dated work-
files, the observations are presumed to be observed regularly over time. For undated data,
the observations are not assumed to follow any particular frequency.
Note that the series object may only be used to hold numeric data. If you wish to work with
alphanumeric data, you should employ alpha series. See “Alpha Series” on page 160 for dis-
cussion.
82—Chapter 5. Basic Data Handling
Creating a series
One method of creating a numeric series is to select
Object/New Object… from the menu, and then to
select Series. You may, at this time, provide a name
for the series, or you can let the new series be unti-
tled. Click on OK.
A second method of creating a series is to generate the series using mathematical expres-
sions. Click on Quick/Generate Series… in the main EViews menu, and enter an expres-
sion defining the series. We will discuss this method in depth in the next chapter.
Lastly, you may create the numeric or alpha series by entering a series or alpha com-
mand in the command window. Entering an expression of the form:
series series_name = series_expr
creates a series with the name series_name and assigns the expression to each observaton.
Alternately:
alpha alpha_name = alpha_expr
creates an alpha series object and assigns the alpha_expr to each observation.
You may leave out the right-hand side assignment portion of the commands; in this case,
the series or alpha will be initialized to missing values (NA and blank strings, respectively).
Column Widths
To resize the width of a column, simply move your mouse over the column separator until
the icon changes, then drag the column to its desired width. The new width will be remem-
bered the next time you open the series and will be used when the series is displayed in a
group spreadsheet.
Data Objects—83
Display Type
The series display type, which is listed in the combo box in the series toolbar, determines
how the series spreadsheet window shows your data.
Display Formats
You may customize the way that numbers or characters in your series are displayed in the
spreadsheet by setting the series display properties. To display the dialog, click on Proper-
ties in the series toolbar, or right mouse click and select the Display Format... entry in the
menu to display the first tab of the dialog.
84—Chapter 5. Basic Data Handling
Similarly, you may elect to change the series justification by selecting Auto, Left, Center, or
Right. Note that Auto justification will set justification to right for numeric series, and left
for alpha series.
You may also use this dialog to change the column width (note that column widths in
spreadsheets may also be changed interactively by dragging the column headers).
Once you click on OK, EViews will accept the current settings and change the spreadsheet
display to reflect your choices. In addition, these display settings will be used whenever the
series spreadsheet is displayed or as the default settings when the series is used in a group
spreadsheet display.
Note that when you apply a display format, you may find that a portion of the contents of a
cell are not visible, when, for example, the column widths are too small to show the entire
cell. Alternately, you may have a numeric cell for which the current display format only
shows a portion of the full precision value.
Data Objects—85
The wide display arranges the observations from left to right and top to bottom, with the
label for the first observation in the row displayed in the margin. For dated workfiles,
EViews will, if possible, arrange the data in a form which matches the frequency of the data.
Thus, semi-annual data will be displayed with two observations per row, quarterly data will
contain four observations per row, and 5-day daily data will contain five observations in
each row.
86—Chapter 5. Basic Data Handling
This wide display format is useful when you wish to arrange observations for a particular
season in each of the columns.
Observation Numbers
If you wish to modify the observation labels to include an observation number, right-click
and select ObsID +/-. Selecting ObsID +/- switches the display between showing a label
that includes the observation label and one which does not. This feature is useful if you
wish to identify the observation number of a particular observation.
There are two features that you should keep in mind as you toggle between the various dis-
play settings:
• If you choose to display only the observations in the current sample, EViews will
switch to single column display.
• If you switch to wide display, EViews automatically turns off the display filter so that
all observations in the workfile are displayed.
One consequence of this behavior is that if you begin with a narrow display of observations
in the current sample, click on Wide +/- to switch to wide display, and then press the
Wide +/- button again, EViews will provide a narrow display of all of the observations in
Data Objects—87
the workfile. To return to the original narrow display of the current sample, you will need to
press the Smpl +/- button again.
Editing a series
You can edit individual values of the data in a series.
First, open the spreadsheet view of the series. If the series window display does not show
the spreadsheet view, click on the Sheet button, or select View/Spreadsheet, to change the
default view.
Next, make certain that the spreadsheet window is in edit mode. EViews provides you with
the option of protecting the data in your series by turning off the ability to edit from the
spreadsheet window. You can use the Edit +/– button on the toolbar to toggle between edit
mode and protected mode.
When editing series values, you should pay particular attention to the series display format,
which tells you the units in which your series are displayed. Here, we see that the series val-
ues are displayed in Default mode so that you are editing the underlying series values (or
their value mapped equivalents). Alternately, if the series were displayed in Differenced
mode, then the edited values correspond to the first differences of the series.
Note that some cells in the spreadsheet are protected. For example, you may not edit the
observation labels, or the “Last update” series label. If you select one of the protected cells,
EViews will display a message in the edit window telling you that the cell cannot be edited.
88—Chapter 5. Basic Data Handling
When you have finished editing, you should protect yourself from inadvertently changing
values of your data by clicking on Edit +/– to turn off edit mode.
Sorting a series
The data in a series may be displayed sorted by observation or by the values in the series.
From the spreadsheet view of a series (see “Editing a series,” on page 87), you can sort by
pressing the Sort button on the button bar or by pressing the right-mouse button and select-
ing Sort from the menu. To sort by series value, the entire series must be selected. To select
the series, simply press the column header directly above the series values. Similarly, to sort
by observation, the observation column must be selected.
If only a subset of the entire data series or observation series is selected, the Sort menu item
will not be available.
Groups
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 expres-
sions) 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.
Data Objects—89
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.
Creating Groups
There are several ways to create a group. Perhaps the easiest method is to select Object/
New Object… from the main menu or workfile toolbar, click on Group, and if desired,
name the object.
Series expressions will be discussed in greater depth later. For now, it suffices to note that
series expressions are mathematical expressions that may involve one or more series (e.g.
“7/2” or “3*X*Y/Z”). EViews will automatically evaluate the expressions for each observa-
tion and display the results as if they were an ordinary series. Users of spreadsheet pro-
grams will be familiar with this type of automatic recalculation.
setting, regardless of the settings in the original series, but the group does adopt the original
series cell formatting. You may temporarily override the display setting by selecting a group
display format. For example, to use the display settings of the original series, you should
select Series Spec; to display differences of all of the series in the group, select Differenced.
You can also create an empty group that may be used for entering new data from the key-
board or pasting data copied from another Windows program. These methods are described
in detail in “Entering Data” on page 101 and “Copying-and-Pasting” on page 103.
Editing in a Group
Editing data in a group is similar to editing data in a series. Open the group window, and
click on Sheet, if necessary, to display the spreadsheet view. If the group spreadsheet is in
protected mode, click on Edit +/– to enable edit mode, then select a cell to edit, enter the
new value, and press ENTER. The new number should appear in the spreadsheet.
Since groups are simply references to series, editing the series within a group changes the
values in the original series.
As with series spreadsheet views, you may click on Smpl +/– to toggle between showing
all of the observations in the workfile and showing only those observations in the current
sample. Unlike the series window, the group window always shows series in a single col-
umn.
Note that while groups inherit many of the series display formats when they are created, to
reduce confusion, groups do not initially show transformed values of the series. If you wish
to edit a series in a group in transformed form, you must explicitly set a transformation type
for the group display.
Alternately, you can drag-and-drop series into the Group Members or Spreadsheet views of
the group EViews will automatically add the series to the group.
Samples—91
Samples
One of the most important concepts in EViews is the sample of observations. The sample is
the set (often a subset) of observations in the workfile to be included in data display and in
performing statistical procedures. Samples may be specified using ranges of observations
and “if conditions” that observations must satisfy to be included.
For example, you can tell EViews that you want to work with observations from 1953M1 to
1970M12 and 1995M1 to 1996M12. Or you may want to work with data from 1953M1 to
1958M12 where observations in the RC series exceed 3.6.
The remainder of this discussion describes the basics of using samples in non-panel work-
files. For a discussion of panel samples, see “Panel Samples,” beginning on page 1244 of
User’s Guide II.
Date Pairs
In the upper edit field you will enter one or
more pairs of dates (or observation numbers).
Each pair identifies a starting and ending
observation for a range to be included in the
sample.
You may enter your date pairs in a frequency other than that of the workfile. Dates used for
the starts of date pairs are rounded down to the first instance of the corresponding date in
the workfile frequency, while dates used for the ends of date pairs are rounded up to the last
instance of the corresponding date in the workfile frequency. For example, the date pair
“1990m1 2002q3” in an annual workfile will be rounded to “1990 2002”, while the date pair
“1/30/2003 7/20/2004” in a quarterly workfile will be rounded to “2003q1 2004q3”.
Samples—93
For intraday data, the sample may be further specified by including a time after the start and
end dates. For example, given an hourly workfile, entering “1/3/2000 10AM 12/30/2000
2PM” will limit the start time to 10AM on 1/3/2000 and to 2PM on 12/30/2000.
EViews provides special keywords that may make entering sample date pairs easier. First,
you can use the keyword “@ALL”, to refer to the entire workfile range. In the workfile
above, entering “@ALL” in the dialog is equivalent to entering “1953M1 1996M12”. Fur-
thermore, you may use “@FIRST” and “@LAST” to refer to the first and last observation in
the workfile. Thus, the three sample specifications for the above workfile:
@all
@first 1996m12
1953m1 @last
are identical.
Note that when interpreting sample specifications involving days, EViews will, if necessary,
use the global defaults (“Date Representation” on page 628) to determine the correct order-
ing of days, months, and years. For example, the order of the months and days is ambigu-
ous in the date pair:
1/3/91 7/5/95
so EViews will use the default date settings to determine the desired ordering. We caution
you, however, that using the default settings to disambiguate dates in samples is not gener-
ally a good idea since a given pair may be interpreted in different ways at different times if
your settings change.
Alternately, you may use the IEEE standard format, “YYYY-MM-DD”, which uses a four-
digit year, followed by a dash, a two-digit month, a second dash, and a two-digit day. The
presence of a dash in the format means that you must enclose the date in quotes for EViews
to accept this format. For example:
"1991-01-03" "1995-07-05"
will always be interpreted as January 3, 1991 and July 5, 1995. See “Free-format Conversion
Details” on page 102 in the Command and Programming Reference for related discussion.
Sample IF conditions
The lower part of the sample dialog allows you to add conditions to the sample specifica-
tion. The sample is the intersection of the set of observations defined by the range pairs in
the upper window and the set of observations defined by the “if” conditions in the lower
window. For example, if you enter:
Upper window: 1980 1993
Lower window: incm > 5000
94—Chapter 5. Basic Data Handling
the sample includes observations for 1980 through 1993 where the series INCM is greater
than 5000.
all observations from the first quarter of 1958 to the last quarter of 1998, where GDP has
risen from the previous quarter, will be included.
The “or” and “and” operators allow for the construction of more complex expressions. For
example, suppose you now wanted to include in your analysis only those individuals whose
income exceeds 5000 dollars per year and who have at least 13 years of education. Then
you can enter:
Upper window: @all
Lower window: income > 5000 and educ >= 13
includes undated workfile observations 50 through 100 and 200 through 250, where the
series INCOME is greater than or equal to 4000 and the series EDUC is greater than 12.
You can create even more elaborate selection rules by including EViews built-in functions:
Upper window: 1958m1 1998m1
Lower window: (ed>=6 and ed<=13) or earn<@mean(earn)
includes all observations where the value of the variable ED falls between 6 and 13, or
where the value of the variable EARN is lower than its mean. Note that you may use paren-
theses to group the conditions and operators when there is potential ambiguity in the order
of evaluation.
It is possible that one of the comparisons used in the conditioning statement will generate a
missing value. For example, if an observation on INCM is missing, then the comparison
INCM>5000 is not defined for that observation. EViews will treat such missing values as
though the condition were false, and the observation will not be included in the sample.
Sample Commands
You may find it easier to set your workfile sample from the command window—instead of
using the dialog, you may set the active sample using the smpl command. Simply click on
the command window to make it active, and type the keyword “SMPL”, followed by the
sample string:
smpl 1955m1 1958m12 if rc>3.6
Samples—95
and then press ENTER (notice, in the example above, the use of the keyword “IF” to sepa-
rate the two parts of the sample specification). You should see the sample change in the
workfile window.
Suppose you have minute data over all 24 hours and would like to set the sample to only
include 9:30AM to 2:30PM. This can be accomplished using the @hourf command, which
returns the observation time as a floating point hour:
smpl if @hourf>=9.5 and @hourf<=14.5
To select only observations that appear on the half hour, use the @minute command:
smpl if @minute=0 or @minute=30
Sample Offsets
Sample range elements may contain mathematical expressions to create date offsets. This
feature can be particularly useful in setting up a fixed width window of observations. For
example, in the regular frequency monthly workfile above, the sample string:
1953m1 1953m1+11
defines a sample that includes the 12 observations in the calendar year beginning in
1953M1.
While EViews expects date offsets that are integer values, there is nothing to stop you from
adding or subtracting non-integer values—EViews will automatically convert the number to
an integer. You should be warned, however, that the conversion behavior is not guaranteed
to be well-defined. If you must use non-integer values, you are strongly encouraged to use
the @round, @floor or @ceil functions to enforce the desired behavior.
The offsets are perhaps most useful when combined with the special keywords to trim
observations from the beginning or end of the sample. For example, to drop the first obser-
vation in your sample, you may use the sample statement:
smpl @first+1 @last
Accordingly, the following commands generate a series containing cumulative sums of the
series X in XSUM:
smpl @first @first
96—Chapter 5. Basic Data Handling
series xsum = x
smpl @first+1 @last
xsum = xsum(-1) + x
(see “Basic Assignment” on page 142). The first two commands initialize the cumulative
sum for the first observation in each cross-section. The last two commands accumulate the
sum of values of X over the remaining observations.
Similarly, if you wish to estimate your equation on a subsample of data and then perform
cross-validation on the last 20 observations, you may use the sample defined by,
smpl @first @last-20
While the use of sample offsets is generally straightforward, there are a number of impor-
tant subtleties to note when working with irregular dated data and other advanced workfile
structures (“Advanced Workfiles” on page 213). To understand the nuances involved, note
that there are three basic steps in the handling of date offsets.
First, dates used for the starts of date pairs are rounded down to the first instance of the cor-
responding date in the workfile regular frequency, while dates used for the ends of date
pairs are rounded up to the last instance of the corresponding date in the regular frequency.
If date pairs are specified in the workfile frequency (e.g., the pair “1990 2000” is used in an
annual workfile), this step has no effect.
Next, EViews examines the workfile frequency date pair to determine whether the sample
dates fall within the range of the observed dates in the workfile, or whether they fall outside
the observed date range. The behavior of sample offsets differs in the two cases.
For simplicity of discussion, assume first that both dates fall within the range of observed
dates in the workfile. In this case:
• EViews identifies base observations consisting of the earliest and latest workfile
observations falling within the date pair range.
• Offsets to the date pair are then applied to the base observations by moving through
the workfile observations. If, for example, the offset for the first element of a date pair
is “+1”, then the sample is adjusted so that it begins with the observation following
the base start observation. Similarly, if the offset for the last element of a date pair is
“-2”, then the sample is adjusted to end two observations prior to the base end obser-
vation.
Samples—97
Next, we assume that both dates fall outside the range of observed workfile dates. In this
setting:
• EViews applies offsets to the date pair outside of the workfile range using the regular
frequency until the earliest and latest workfile dates are reached. The base observa-
tions are then set to the earliest and latest workfile observations.
• Any remaining offsets are applied to the base observations by moving through the
workfile observations, as in the earlier case.
The remaining two cases, where one element of the pair falls within, and the other element
falls outside the workfile date range, follow immediately.
It is worth pointing out that the difference in behavior is not arbitrary. It follows from the
fact that within the date range of the data, EViews is able to use the workfile structure to
identify an irregular calendar, but since there is no corresponding information for the dates
beyond the range of the workfile, EViews is forced to use the regular frequency calendar.
A few examples will help to illustrate the basic concepts. Suppose for example, that we have
an irregular dated annual workfile with observations for the years “1991,” “1994,” “1995,”
“1997,” “2000,” and “2002”:
is processed in several steps. First, the date “1993m8” is rounded to the previous regular fre-
quency date, “1993,” and the date “2002q2” is rounded up to the last instance of the regular
frequency date “2002”; thus, we have the equivalent sample statement:
smpl 1993+1 2002-2
Next, we find the base observations in the workfile corresponding to the base sample pair
(“1993 2002”). The “1994” and the “2002” observations are the earliest and latest, respec-
tively, that fall in the range.
98—Chapter 5. Basic Data Handling
Lastly, we apply
the offsets to the
remaining obser-
vations.
In this case, no rounding is necessary since the dates are specified in the workfile frequency.
date in the workfile, so that we “drop” the two observations “2004” and “2003”. The
remaining two offsets, which use the observed dates, drop the observations for “2002” and
“2000”. The resulting sample includes the observations “1994,” “1995,” and “1997”.
Sample Objects
As you have seen, it is possible to develop quite elaborate selection rules for the workfile
sample. However, it can become quite cumbersome and time-consuming to re-enter these
rules if you change samples frequently. Fortunately, EViews provides you with a method of
saving sample information in an object which can then be referred to by name. If you work
with many well-defined subsets of your data, you will soon find sample objects to be indis-
pensable.
To define the sample object, you should fill out this dialog as described before and click on
OK. The sample object now appears in the workfile directory with a double-arrow icon.
To declare a sample object using a command, simply issue the sample declaration, fol-
lowed by the name to be given to the sample object, and then the sample string:
sample mysample 1955m1 1958m12 if rc>3.6
EViews will create the sample object MYSAMPLE which will use observations between
1955:01 and 1958:12, where the value of the RC series is greater than 3.6.
100—Chapter 5. Basic Data Handling
Or, you may set the workfile sample using the sample object, by entering the smpl com-
mand, followed by the sample object name. For example, the command:
smpl mysample
will set the workfile sample according to the rules contained in the sample object MYSAM-
PLE.
For many purposes, you may also use a named sample object as though it were an ordinary
EViews series containing the values 1 and 0, for observations that are and are not included,
respectively. Thus, if SMP2 is a named sample object, you may use it as though it were a
series in any EViews expressions (see “Series Expressions” on page 133). For example:
y1*(smp2=0) + 3*y2*(smp2=1)
You may also, for example, create a new series that is equal to a sample object, and then
examine the values of the series to see which observations do and do not satisfy the sample
criterion.
Additionally, one important consequence of this treatment of sample objects is that you may
use sample objects in the construction of other sample objects. For example, if you create a
sample object FEMALE containing observations for individuals who are females,
sample female @all if gender="female"
You may set the sample to observations where individuals are low income females using:
smpl @all if female and not highinc
where we use the NOT keyword to take the complement of the observations in HIGHINC.
To create a sample object HIGHFEMALE using this sample, use the command:
sample highfemale @all if female and not highinc
More generally, we may use any expression involving sample objects and the keywords
“AND”, “OR”, and “NOT”, as in
smpl 1950 1980 if female or not highinc
which sets the sample to those observations from 1950 to 1980 that are also in the sample
FEMALE, but not in the sample HIGHINC.
Importing Data
The data for your project may be available in a variety of forms. The data may be in a
machine readable spreadsheet or text file that you created yourself or downloaded from the
Internet, or perhaps they are in book or photocopy form.
There are a number of ways to read such data into EViews. Earlier, we described workfile
creation tools that allow you to open data from foreign sources into a new workfile (“Creat-
ing a Workfile by Reading from a Foreign Data Source” on page 39). This is most likely the
easiest way to move data from foreign files and database sources such as ODBC into EViews
and we recommend it as your first approach, but you should note that these tools are
expressly designed for creating new workfiles.
Alternatively, you may wish to import data into an existing workfile, perhaps into existing
series in the workfile—you may, for example, wish to read a portion of an Excel file into a
subset of observations in a series or group of series. We term the reading of data into exist-
ing workfiles and/or series importing series data to distinguish it from the creation of
entirely new workfiles and series.
There are several methods for importing series data into EViews. In the remainder of this
discussion, we outline the basics of data import from spreadsheet, text file, or printed for-
mats, into series and group objects. Note that we omit, for the moment, discussion of
importing data into EViews matrix, vector and pool objects, and discussion of EViews and
foreign databases:
• Matrix and vector import tools are discussed briefly in “Matrix Object Import” on
page 108.
• Pool import is described in “Importing Pooled Data” on page 1192 of User’s Guide II.
• EViews databases are the subject of Chapter 10. “EViews Databases,” beginning on
page 267.
Entering Data
For small datasets in printed form, you may wish to enter the data by typing at the key-
board.
102—Chapter 5. Basic Data Handling
• Your first step is to open a temporary spreadsheet window in which you will enter the
data. Choose Quick/Empty Group (Edit Series) from the main menu to open an unti-
tled group window:
• The next step is to create and name the series. First click once on the up arrow in the
scroll bar to display the second obs label on the left-hand column. The row of cells
next to the second obs label is where you will enter and edit series names.
Click once in the cell next to the second obs label, and enter your first series name.
Here we have typed “income” in the edit window (the name in the cell changes as we
type in the edit window). Press RETURN. If you enter the name of an existing series,
the series data will be brought into the group.
• To enter the data, click on the appropriate cell and type the number or text. Pressing
RETURN after entering the cell value will move you to the next cell. If you prefer, you
can use the cursor keys to navigate the spreadsheet.
• When you are finished entering data, close the group window. If you wish, you can
first name the untitled group by clicking on the Name button. Otherwise, if you do
not wish to keep the group, answer Yes when EViews asks you to confirm the dele-
tion.
Copying-and-Pasting
The Windows clipboard is a handy way to move small amounts of data within EViews and
between EViews and other software applications. It is a natural tool for importing these
types of data from Excel and other Windows applications that support Windows copy-and-
paste.
Suppose you have bond yield and interest rate data in an Excel spreadsheet that you would
like to bring into EViews.
Select Quick/Empty Group (Edit Series). Note that the spreadsheet opens in edit mode so
there is no need to click the Edit +/– button.
Here, we have created a monthly workfile with a range from 1953:1 to 1999:12. The first
row of the EViews spreadsheet is labeled 1953:01. Since we are pasting in the series names
as well, you should click on the up arrow in the scroll bar to make room for the series
names.
Place the cursor in the upper-left cell, just to the right of the second obs label. Then select
Edit/Paste from the main menu (not Edit +/– in the toolbar). The group spreadsheet will
now contain the data from the clipboard.
If you paste a name corresponding to an object that already exists in the workfile, EViews
will find the next available name by appending an integer to the series name. For example,
if SER already exists in the workfile, pasting the name “SER” will create a series SER01.
Importing Data—105
You may now close the group window and delete the untitled group without losing the two
series.
First, make certain that you have an open workfile to receive the contents of the data import
and that the workfile window is active.
Next, click on Proc/Import/Read Text-Lotus-Excel... You will see a standard File Open
dialog box asking you to specify the type and name of the file. Select a file type, navigate to
the directory containing the file, and double click on the name. Alternatively, type in the
name of the file that you wish to read (with full path information, if appropriate); if possi-
ble, EViews will automatically set the file type, otherwise it will treat the file as an ASCII
file. Click on Open.
106—Chapter 5. Basic Data Handling
EViews will open a dialog prompting you for additional information about the import proce-
dure. The dialog will differ greatly depending on whether the source file is a spreadsheet or
an ASCII file.
Spreadsheet Import
The title bar of the dialog will identify the type of file that you have asked EViews to read.
Here is the dialog for importing an Excel 5 (or later versions of Excel) spreadsheet:
You will see slightly different versions of this dialog depending on whether you are reading
a Lotus or an Excel 4 (and earlier) file. Now fill in the dialog:
• First, you need to tell EViews 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. Another
interpretation for “by observation” is that variables are arranged in columns while
“by series” implies that all of the observations for a variable are in a single row.
Importing Data—107
inputs will be assigned missing values. For example, if you read into the sample
defined as “1971 1990”, and there are only 10 observations in the input file, the
observations from 1981 to 1990 will be assigned missing values.
When the dialog is first displayed, EViews enters the current workfile sample in the
edit box by default. You should edit this string to reflect the desired sample. To make
it easier to set the sample, EViews provides you with three push-buttons which
change the string in the edit box to commonly used values:
1. Current sample sets the dialog string to the current workfile sample.
2. Workfile range sets the dialog string to the entire range of the workfile.
3. To end of range sets the dialog string to all observations from the beginning of the
current sample to the end of the workfile range.
• If you are reading data from an Excel 5 workbook file, there will be an additional edit
box where you can enter the name of the sheet containing your data. If you do not
enter a name, EViews will read from the topmost sheet in the Excel workbook.
• When the dialog is completely filled out, simply click OK and EViews will read your
file, creating series and assigning values as requested.
ASCII Import
If you choose to read from an ASCII file, EViews will open an ASCII Text Import dialog. Fill
out the dialog to read from the specified file.
The dialog box for ASCII file import is considerably more complicated than the correspond-
ing spreadsheet dialog. While unfortunate, this complexity is necessary since there is no
standard format for ASCII files. EViews provides you with a range of options to handle vari-
ous types of ASCII files.
ASCII file importing is explained in considerable detail in “Importing ASCII Text Files,”
beginning on page 122.
In reading from a file, EViews first fills the matrix with NAs, puts the first data element in
the (1,1) element of the matrix, and then continues reading the data by row or column
according to the specified settings for Data order. If this option is set as Original, EViews
will read by row, filling the first row from left to right, and then continuing on to the next
row. If the ordering is set as Transpose, EViews will read by column, reading the first col-
umn from top to bottom and then continuing on to the next column. In either case, the data
read from the file are placed into the matrix by row.
ASCII files provide you with the option of reading your file as a rectangle. If your ASCII file
is laid out as a rectangle, the contents of the rectangle will be placed in the matrix beginning
at the (1,1) element of the matrix. For example, if you have a 3 ¥ 3 matrix X in EViews,
and read from the ASCII file containing:
1 2 3 4
5 6 7 8
9 10 11 12
using the File laid out as rectangle option, the matrix X will contain the corresponding rect-
angular portion of the ASCII file:
1 2 3
5 6 7
9 10 11
If you do not select the rectangular read option, EViews fills the matrix element-by-element,
reading from the file line-by-line Then X will contain:
1 2 3
4 5 6
7 8 9
110—Chapter 5. Basic Data Handling
Exporting Data
EViews provides you with a number of methods for getting data from EViews into other
applications.
The easiest way to save series data is to use the save your workfile page as a foreign file.
Simply select File/Save As from the main EViews menu, choose your file type and provide
a name, then fill out the dialogs. EViews will prompt you to specify the variables and object
you wish to save. You will notice that the identifier series are listed first in the top portion of
the dialog, with @date selected and @enddate unselected by default. You may also specify
the sample of observations to be written, and for some output formats, the valmaps to be
written.
(See “Creating a Workfile by Reading from a Foreign Data Source” on page 39 for a discus-
sion of the dialog controls.)
For most applications, this method of saving data to a foreign format will be more than suf-
ficient. The remainder of this section discusses alternate methods that support other object
types and may offer additional control over the export operation. If, for example, you wish
to export data in a matrix, you will need to use one of the methods described below.
clipboard. You will see a dialog box asking whether to copy the numbers with the precision
showing on your screen (formatted copy) or to copy the numbers at full precision (unfor-
matted copy).
As a shortcut, you can highlight entire rows or columns of cells by clicking on the gray bor-
der that surrounds the spreadsheet. Dragging across the border selects multiple rows or col-
umns. To copy several adjacent series from the spreadsheet, drag across their names in the
top border. All of their data will be highlighted. Then click Edit/Copy… to put the data into
the clipboard.
Once the data are on the clipboard, switch to the target application, highlight the cells to
which the data is to be copied and select Edit/Paste.
When pasting to a spreadsheet view or a table in EViews, if the paste cell range is larger
than the copy range, the data will be repeated to fill the entire paste range. However, this
will only occur if the paste range is proportional to copy range. Ranges are considered pro-
portional when the paste range is a multiple of the copy range. For example, if a 3 by 1 area
(3 rows by 1 column) is copied, the paste range must be at least 3 by 1. Proportional paste
ranges could include 3 by 2, 6 by 1, 6 by 2, etc.
Once you have specified the output file, click OK to open the export dialog.
Tip: if you highlight the series you wish to export before beginning the export procedure,
the series names will be used to fill out the export dialog.
112—Chapter 5. Basic Data Handling
Spreadsheet Export
The dialogs for spreadsheet export are virtually identical to the dialogs for spreadsheet
import. You should determine the orientation of your data, the series to export, and the
sample of observations to be written.
Additionally, EViews provides you with checkboxes for determining whether to include the
series names and/or the series dates in the spreadsheet. If you choose to write one or both
to the spreadsheet, make certain that the starting cell for your data leaves the necessary
room along the borders for the information. If the necessary room is not available, EViews
will ignore the option—for example, if you choose to write your data beginning in cell A1,
EViews will not write the names or dates.
ASCII Export
The ASCII export dialog is quite similar to the spreadsheet export dialog, but it contains a
few additional options:
• You can change the text string to be used for writing missing values. Simply enter the
text string in the edit field.
• EViews provides you with the option of separating data values with a tab, a space, or
a comma. Click on the desired radio button.
We caution that if you attempt to write your data by series, EViews will write all of the
observations for a series on a single line. If you have a reasonably long series of observa-
tions, these data may overflow the line-length of other programs.
We also provide an EViews Microsoft Excel Add-in that allows users to fetch and link to
EViews data located in workfiles and databases. The Add-in offers an easy-to-use interface
to OLEDB for reading EViews data from within Excel.
The following discussion offers only a brief overview of the OLEDB driver and the Excel
Add-in. For additional details, see the Using the EViews OLEDB Driver and The EViews
Microsoft Excel Add-in whitepapers, both available in your EViews documentation directory
or from our website www.eviews.com.
Reading EViews Data using Other Applications—113
Installation of the EViews Excel Add-in is an option during the normal EViews installation
procedure. Note that use of the Add-in requires that EViews be installed with a valid serial
number. If you have already installed EViews but have not yet installed the Add-in, please
run your EViews installer, and select the EViews Excel Add-in option.
Once installed, you’ll need to activate the Add-in from within Microsoft Excel (see your
Excel documentation or the The EViews Microsoft Excel Add-in for details).
The following Excel 2007 instructions illustrate use of the EViews Add-in to retrieve data:
• From the Add-ins ribbon, select the EViews dropdown from the Custom Toolbars
section. Select Get Data to display the Get EViews Data popup dialog and click on
Change source... to pick an existing workfile or database. If the specified source is a
workfile, a Page dropdown will display all available pages; simply pick the page from
which you wish to read. If the source is a database, the Freq dropdown will let you
filter the series in the database by frequency.
114—Chapter 5. Basic Data Handling
• You may use the Types dropdown to change the default series object filter so that you
only consider matrix objects.
• You may further filter objects by name and description by clicking on the Filter... but-
ton and entering restrictions in the dialog.
• You may select one or more series objects or a single matrix object and click on
Import or Import & Link to continue. If you wish, you may instead click on Add to
add selected items to the Objects to import list. Clicking on Add All adds all of the
displayed items to the import list. You may also type in the name of the objects to
import. Once your list is complete, click on Import or Import & Link to proceed. The
import list approach is particularly useful if you wish to build-up a list of objects
using various approaches or multiple filtered lists.
• The last step is to import or link the EViews data into Excel. On the resulting Select
Insert Point popup, you should specify a destination cell in your Excel worksheet
(you can click on a target cell to fill out the dialog). Click on OK.
At this point, the data should now be displayed in the specified worksheet. If we select
Import & Link instead of Import in the first step, this data will automatically refresh itself
every time the worksheet is opened. (Note: this worksheet must be saved in a trusted loca-
tion to allow the data to refresh properly. See the Microsoft Excel documentation regarding
“Trusted File Locations” for details.)
For additional details, see the Using the EViews OLEDB Driver whitepaper.
The following instructions for Excel 2007 illustrate the use of built-in OLEDB support to read
EViews workfile data. (Note that “The Excel Add-in,” on page 113 describes a streamlined
interface for performing the same operation.)
• From the Data ribbon, select From Other Sources in the Get External Data section.
In the dropdown, select From Data Connection Wizard. In the Data Connection
Wizard, select Other/Advanced in the listbox and click Next.
.
116—Chapter 5. Basic Data Handling
Frequency Conversion
Every series in EViews has an associated fre-
quency. When a series is in a workfile, the series is
stored at the frequency of the workfile. When a series is held in a database (Chapter 10.
“EViews Databases”), it is stored at its own frequency. Since all series in the same workfile
page must share a common frequency, moving a series from one workfile to another or from
a database to a workfile page will cause the series being moved to be converted to the fre-
quency of the workfile page into which it is being placed.
Copy-and-Paste
Suppose that you have two workfile pages (or a source database and a destination workfile
page), where the source contains quarterly data on the series YQ, and the destination work-
file contains annual data. Note that you may copy between pages in the same workfile or
between separate workfiles.
To convert YQ from a quarterly to annual frequency, you may copy-and-paste the series
from the source quarterly workfile to the annual workfile. Click on the YQ series in the
quarterly workfile, press the right-mouse button and select Copy, navigate to the annual
workfile, then right mouse button and select Paste or Paste Special....
If you select Paste, EViews will copy YQ to the annual page, using the default frequency
conversion settings present in YQ to perform the conversion.
If you select Paste Special..., EViews will display a dialog offering you the opportunity to
override the default frequency conversion settings. Before describing this dialog (“Overrid-
ing Default Conversion Methods” on page 121), we provide a background on frequency con-
version methods, and describe how default conversion methods are specified in EViews.
118—Chapter 5. Basic Data Handling
Drag-and-Drop
An alternative to copy-and-paste is to use drag-and-drop to copy files between workfile
pages. Simply select the series to be copied, then drag-and-drop them on the destination
page tab. If you use the right-mouse button to select the series, dropping them on the new
tab will bring up the Paste Special dialog.
You can even drag-and-drop a workfile page tab into a workfile window to copy all of the
objects from one workfile page into another. Depending on the objects being copied and the
frequencies of the workfiles, you may receive a series of prompts to assist in completing the
paste properly.
Using Commands
You may use either the copy or fetch command to move series between workfiles or
between a database and a workfile. EViews will perform frequency conversion if the fre-
quencies of the source and destination do not match.
See copy (p. 215) and fetch (p. 238) in the Command and Programming Reference for
details.
EViews provides you with the ability to specify methods for all types of conversion. In addi-
tion, there are settings that control the handling of missing values when performing the con-
version.
with the latter setting permitting you to disallow high to low conversions. In this case,
EViews will generate an error if you attempt to convert from high to low frequency.
In addition, you may specify how EViews handles missing data when carrying out the calcu-
lations. You may elect to propagate NAs so that whenever a missing value appears in a cal-
culation, the result for the corresponding period will be an NA. Alternatively, you may elect
not to propagate NAs so that calculations will be performed ignoring the missing values
(though if all values for a period are missing, the corresponding result will still be an NA).
Using an interpolation method which matches the average means that the average of the
interpolated points for each period is equal to the source data point for that period. Similarly
if the sum is matched, the interpolated points will sum to the source data point for the
period, and if the last observation is matched, the last interpolated point will equal the
source data point for the period.
For all methods, all relevant data from the low frequency series is used when forming the
high frequency series, even if the destination observations are a subset of the observations
available in the source.
quency observations matches the low frequency observation (the value is divided by
the number of observations).
• Quadratic: match average, Quadratic: match sum—These two methods fit a local
quadratic polynomial for each observation of the low frequency series, then use this
polynomial to fill in all observations of the high frequency series associated with the
period. The quadratic polynomial is formed by taking sets of three adjacent points
from the source series and fitting a quadratic so that either the average or the sum of
the high frequency points matches the low frequency data actually observed. For
most points, one point before and one point after the period currently being interpo-
lated are used to provide the three points. For end points, the two periods are both
taken from the one side where data is available.
This method is a purely local method. The resulting interpolation curves are not con-
strained to be continuous at the boundaries between adjacent periods. Because of
this, the method is better suited to situations where relatively few data points are
being interpolated and the source data is fairly smooth.
• Linear: match last—This method assigns each value in the low frequency series to
the last high frequency observation associated with the low frequency period, then
places all intermediate points on straight lines connecting these points.
• Cubic: match last—This method assigns each value in the low frequency series to the
last high frequency observation associated with the low frequency period, then places
all intermediate points on a natural cubic spline connecting all the points.
A natural cubic spline is defined by the following properties:
1. Each segment of the curve is represented by a cubic polynomial.
2. Adjacent segments of the curve have the same level, first derivative and second
derivative at the point where they meet.
3. The second derivative of the curve at the two global end points is equal to zero
(this is the “natural” spline condition).
Cubic spline interpolation is a global interpolation method so that changing any one
point (or adding an additional point) to the source series will affect all points in the
interpolated series.
Undated Conversion
If you fetch or copy a series to or from an undated or unstructured workfile into or from a
dated workfile, the data will be copied sequentially, beginning at the starting observation
number of the undated or unstructured series (generally the first observation).
Frequency Conversion—121
Panel Conversion
Performing frequency conversion when either the source or destination are panel workfile
pages raises a number of additional issues. See “Panel links with date matching” on
page 191 and “Panel frequency conversion” on page 195 for discussion of the general
issues.
As an example of controlling frequency conversion using default settings, suppose you have
daily data consisting of HIGH, LOW, and CLOSE series for a particular stock, from which
you would like to construct a monthly workfile. If you use the default frequency conversion
methods, the monthly workfile will contain series which use the series defaults, which is
not likely to be what you want. By setting the frequency conversion method of the HIGH
series to Max observation, of the LOW series to Min observation, and of the CLOSE series
to Last observation, you may use conversion to populate a monthly workfile with con-
verted daily data that follow the desired behavior.
If, when pasting the series into the destination, you use Paste Special... in place of Paste,
EViews will display a dialog offering you the opportunity to override the default frequency
conversion settings.
Additionally, we note that the dialog allows us to use the frequency conversion method
Specified in series or to select alternative methods.
If, instead of copy-and-paste, you are using either the copy or fetch command and you
provide an option to set the conversion method, then EViews will use this method for all of
the series listed in the command (see copy (p. 215) and fetch (p. 238) in the Command
and Programming Reference for details).
You should be very careful in naming your series and listing the names in the dialog.
If the name in the list or in the file is the same as an existing series name in the work-
file, the data in the existing series will be overwritten.
• Data order. You need to specify how the data are organized in your file. If your data
are ordered by observation so that each series is in a column, select in Columns. If
your data are ordered by series so that all the data for the first series are in one row
followed by all the data for the second series, and so on, select, in Rows.
• Import sample. You should specify the sample in which to place the data from the
file. EViews fills out the dialog with the current workfile sample, but you can edit the
sample string or use the sample reset buttons to change the input sample. The input
sample only sets the sample for the import procedure, it does not alter the workfile
sample.
EViews fills all of the observations in the current sample using the data in the input
file. There are a couple of rules to keep in mind:
1. EViews assigns values to all observations in the input sample. Observations out-
side of the input sample will not be changed.
2. If there are too few values in the input file, EViews will assign NAs to the extra
observations in the sample.
3. Once all of the data for the sample have been read, the remainder of the input file
will be ignored.
In addition to the above information, you can use the following options to further control
the way EViews reads in ASCII data.
EViews scans the first few lines of the source file and sets the default formatting options in
the dialog based on what it finds. However, these settings are based on a limited number of
lines and may not be appropriate. You may find that you need to reset these options.
Delimiters
Delimiters are the characters that your file uses to separate observations. You can specify
multiple delimiters by selecting the appropriate entries. Tab, Comma, and Space are self-
explanatory. The Alpha option treats any of the 26 characters from the alphabet as a delim-
iter.
For delimiters not listed in the option list, you can select the Custom option and specify the
symbols you wish to treat as delimiters. For example, you can treat the slash “/” as a delim-
iter by selecting Custom and entering the character in the edit box. If you enter more than
one character, each character will be treated as a delimiter. For example, if you enter double
slash “//” in the Custom field, then the single slash “/” will be treated as a delimiter,
instead of the double slash “//”. The double slash will be interpreted as two delimiters.
Importing ASCII Text Files—125
EViews provides you with the option of treating multiple delimiter characters as a single
delimiter. For example, if “,” is a delimiter and the option Treat multiple delimiters as one
is selected, EViews will interpret “,,” as a single delimiter. If the option is turned off, EViews
will view this string as two delimiters surrounding a missing value.
Knowing that a file is rectangular simplifies ASCII reading since EViews knows how many
values to expect on a given line. For files that are not rectangular, you will need to be pre-
cise about the number of series or observations that are in your file. For example, suppose
that you have a non-rectangular file that is ordered in columns and you tell EViews that
there are four series in the file. EViews will ignore new lines and will read a new observa-
tion after reading every four values.
If the file is rectangular, you can tell EViews to skip columns and/or rows.
For example, if you have a rectangular file and you type 3 in the Rows to skip field, EViews
will skip the first three rows of the data file. Note that you can only skip the first few rows
or columns; you cannot skip rows or columns in the middle of the file.
Series Headers
This option tells EViews how many “cells” to offset as series name headers before reading
the data in the file. The way that cell offsets are counted differs depending on whether the
file is in rectangular form or not.
For files in rectangular form, the offsets are given by rows (for data in columns) or by col-
umns (for data in rows). For example, suppose your data file looks as follows:
There is a one line (row) gap between the series name line and the data for the first observa-
tion. In this case, you should set the series header offset as 2, one for the series name line
and one for the gap. If there were no gap, then the correct offset would instead be 1.
For files not in rectangular form, the offsets are given by the number of cells separated by
the delimiters. For example, suppose you have a data file that looks as follows:
126—Chapter 5. Basic Data Handling
The data are ordered in columns, but each observation is recorded in two lines, the first line
for the first 10 series and the second line for the remaining 4 series.
It is instructive to examine what happens if you incorrectly read this file as a rectangular file
with 14 series and a header offset of 2. EViews will look for the series names in the first line,
will skip the second line, and will begin reading data starting with the third line, treating
each line as one observation. The first 10 series names will be read correctly, but since
EViews will be unable to find the remaining four names on the first line, the remaining
series will be named SER01–SER04. The data will also be read incorrectly. For example, the
first four observations for the series GR will be 215.9800, NA, 180.4800, and NA, since
EViews treats each line as a new observation.
To read this data file properly, you should turn off the rectangle file option and set the
header offset to 1. Then EViews will read, from left to right, the first 14 values that are sep-
arated by a delimiter or carriage return and take them as series names. This corresponds to
the header offset of 1, where EViews looks to the number of series (in the upper left edit
box) to determine how many cells to read per header offset. The next 14 observations are
the first observations of the 14 series, and so on.
Miscellaneous Options
• Quote with single ' not ". The default behavior in EViews is to treat anything inside a
pair of matching double quotes as one string, unless it is a number. This option treats
anything inside a pair of matching single quotes as one string, instead of the double
quotes. Since EViews does not support strings, the occurrence of a pair of matching
double quotes will be treated as missing, unless the text inside the pair of double
quotes may be interpreted as a number.
• Drop strings—don’t make NA. Any input into a numeric series that is not a number
or delimiter will, by default, be treated as a missing observation. For example, “10b”
and “90:4” will both be treated as missing values (unless Alphabetic characters or “:”
are treated as delimiters). The Drop strings option will skip these strings instead of
treating them as NAs.
If you choose this option, the series names, which are strings, will also be skipped so
that your series will be named using the EViews default names: “SER01”, “SER02”,
and so on. If you wish to name your series, you should list the series names in the
dialog.
Note that strings that are specified as missing observations in the Text for NA edit
box will not be skipped and will be properly indicated as missing.
Importing ASCII Text Files—127
Examples
In these examples, we demonstrate the ASCII import options using example data files down-
loaded from the Internet. The first example file looks as follows:
This is a cross-section data set, with seven series ordered in columns, each separated by a
single space. Note that the B series takes string values, which will be replaced by NAs. If we
type 7 series in the number of series field and use the default setting, EViews will correctly
read the data.
By default, EViews checks the Treat multiple delimiters as one option even though the
series are delimited by a single space. If you do not check this option, the last series BB will
not be read. EViews will create a series named “SER01” and all data will be incorrectly
imported. This strange behavior is caused by an extra space in the very first column of the
data file, before the 1st and 3rd observations of the X series. EViews treats the very first
128—Chapter 5. Basic Data Handling
space as a delimiter and looks for the first series data before the first extra space, which is
missing. Therefore the first series is named SER01 with data NA, 10, NA, 12 and all other
series are incorrectly imported.
To handle this case, EViews automatically ignores the delimiter before the first column data
if you choose both the Treat multiple delimiters as one and the File laid out as rectangle
options.
This is a cross-section data set, ordered in columns, with missing values coded as “-999.0”.
There are eight series, each separated by spaces. The first series is the ID name in strings.
If we use the EViews defaults, there will be problems reading this file. The spaces in the ID
description will generate spurious NA values in each row, breaking the rectangular format
of the file. For example, the first name will generate two NAs, since “African” is treated as
one string, and “elephant” as another string.
You will need to use the Drop strings option to skip all of the strings in your data so that
you don’t generate NAs. Fill out the ASCII dialog as follows:
• Text for NA should be entered exactly as it appears in the file. For this example, you
should enter “–999.0”, not “–999”.
This file has 10 lines of data description, line 11 is the series name header, and the data
begin in line 12. The data are ordered in columns in rectangular form with missing values
coded as a “0”. To read these data, you can instruct EViews to skip the first 10 rows of the
rectangular file, and read three series with the names in the file, and NAs coded as “0”.
The only problem with this method is that the DATE series will be filled with NAs since
EViews treats the entry as a string (because of the “/” in the date entry). You can avoid this
problem by identifying the slash as a delimiter using the Custom edit box. The first column
will now be read as three distinct series since the two slashes are treated as delimiters.
Therefore, we modify the option settings as follows:
130—Chapter 5. Basic Data Handling
The month, day, and year will be read as separate series and can be used as a quick check
of whether the data have been read correctly.
Chapter 6. Working with Data
In the following discussion, we describe EViews’ powerful language for using numeric
expressions and generating and manipulating the data in series and groups. We first
describe the fundamental rules for working with mathematical expressions in EViews, and
then describe how to use these expressions in working with series and group data.
More advanced tools for working with numeric data, and objects for working with different
kinds of data are described in Chapter 7. “Working with Data (Advanced),” beginning on
page 155.
Numeric Expressions
One of the most powerful features of EViews is the ability to use and to process mathemati-
cal expressions. EViews contains an extensive library of built-in operators and functions
that allow you to perform complicated mathematical operations on your data with just a few
keystrokes. In addition to supporting standard mathematical and statistical operations,
EViews provides a number of specialized functions for automatically handling the leads,
lags and differences that are commonly found in time series data.
As in other programs, you can use these expressions to calculate a new series from existing
series, to describe a sample of observations, or to describe an equation for estimation or
forecasting. However, EViews goes far beyond this simple use of expressions by allowing
you to use expressions virtually anywhere you would use a series. We will have more on
this important feature shortly, but first, we describe the basics of using expressions.
Operators
EViews expressions may include operators for the usual arithmetic operations. The opera-
tors for addition (+), subtraction (-), multiplication (*), division (/) and raising to a power
(^) are used in standard fashion so that:
5 + 6 * 7.0 / 3
7 + 3e-2 / 10.2345 + 6 * 10^2 + 3e3
3^2 - 9
are all valid expressions. Notice that explicit numerical values may be written in integer,
decimal, or scientific notation.
132—Chapter 6. Working with Data
In the examples above, the first expression takes 5 and adds to it the product of 6 and 7.0
divided by 3 (5+14=19); the last expression takes 3 raised to the power 2 and subtracts 9
(9 – 9 = 0). These expressions use the order of evaluation outlined below.
The “-” and “+” operators are also used as the unary minus (negation) and unary plus oper-
ators. It follows that:
2-2
-2+2
2+++++++++++++-2
2---2
EViews follows the usual order in evaluating expressions from left to right, with operator
precedence order as follows (from highest precedence to lowest):
• unary minus (-), unary plus (+)
• exponentiation (^)
• multiplication (*), division (/)
• addition (+), subtraction (-)
• comparison (<, >, <=, >=, =)
• and, or
To enforce a particular order of evaluation, you can use parentheses. As in standard mathe-
matical analysis, terms which are enclosed in parentheses are treated as a subexpression
and evaluated first, from the innermost to the outermost set of parentheses. We strongly
recommend the use of parentheses when there is any possibility of ambiguity in your
expression.
A full listing of operators is presented in Chapter 10. “Operator and Function Reference,” on
page 383 of the Command and Programming Reference.
Series Expressions
Much of the power of EViews comes from the fact that expressions involving series operate
on every observation, or element, of the series in the current sample. For example, the
series expression:
2*y + 3
tells EViews to multiply every sample value of Y by 2 and then to add 3. We can also per-
form operations that work with multiple series. For example:
x/y + z
indicates that we wish to take every observation for X and divide it by the corresponding
observation on Y, and add the corresponding observation for Z.
Series Functions
EViews contains an extensive library of built-in functions that operate on all of the elements
of a series in the current sample. Some of the functions are “element functions” which
return a value for each element of the series, while others are “summary functions” which
return scalars, vectors or matrices, which may then be used in constructing new series or
working in the matrix language (see Chapter 8. “Matrix Language,” on page 159 of the Com-
mand and Programming Reference for a discussion of scalar, vector and matrix operations).
Most function names in EViews are preceded by the @-sign. For example, @mean returns the
average value of a series taken over the current sample, and @abs takes the absolute value
of each observation in the current sample.
All element functions return NAs when any input value is missing or invalid, or if the result
is undefined. Functions which return summary information generally exclude observations
for which data in the current sample are missing. For example, the @mean function will
compute the mean for those observations in the sample that are non-missing.
There is an extensive set of functions that you may use with series:
• A list of mathematical functions is presented in Chapter 10. “Operator and Function
Reference,” on page 383 of the Command and Programming Reference.
• Workfile functions that provide information about observations identifiers or allow
you to construct time trends are described in Chapter 12. “Workfile Functions” of the
Command and Programming Reference.
• Functions for working with strings and dates are documented in “String Function
Summary” on page 443 and “Date Function Summary” on page 444 both in the Com-
mand and Programming Reference.
134—Chapter 6. Working with Data
The remainder of this chapter will provide additional information on some of these func-
tions, then examples of expressions involving functions.
Series Elements
At times, you may wish to access a particular observation for a series. EViews provides you
with a special function, @elem, which allows you to use a specific value of a series.
@elem takes two arguments: the first argument is the name of the series, and the second is
the date or observation identifier.
For example, suppose that you want to use the 1980Q3 value of the quarterly series Y, or
observation 323 of the undated series X. Then the functions:
@elem(y, 1980Q3)
@elem(x, 323)
will return the values of the respective series in the respective periods.
A numeric relational comparison is an expression which contains the “=” (equal), “>=”
(greater than or equal), “<=” (less than or equal), “<>” (not equal), “>” (greater than),
or “<” (less than) comparison operators. These expressions generally evaluate to TRUE or
FALSE, returning a 1 or a 0, depending on the result of the comparison.
Note that EViews also allows relational comparisons to take the value “missing” or NA, but
for the moment, we will gloss over this point until our discussion of missing values (see
“Missing Values” on page 139).
We have already seen examples of expressions using relational operators in our discussion
of samples and sample objects. For example, we saw the sample condition:
incm > 5000
which allowed us to select observations meeting the specified condition. This is an example
of a relational expression—it is TRUE for each observation on INCM that exceeds 5000; oth-
erwise, it is FALSE.
As described above in the discussion of samples, you may use the “and” and “or” conjunc-
tion operators to build more complicated expressions involving relational comparisons:
(incm>5000 and educ>=13) or (incm>10000)
Numeric Expressions—135
It is worth emphasizing the fact that EViews uses the number 1 to represent TRUE and 0 to
represent FALSE. This internal representation means that you can create complicated
expressions involving logical subexpressions. For example, you can use relational operators
to recode your data:
0*(inc<100) + (inc>=100 and inc<200) + 2*(inc>=200)
which yields 0 if INC<100, 1 if INC is greater than or equal to 100 and less than 200, and 2
for INC greater than or equal to 200.
The equality comparison operator “=” requires a bit more discussion, since the equal sign is
used both in assigning values and in comparing values. We consider this issue in greater
depth when we discuss creating and modifying series (see “Series” on page 141). For now,
note that if used in an expression:
incm = 2000
Descriptive Statistics
Standard descriptive statistic functions are available in EViews. These include, but are not
limited to functions to calculate the mean (@mean), the median (@median), the standard
deviation (@stdev), the variance (@var) and covariance (@cov). The descriptive statistic
functions all take an optional sample as an argument. For a full list of descriptive statistics
functions, details on the use of samples, and some examples, see “Descriptive Statistics,” on
page 388 of the Command and Programming Reference.
It should be noted that EViews offers two ways to calculate standard deviations, variances
and covariances. The simple standard deviation function, @stdev, calculates the sample
standard deviation, that is the square root of the sum-of-squares divided by n – 1 . To cal-
culate the population standard deviation, that is division by n, use the @stdevp function.
Note for symmetry purposes there is also a @stdevs which performs the same calculation
as @stdev.
The @var and @cov functions calculate the population variance and covariance respec-
tively, i.e., they divide through by n. To calculate the sample variance or covariance use the
@vars or @covs functions. Again, there are also @varp and @covp functions which do the
same as @var or @cov.
While EViews expects lead and lag arguments to be integers, there is nothing to stop you
from putting non-integer values in the parentheses. EViews will automatically convert the
number to an integer; you should be warned, however, that the conversion behavior is not
guaranteed to be systematic. If you must use non-integer values, you are strongly encour-
aged to use the @round, @floor, or @ceil functions to control the lag or lead behavior.
In many places in EViews, you can specify a range of lead or lag terms. For example, when
estimating equations, you can include expressions of the form:
income(-1 to -4)
are equivalent methods of specifying the level of SALES and all lags from 1 to 4.
The @lag function can also be used to specify lags. Thus the expressions:
@lag(sales,1)
sales(-1)
are equivalent. Note one useful function of @lag is that it will take the lag of everything
within parenthesis. @lag can therefore be used to find the lag of an expression. Typing:
@lag((sales-income)/sales,4)
(sales(-4)-income(-4))/sales(-4)
EViews also has several built-in functions for working with difference data in either levels or
in logs. The “D” and “DLOG” functions will automatically evaluate the differences for you.
For example, instead of taking differences explicitly,
income - income(-1)
log(income) - log(income(-1))
You can take higher order differences by specifying the difference order. For example, the
expressions:
Numeric Expressions—137
d(income,4)
dlog(income,4)
If you wish to take seasonal differences, you should specify both the ordinary, and a sea-
sonal difference term:
d(income,1,4)
dlog(income,1,4)
These commands produce first order differences with a seasonal difference at lag 4. If you
want only the seasonal difference, specify the ordinary difference term to be 0:
d(income,0,4)
dlog(income,0,4)
Other time series functions provided by EViews include a number of percentage change type
functions. The simplest of these, @pc calculates a simple one-period percentage change in a
series. For example typing:
@pca(income)
Two special types of time series functions, moving functions and cumulative functions are
also available in EViews, and are described below.
Mathematical details of lags, leads, differences and percentage change functions are pro-
vided in Chapter 10. “Operator and Function Reference,” on page 383 of the Command and
Programming Reference.
The backwards functions, which take the form @cumb[stat], start at the end of the workfile,
or sample, and move backwards until the current observation.
Note for both type of cumulative function the length of the window is different for each
observation. The cumulative functions may be thought of as perform “running total” type
calculations. Missing values are not propagated in the cumulative functions, i.e., observa-
tions with a value equal to NA are simply skipped.
138—Chapter 6. Working with Data
The moving statistic functions have a shorter, user specified, window length. They provide
information on the n observations up to, and including, the current observation, where n is
chosen by the user.
The moving functions come in two types, those that propagate missing values and those
that do not. For the functions that do propagate missing values, which take the form
@mov[stat], if any of the observations within the window contain an NA the function will
return NA. The functions that do not propagate, which take the form @m[stat], will simply
skip any NA observations.
For more information on missing values see “Missing Values” on page 139.
As an example, you could find out the maximum value of INCOME from the start of the
workfile to each observation by typing:
show @cummax(income)
If the first, say, four observations of INCOME are 100, 120, 110, 140 then this command will
show a series as 100, 120, 120, and 140 as the first four observations.
If you wanted to know at each observation the average of the previous 3 years (including
the current year) SALES figures you could type:
show @movav(sales,3)
Note that the lag or lead operators can be used inside a moving statistic function to allow
you to control the exact start and end point of your window. For example, if you wanted to
know, at each observation, the sum of SALES from three years ago, two years ago and last
year (i.e. the sum of SALES(-1), SALES(-2) and SALES(-3)) you could type:
show @movsum(sales(-1),3)
Further details and a complete list of cumulative functions can be found in “Cumulative Sta-
tistic Functions” on page 391, and for moving functions in “Moving Statistic Functions” on
page 394 both in the Command and Programming Reference.
Ranking Series
EViews has an @ranks function which will generate a series based upon the ranking of
another series. Ranking can be either ascending or descending depending upon whether “a”
or “d” is used as an option in the function. For example to create series, ARANK, which
contains the ascending ranks of the observations in the series SALES you could type:
series arank = @ranks(sales,a)
and to create a series containing the descending ranks you could type:
Numeric Expressions—139
EViews provides a number of different ways of handling ties in the ranking. For more details
see @ranks in “Descriptive Statistics” on page 388 of the Command and Programming Ref-
erence.
Missing Values
Occasionally, you will encounter data that are not available for some periods or observa-
tions, or you may attempt to perform mathematical operations where the results are unde-
fined (e.g., division by zero, log of a negative number). EViews uses the code NA (not
available) to represent these missing values.
For the most part, you need not worry about NAs. EViews will generate NAs for you when
appropriate, and will automatically exclude observations with NAs from statistical calcula-
tions. For example, if you are estimating an equation, EViews will use the set of observa-
tions in the sample that have no missing values for the dependent and all of the
independent variables.
There are, however, a few cases where you will need to work with NAs, so you should be
aware of some of the underlying issues in the handling of NAs.
First, when you perform operations using multiple series, there may be alternative
approaches for handling NAs. EViews will usually provide you with the option of casewise
exclusion (common sample) or listwise exclusion (individual sample). With casewise exclu-
sion, only those observations for which all of the series have non-missing data are used.
This rule is always used, for example, in equation estimation. For listwise exclusion, EViews
will use the maximum number of observations possible for each series, excluding observa-
tions separately for each series in the list of series. For example, when computing descrip-
tive statistics for a group of series, you have the option to use a different sample for each
series.
If you must work directly with NAs, just keep in mind that EViews NAs observe all of the
rules of IEEE NaNs. This means that performing mathematical operations on NAs will gen-
erate missing values. Thus, each of the following expressions will generate missing values:
@log(-abs(x))
1/(x-x)
(-abs(x))^(1/3)
3*x + NA
exp(x*NA)
For the most part, comparisons involving NA values propagate NA values. For example, the
commands:
series y = 3
140—Chapter 6. Working with Data
series x = NA
series equal = (y = x)
series greater = (y > x)
will create series EQUAL and GREATER that contain NA values, since the comparison
between observations in a series involving an NA yields an NA.
Note that this NA handling behavior differs from EViews 4 and earlier in which NAs were
treated as ordinary values for purposes of equality (“=”) and inequality (“<>”) testing. In
these versions of EViews, the comparison operators “=” and “<>” always returned a 0 or
a 1. The change in behavior was deemed necessary to support the use of string missing val-
ues. In all versions of EViews, comparisons involving ordering (“>”, “<”, “<=”, “>=”)
propagate NAs.
It is still possible to perform comparisons using the previous methods. One approach is to
use the special functions @eqna and @neqna for performing equality and strict inequality
comparisons without propagating NAs. For example, you may use the commands:
series equal1 = @eqna(x, y)
series nequal = @neqna(x, y)
so that NAs in either X or Y are treated as ordinary values for purposes of comparison.
Using these two functions, EQUAL1 will be filled with the value 0, and NEQUAL will be
filled with the value 1. Note that the @eqna and @neqna functions do not compare their
arguments to NA, but rather facilitate the comparison of values so that the results are guar-
anteed to be 0 or 1. See also “Version 4 Compatibility Mode” on page 123 of the Command
and Programming Reference for settings that enable the previous behavior for element com-
parisons in programs.
To test whether individual observations in a series are NAs, you may use the @isna func-
tion. For example,
series isnaval = @isna(x)
will fill the series ISNAVAL with the value 1, since each observation in X is an NA.
There is one special case where direct comparison involving NAs does not propagate NAs. If
you test equality or strict inequality against the literal NA value:
series equal2 = (x = NA)
series nequal2 = (y <> NA)
EViews will perform a special test against the NA value without propagating NA values.
Note that these commands are equivalent to the comparisons involving the special func-
tions:
series equal3 = @eqna(x, NA)
series nequal3 = @neqna(y, NA)
Series—141
will yield NAs. However, if the relational expression is used as part of a sample or IF-state-
ment, NA values are treated as FALSE.
smpl 1 1000 if x>y
smpl 1 1000 if x>y and not @isna(x) and not @isna(y)
are equivalent since the condition x>3 implicitly tests for NA values. One consequence of
this behavior is that:
smpl 1 1000 if x<NA
will result in a sample with no observations since less-than tests involving NAs yield NAs.
Very early versions of EViews followed the IEEE rules for missing data with one important
exception. In EViews 2 and earlier, multiplying any number by zero (including NAs) yielded
a zero. In subsequent versions, the value NA times zero equals NA. Thus, an earlier recom-
mended method of recoding (replacing) NA values in the series X no longer worked so that
the command for replacing NA values with the values in Y:
x = (x<>na)*x + (x=na)*y
works in EViews 2, but does not work subsequent versions. The @nan function has been
provided for this purpose.
x = @nan(x,y)
recodes NA values of X to take the values in the series Y. See “Operators” on page 384 of the
Command and Programming Reference.
Series
One of the primary uses of expressions is to generate new series from existing data or to
modify the values in an existing series. Used in combination with samples, expressions
allow you to perform sophisticated transformations of your data, saving the results in new
or existing series objects.
The current discussion focuses on the basic numeric series object. Users who wish to work
with alphanumeric or advanced series features should see Chapter 7. “Working with Data
(Advanced),” on page 155 and Chapter 8. “Series Links,” on page 183.
To create or modify a series, select Quick/Generate Series… or click on the Genr button on
the workfile toolbar. EViews opens a window prompting you for additional information.
142—Chapter 6. Working with Data
Basic Assignment
You can type the series name, followed by an
equal sign and then an expression. For every element of the sample, EViews will evaluate
the expression on the right-hand side of the equality, and assign the value to the destination
series on the left-hand side, creating the series if necessary.
will first create the Y series and fill it with NAs. Then, for every observation in the current
sample, EViews will fill each element of the Y series with the value of the expression. If Y
does exist, EViews will only replace Y values in the current sample with the value of the
expression. All observations not in the sample will be unchanged.
One special form of assignment occurs when the right-hand side of the assignment state-
ment is a constant expression:
y = 3
y = 37 * 2 + 3
EViews will simply assign the value of the constant to all of the observations in the sample.
Using Samples
By modifying the sample of observations used in assignment, you can splice together series
using multiple Genr commands. For example, if we enter three Genr commands with differ-
ent samples: first
Upper window: y = z
Lower window: @all if z<=1 and z>-1
and finally,
Upper window: y = -.9 + .1*z
Lower window: if z<=-1
we can generate Y as a piecewise linear function of the series Z. Note that the “@ALL” is
implicit in the latter two assignments.
While it is possible to perform these types of operations using loops and IF-statements (see
Chapter 6. “EViews Programming,” on page 105 of the Command and Programming Refer-
ence), we strongly urge you to use genr and sample statements where possible, since the
latter approach is much more efficient.
Dynamic Assignment
Since EViews evaluates the assignment expression for each observation in the sample, you
can perform dynamic assignment by using lagged values of the destination series on the
right side of the equality. For example, suppose we have an annual workfile that ranges
from 1945 to 1997. Then if we enter:
Upper window: y = y + y(-1)
Lower window: 1946 1997
EViews will replace the Y series with the cumulative sum of Y. We begin with 1946, since
we do not want to transform the first value in the workfile. Then for each period, EViews
will take the current value of Y and add it to the lagged value of Y. The assignment is
dynamic because as we successively move on to the next period, the lagged value of Y con-
tains the cumulative sum.
Note that this procedure destroys the original data. To create a new series with the cumula-
tive sums, you will have to perform the assignment in two steps, first making a copy of the
original series, and then performing the dynamic assignment.
Implicit Assignment
You can make an implicit assignment by putting a simple formula on the left-hand side of
the equal sign. EViews will examine your expression and select, as the destination series,
the first valid series name on the left-hand side of the equality. Then for every observation
in the sample, EViews will assign values using the implicit relationship. For example, if you
enter:
log(y) = x
EViews will treat Y as the destination series, and evaluate y=exp(x) for every observation
in the sample.
The following are examples of valid assignment statements where Y is the destination
series:
144—Chapter 6. Working with Data
1/y = z
log(y/x)/14.14 = z
log(@inv(y)*x) = z
2+y+3*z = 4*w
d(y) = nrnd
In general, EViews can solve for, or normalize, equations that use the following on the left-
hand side of the equality: +, –, *, /, ^, log(), exp(), sqr(), d(), dlog(), @inv().
Since Genr is not a general equation solver, there will be situations in which EViews cannot
normalize your equation. You cannot, for example, use the assignment statement:
@tdist(y, 3) = x
since @tdist is not one of the functions that EViews knows how to invert. Similarly,
EViews cannot solve for equations where the destination series appears more than once on
the left side of the equality. For example, EViews cannot solve the equation:
x + 1/x = 5
In both cases, EViews will display the error message “Unable to normalize equation”.
Note that the destination series can appear on both sides of the equality. For example:
log(x) = x
is a legal assignment statement. EViews will normalize the expression and perform the
assignment
x = exp(x)
so that X will be assigned the exponential of the original value of X. EViews will not solve
for the values of X satisfying the equality “LOG(X) = X”.
There are alternative forms for the assignment statement. First, if the series does not exist,
you must use either the series or the genr keyword, followed by the assignment expres-
sion. The two statements:
series y = exp(x)
genr y = exp(x)
are equivalent methods of generating the series Y. Once the series has been created, subse-
quent assignment statements do not require the series or the genr keyword:
smpl @all
series y = exp(x)
Auto-series—145
This set of commands first sets the series to equal EXP(X) for all observations, then assigns
the values Y/2 for the subset of observations from 1950 to 1990 if Y>300.
Auto-series
Another important method of working with expressions is to use an expression in place of a
series. EViews’ powerful tools for expression handling allow you to substitute expressions
virtually any place you would use a series—as a series object, as a group element, in equa-
tion specifications and estimation, and in models.
We term expressions that are used in place of series as auto-series, since the transformations
in the expressions are automatically calculated without an explicit assignment statement.
Auto-series are most useful when you wish to see the behavior of an expression involving
one ore more series, but do not want to keep the transformed series, or in cases where the
underlying series data change frequently. Since the auto-series expressions are automati-
cally recalculated whenever the underlying data change, they are never out-of-date.
See “Auto-Updating Series” on page 155 for a more advanced method of handling series and
expressions.
Creating Auto-series
It is easy to create and use an auto-series—anywhere you might use a series name, simply
enter an EViews expression. For example, suppose that you wish to plot the log of CP
against time for the period 1953M01 to 1958M12. There are two ways in which you might
plot these values.
One way to plot these values is to generate an ordinary series, as described earlier in “Basic
Assignment” on page 142, and then to plot its values. To generate an ordinary series con-
taining the log of CP, say with the name LOGCP, select Quick/Generate series... from the
main menu, and enter,
logcp = log(cp)
in the command window. EViews will evaluate the expression LOG(CP) for the current val-
ues of CP, and will place these values into the series LOGCP. To view a line graph view of
the series, open the series LOGCP and select View/Graph/Line.
146—Chapter 6. Working with Data
Note that the values of the ordinary series LOGCP will not change when CP is altered. If you
wish to update the values in LOGCP to reflect subsequent changes in CP, you will need to
issue another series or genr assignment statement.
Alternatively, you may create and use an auto-series by clicking on the Show button on the
toolbar, or selecting Quick/Show… and entering the command,
log(cp)
or by typing
show log(cp)
in the command window. EViews will open a series window in spreadsheet view:
Note that in place of an actual series name, EViews substitutes the expression used to create
the auto-series.
An auto-series may be treated as a standard series window so all of the series views and
procedures are immediately available. To display a time series graph of the LOG(CP) auto-
series, simply select View/Graph... from the series window toolbar and click OK to create a
line graph:
Auto-series—147
All of the standard series views and procedures are also accessible from the menus.
Note that if the data in the CP series are altered, the auto-series will reflect these changes.
Suppose, for example, that we take the first four years of the CP series, and multiply theme
by a factor of 10:
smpl 1953m01 1956m12
cp = cp*10
smpl 1953m01 1958m12
The auto-series graph will automatically change to reflect the new data:
148—Chapter 6. Working with Data
In contrast, the values of the ordinary series LOGCP are not affected by the changes in the
CP data.
will display the auto-series containing the geometric moving average. To view a line graph
of the auto-series, select View/Graph... from the series window toolbar and click OK:
Auto-series—149
Naming an Auto-series
The auto-series is deleted from your computer memory when you close the series window
containing the auto-series. For more permanent expression handling, you may convert the
auto-series into an auto-updating series that will be kept in the workfile, by assigning a
name to the auto-series.
Simply click on the Name button on the series toolbar, or select Object/Name... from the
main menu, and provide a name. EViews will create an auto-updating series with that name
in the workfile, and will assign the auto-series expression as the formula used in updating
the series. For additional details, see “Auto-Updating Series” on page 155.
you will create a group containing two series: the ordinary series CP, and the auto-series
representing the geometric moving average. We may then use the group object graphing
routines to compare the original series with the smoothed series. Select View/Graph... from
the group window toolbar and click OK:
Using Auto-Series in
Estimation
One method of using auto-
series in estimation is to
allow expressions as right-
hand side variables. Thus,
you could estimate an equa-
tion with log(x) or
exp(x+z) as an explanatory
variable.
create a new variable LOGY. Instead, you can use the expression log(y)as your dependent
variable.
When you forecast using an equation with an auto-series dependent variable, EViews will,
if possible, forecast the untransformed dependent variable and adjust the estimated confi-
dence interval accordingly. For example, if the dependent variable is specified as log(y),
EViews will allow you to forecast the level of Y, and will compute the asymmetric confi-
dence interval. See Chapter 22. “Forecasting from an Equation,” on page 731 of User’s Guide
II for additional details.
Groups
EViews provides specialized tools for working with groups of series that are held in the form
of a group object. In “Importing Data” on page 101, we used groups to import data from
spreadsheets into existing workfiles. Briefly, a group is a collection of one or more series
identifiers or expressions. Note that a group does not contain the data in the individual
series, only references to the data in the series.
To create a group, select Object/New Object.../Group and fill in the dialog with names of
series and auto-series. Or you may select Show from the workfile toolbar and fill out the
dialog. Alternatively, type the command group in the command window, followed by a
name to be given to the group and then the series and auto-series names:
group macrolist gdp invest cons
creates the group MACROLIST containing the series GDP, INVEST and CONS. Similarly,
group altlist log(gdp) d(invest) cons/price
creates the group ALTLIST containing the log of the series GDP, the first difference of the
series INVEST, and the CONS series divided by the PRICE series.
There are a few features of groups that are worth keeping in mind:
• A group is simply a list of series identifiers. It is not a copy of the data in the series.
Thus, if you change the data for one of the series in the group, you will see the
changes reflected in the group.
• If you delete a series from the workfile, the series identifier will be maintained in all
groups. If you view the group spreadsheet, you will see a phantom series containing
NA values. If you subsequently create or import the series, the series values will be
restored in all groups.
• Renaming a series changes the reference in every group containing the series, so that
the newly named series will still be a member of each group.
• There are many routines in EViews where you can use a group name in place of a list
of series. If you wish, for example, to use X1, X2, and X3 as right-hand side variables
Groups—151
in a regression, you can instead create a group containing the series, and use the
group in the regression.
To refer the n -th series in the group, simply append “( n )” to the group name. For example,
consider the MACROLIST group, defined above. The expression MACROLIST(1) may be
used to refer to GDP and MACROLIST(2) to refer to INVEST.
You can work with MACROLIST(1) as though it were any other series in EViews. You can
display the series by clicking on the Show button on the toolbar and entering MAC-
ROLIST(1). You can include GDP in another group directly or indirectly. A group which
contains:
macrolist(1) macrolist(2)
We can also use the individual group members as part of expressions in generating new
series:
series realgdp = macrolist(1)/price
series y = 2*log(macrolist(3))
Note that in this latter example the series keyword is required, despite the fact that the
INVEST series already exists. This is true whenever you access a series as a member of a
group.
Other tools allow you to retrieve the number of series in a group using the @count group
data member:
scalar numgroup = macrolist.@count
To retrieve the names of each of the series, you may use the group data member @serie-
sname. These tools are described in greater detail in “Group” on page 216 of the Command
and Programming Reference.
152—Chapter 6. Working with Data
There are also functions that will calculate the mean of a group’s rows (@rmean), their stan-
dard deviation (@rstdev) and variance (@rvar).
The @rvalcount function can be used to find how many times a specific value occurs
within the rows of a group. For example:
series numvals = @valcount(macrolist,5)
will create a series where each row of that series will be the count of how many of the series
within the MACROLIST group contain the value “5” for that particular row. Note that the
value argument for this function can be a scalar or a series.
A full list of the group row functions can be found in “Group Row Functions” on page 398
of the Command and Programming Reference.
will create a group, G1, with two series, the first series containing 1 where-ever union is
equal to “union” and zero elsewhere, the second series containing 1 where-ever union is
equal to “non-union” and zero elsewhere.
@expand may also be used on more than one series to give the cross-interaction of different
series. Thus if you have a second series called MARRIED that contains either “married” or
“single” then entering:
group g2 @expand(union,married)
will create a group, G2, with four series, the first containing 1 where-ever UNION is equal to
“union” and MARRIED is equal to “married”, the second series containing a 1 where-ever
UNION is equal to “union” and MARRIED is equal to “single”, and so on.
Groups—153
The @expand function can be used as part of a mathematical expression, so that a com-
mand of:
group g3 2*@expand(union)
will create a group where the first series contains a 2 where-ever UNION is equal to
“union”. Further,
group g4 log(income)*@expand(married)
creates a group where the first series is equal to the values of the log of INCOME where-ever
MARRIED is equal to “married” and so on.
The of the most useful applications of the @expand function is when specifying an equation
object, since it can be used to automatically create dummy variables.
See also “Automatic Categorical Dummy Variables” on page 648 of User’s Guide II for addi-
tional discussion.
An Illustration
Auto-series and group processing provides you with a powerful set of tools for working with
series data. As we saw above, auto-series provide you with dynamic updating of expres-
sions. If we use the auto-series expression:
log(y)
the result will be automatically updated whenever the contents of the series Y changes.
A potential drawback of using auto-series is that expressions may be quite lengthy. For
example, the two expressions:
log(gdp)/price + d(invest) * (cons + invest)
12345.6789 * 3.14159 / cons^2 + dlog(gdp)
are not suited to use as auto-series if they are to be used repeatedly in other expressions.
You can employ group access to make this style of working with data practical. First, create
groups containing the expressions:
group g1 log(gdp)/price+d(invest)*(cons+invest)
group g2 12345.6789*3.14159/cons^2+dlog(gdp)
If there are spaces in the expression, the entire contents should be enclosed in parentheses.
You can now refer to the auto-series as G1(1) and G2(1). You can go even further by com-
bining the two auto-series into a single group:
group myseries g1(1) g2(1)
and then referring to the series as MYSERIES(1) and MYSERIES(2). If you wish to skip the
intermediate step of defining the subgroups G1 and G2, make certain that there are no
154—Chapter 6. Working with Data
spaces in the subexpression or that it is enclosed in parentheses. For example, the two
expressions in the group ALTSERIES,
group altseries (log(gdp)/price) 3.141*cons/price
Scalars
Scalar objects are different from series and groups in that they hold a single number instead
of data for each observation in the sample. Scalars are created by commands of the form:
scalar scalar_name = number
where you assign a number to the scalar name. The number may be an expression or spe-
cial functions that return a scalar.
To examine the contents of a scalar, you may enter the command show, followed by the
name of the scalar. For example:
scalar logl1 = eq1.@logl
show logl1
stores the log likelihood value of the equation object named EQ1 in a scalar named LOGL1,
and displays the scalar window.
Chapter 7. Working with Data (Advanced)
In addition to the basic tools for working with numeric data outlined in Chapter 6.
“Working with Data,” EViews provides additional tools and objects for more advanced
data handling, or for working with different kinds of data.
Auto-Updating Series
One of the most powerful features of EViews is the ability to use a series expression in
place of an existing series. These expressions generate auto-series in which the expres-
sion is calculated when in use, and automatically recalculated whenever the underly-
ing data change, so that the values are never out of date.
Auto-series are designed to be discarded after use. The resulting downside to auto-
series is that they are quite transitory. You must, for example, enter the expression
wherever it is used; for example, you must type “LOG(X)” every time you wish to use
an auto-series for the logarithm of X. For a single use of a simple expression, this
requirement may not be onerous, but for more complicated expressions used in multi-
ple settings, repeatedly entering the expression quickly becomes tedious.
For more permanent series expression handling, EViews provides you with the ability
to define a series or alpha object that uses a formula. The resulting auto-updating
series is simply an EViews numeric series or alpha series that is defined, not by the
values currently in the object, but rather by an expression that is used to compute the
values. In most respects, an auto-updating series may simply be thought of as a named
auto-series. Indeed, naming an auto-series is one way to create an auto-updating
series.
The formula used to define an auto-series may contain any of the standard EViews
series expressions, and may refer to series data in the current workfile page, or in
EViews databases on disk. It is worth emphasizing that in contrast with link objects,
which also provide dynamic updating capabilities, auto-updating series are designed to
work with data in a single workfile page.
Auto-updating series appear in the workfile with a modified version of the series or
alpha series icon, with the numeric series icon augmented by an “=” sign to show
that it depends upon a formula.
156—Chapter 7. Working with Data (Advanced)
If instead you select Formula, enter a valid series expression in the dialog box, and click on
OK, EViews will treat the series as an auto-updating series and will evaluate the expression,
putting the resulting values in the series. Auto-updating numeric series appear with a new
icon in the workfile—a slightly modified version of the standard series icon, featuring the
series line with an extra equal sign, all on an orange background.
Alternately, you may create an auto-updating series that links to a series in a database by
selecting Database link. In contrast to an auto-updating series based on a formula which
updates whenever the underlying data change, an auto-updating series based on a database
link will update only when the workfile is first loaded (you will be prompted for whether to
refresh the data series or not) or when you manually update the links by clicking on Object/
Auto-Updating Series—157
Manage Links & Formulae... in the workfile window, selecting Database links within
series & alphas and clicking on the Refresh Links - update data from source button. You
may also update the link by selecting Update from DB... in the series Object menu.
You may, at any time, change an auto-updating series into an standard numeric series by
bringing up the Values page of the Properties dialog, and clicking on the Numeric data set-
ting. EViews will define then define the series by its current values. In this way you may
freeze the formula series values at their existing values, a procedure that is equivalent to
performing a standard series assignment using the provided expression.
Note that once an expression is entered as a formula in a series, EViews will keep the defini-
tion even if you specify the series by value. Thus, you make take a series that has previously
been frozen, and return it to auto-updating by selecting Formula definition.
Issuing a Command
To create an auto-updating series using commands, you should use the formula keyword,
frml, followed by an assignment statement. The following example creates a series named
LOW that uses a formula to compute values. The auto-updating series takes the value 1 if
either INC is less than or equal to 5000 or EDU is less than 13, and takes the value 0 other-
wise:
frml low = inc<=5000 or edu<13
LOW is now an auto-updating series that will be reevaluated whenever INC or EDU change.
You may also define auto-updating alpha series using the frml keyword. If FIRST_NAME
and LAST_NAME are alpha series, then the declaration:
frml full_name = first_name + " " + last_name
The same syntax should be used when you wish to apply a formula to an existing series.
series z = rnd
frml z =(x+y)/2
makes Z an auto-updating series that contains the average of series X and Y. Note that the
previous values of Z are replaced, and obviously lost. Similarly, we may first define an
alpha series and then apply an updating formula:
alpha a = "initial value"
frml a = @upper(first_name)
You may not, however, apply an alpha series expression to a numeric series, or vice versa.
Given the series Z and A defined above, the following two statements:
frml z = @upper(first_name)
frml a = (x+y)/2
158—Chapter 7. Working with Data (Advanced)
Note that once a numeric series or alpha series is defined to be auto-updating, its values
may not be modified directly, since they are determined from the formula. Thus, if Z is an
auto-updating series, the assignment command:
z = log(x)
will generate an error since an auto-updating series may not be modified. To modify Z you
must either issue a new frml assignment or you must first set the values of Z to their cur-
rent values by turning off auto-updating, and then issue the assignment statement.
To turn off auto-updating for a series, you may use the special expression “@CLEAR” in
your frml assignment. When you turn off auto-updating, EViews freezes the numbers or
strings in the series at their current values. Once the series is set to current values, it is
treated as an ordinary series, and may be modified as desired. Thus, the commands:
frml z = @clear
z = log(x)
are allowed since Z is converted into an ordinary series prior to performing the series assign-
ment.
creates a series in the workfile called GDP that gets its values from the series GDP in the
database USDATA. Similarly:
Auto-Updating Series—159
creates an auto-updating series named LGDP that contains the log of the values of GDP in
the database USDATA.
Series that reference data in databases may be refreshed each time a workfile is loaded from
disk. Thus, it is possible to setup a workfile so that its data are current relative to a shared
database.
Naming an Auto-Series
If you have previously opened a window containing an ordinary auto-series, you may con-
vert the auto-series into an auto-updating series by assigning a name. To turn an auto-series
into an auto-updating series, simply click on the Name button on the toolbar, or select
Object/Name... from the main menu, and enter a name. EViews will assign the name to the
series object, and will apply the auto-series definition as the formula to use for auto-updat-
ing.
Suppose, for example, that you have opened a series window containing an auto-series for
the logarithm of the series CP by clicking on the Show button on the toolbar, or selecting
Quick/Show… and entering “LOG(CP)”. Then, simply click on the Name button in the
auto-series toolbar, and assign a name to the temporary object to create an auto-updating
series in the workfile.
Additional Issues
Auto-updating series are designed to calculate their values when in use, and automatically
update values whenever the underlying data change. An auto-updating series will assign a
value to every observation in the current workfile, irrespective of the current values of the
workfile sample.
In most cases, there is no ambiguity in this operation. For example, if we have an auto-
updating series containing the expression “LOG(CP)”, we simply take each observation on
CP in the workfile, evaluate the log of the value, and use this as the corresponding auto-
updating series value.
However, in cases where the auto-updating series contains an expression involving descrip-
tive statistics, there is ambiguity as to whether the sample used to calculate the values is the
sample at the time the auto-updating series was created, the sample at the time the series is
evaluated, the entire workfile range, or some other sample.
To resolve this ambiguity, EViews will enter the current workfile sample into the expression
at the time the auto-updating series is defined. Thus, if you enter “@MEAN(CP)” as your
auto-updating series expression, EViews will substitute an expression of the form
“@MEAN(CP, smpl)” into the definition. If you wish to evaluate the descriptive statistics for
a given sample, you should enter an explicit sample in your expression.
160—Chapter 7. Working with Data (Advanced)
Alpha Series
An alpha series object contains a set of observations on alphanumeric string values. Alpha
series should be used when you wish to work with variables that contain alphanumeric
data, such as names, addresses, and other text. If any of these types of data were entered
into an ordinary series, EViews will replace the string with the numeric missing value, NA.
Alternatively, you may type the keyword “ALPHA”, followed by an optional series name, in
the command window. The command:
alpha
will create a new untitled alpha series and will display the series in an object window. Like-
wise:
alpha myseries
Alpha Series—161
will create a new alpha series MYSERIES. To open the alpha series windows for MYSERIES
or SETSERIES, simply double-click on the corresponding alpha series icon in the workfile
window directory, or enter the command “SHOW MYSERIES”.
In both of the cases described above, the alpha series will be initialized to contain missing
values. For alpha series, the empty string (the null string, “”) is used to designate a missing
value. If you are declaring an alpha series using a command, you may combine the declara-
tion with the assignment of the values in the series. We explore alpha series assignment in
“Assigning values to Alpha Series” on page 162.
You should bear in mind that the strings in EViews alpha series are of fixed length so that
the size of each observation is equal to the length of the longest string. If you have a series
with all short strings with the exception of one very long string, the memory taken up by the
series will be the number of observations times the longest string. In settings of this sort,
efficiency suggests that you consider using value maps (“Value Maps” on page 169) to
encode the values of the long string.
Note that when editing the values of an alpha series, EViews does not require you to delimit
your strings. You may simply type the relevant value in the edit field. EViews will remove
any leading and trailing spaces from the value that you enter; if you wish to retain those
characters, enclose your string in double quotes. To enter the double quote character as a
part of your string, you should escape the character with another double quote so that you
enter two consecutive double quotes.
or
genr alpha_name = string_expr
first create the alpha series alpha_name and then will assign the values using string_expr. In
the latter command, EViews notes that the right-hand side expression is a string so that it
knows to create an alpha series.
Alpha Series—163
Alternatively, assuming that the alpha series exists, you may reassign the series values by
clicking on Quick/Generate Series... in the main menu and entering the assignment and
sample statements in the dialog. For example, if you enter the expression:
myalpha = string_expr
in the dialog, EViews will assign the values of the string_expr to the existing alpha series
MYALPHA. Alternatively, you may enter the expression in the command line. In both cases,
EViews will assign the corresponding values for all observations in the current workfile
sample, overwriting the existing values.
Suppose now that we wish to create an alpha series containing the name of each company
followed by its ticker symbol (enclosed in parentheses). A simple assignment statement gen-
erates the desired series:
alpha namesymb = name + " (" + symbol + ")"
164—Chapter 7. Working with Data (Advanced)
You may, however, use the string relational operators (see “String Relational Operators” on
page 67 of the Command and Programming Reference) to generate a series of numeric val-
ues. For the data from our Dow Jones example, the commands:
smpl @all
series wname = (@lower(@left(NAME, 1)) = "w")
generate the numeric series WNAME containing the value 1 if the company name begins
with the letter “W”, and 0 otherwise.
Similarly, the relational operators may be used when specifying a subsample. The com-
mand:
smpl @all if gender = "Male"
will restrict the workfile sample to include only observations where the string value in the
alpha series GENDER is “Male”.
You may also use the various functions described in “String Information Functions” on
page 70 of the Command and Programming Reference to generate numeric values.
Alpha Series—165
Two examples are of particular importance. First, you may have an alpha series that con-
tains string representations of numbers, such as “3.14159”. In order to use the strings as
actual numbers, you must translate them into numbers, using either the string evaluation
function @val.
converts the leading four characters of the CHANGE series into numeric values, and places
the results in the series CHGVAL.
The newly created series DVAL will contain date numbers associated with each of the string
values in DATES.
166—Chapter 7. Working with Data (Advanced)
Additional Issues
The Spreadsheet View
By default, the alpha series spreadsheet will display your data left-justified, with a column
width of approximately 12 characters. You may change the justification and column width
settings by clicking on the Properties button in the toolbar, then selecting a new justifica-
tion setting and entering a new column width. Alternatively, the column width may be
changed by dragging the separator in the column header to the desired position, or by dou-
ble-clicking on the separator to adjust the column width to the minimum width that displays
all of the observation values without truncation.
Auto-series
You should note that like ordinary series, you may also work directly with a series expres-
sion that produces an alpha series. For example, if ALPHA1 is an alpha series, the com-
mand:
show @lower(alpha1)
will result in an alpha series containing the contents of ALPHA1 with the text converted to
all lowercase characters.
Auto-series expressions involving alpha series may also evaluate to ordinary series. For
example, if NUMER1 is a numeric series and ALPHA1 is an alpha series, you may enter:
show numer1+@len(alpha1)+(alpha1>"cat")
to open a series window containing the results of the operation. Note that the parentheses
around the relational comparison are required for correct parsing of the expression.
Date Series
A date series is a standard EViews numeric series that contains valid date values (see
“Dates” on page 82 of the Command and Programming Reference). There is nothing that dis-
tinguishes a date series from any other numeric series, except for the fact that the values it
contains may be interpreted as dates.
EViews will display a dialog prompting you to change the display properties of the series.
While you may change a variety of display settings such as the column width, justification,
and indentation, here, for the moment, we are more interested in setting the properties of
the Numeric Display.
For a date series, there are four settings of interest in the Numeric Display combo box
(Period, Day, Day-Time, and Time), with each corresponding to specific information that
we wish to display in the series spreadsheet. For example, the Day selection allows you to
display date information up to the day in various formats; with year, month, and day all
included in the representation.
its of the year (if the selected format is “YYYY[Q]Q”, the actual format used will be
“YY[Q]Q”); if you select Day/month order, days will precede months in whichever format
is selected (if you select “mm/dd/YYYY” as the format for a day display, EViews will use
“dd/mm/YYYY”).
Applying this format to the QDATES series, the display changes to show the data in the new
format:
If instead we select the Day display, and choose the “YYYY-MM-DD” format, the QDATES
spreadsheet will show:
There is one essential fact to remember about the QDATES series. Despite the fact that we
have changed the display to show a text representation of the date, QDATES still contains
the underlying numeric date values. This is in contrast to using an alpha series to hold a text
representation of the date.
Value Maps—169
If you wish to convert a (numeric) date series into an alpha series, you will need to use the
@datestr function. If you wish to convert an alpha series into a numeric date series, you
will need to use the @dateval function. See “Translating between Date Strings and Date
Numbers” on page 88 of the Command and Programming Reference for details.
Note, however, that if we were to enter the same string value in the series when the display
is set to show numeric values, EViews will not attempt to interpret the string and will enter
an NA in the series.
Value Maps
You may use the valmap object to create a value map (or map, for short) that assigns
descriptive labels to values in numeric or alpha series. The practice of mapping observation
values to labels allows you to hold your data in encoded or abbreviated form, while display-
ing the results using easy-to-interpret labels.
170—Chapter 7. Working with Data (Advanced)
On the other hand, numeric encoding of categorical data has the disadvantage that one must
always translate from the numeric values to the underlying categorical data types. For
example, a one-way tabulation of the FEMALE data produces the output:
Cumulative Cumulative
Value Count Percent Count P ercent
0 3 50.00 3 50.00
1 3 50.00 6 100.00
Total 6 100.00 6 100.00
Interpretation of this output requires that the viewer remember that the FEMALE series is
encoded so that the “0” value represents “Male” and the “1” represents “Female”. The
example above would be easier to interpret if the first column showed the text representa-
tions of the categories in place of the numeric values.
Valmaps allow us to combine the benefits of descriptive text data values with the ease of
working with a numeric encoding of the data. In cases where we define value maps for
alphanumeric data, the associations allow us to use space saving abbreviations for the
underlying data along with more descriptive labels to be used in presenting output.
Value Maps—171
Defining a Valmap
To create a valmap object, select
Object/New Object.../ValMap from
the main menu and optionally enter
an object name, or enter the keyword
“VALMAP” in the command line, fol-
lowed by an optional name. EViews
will open a valmap object.
The two special entries above the double line should be used to define mappings for blank
strings and numeric missing values. The default mapping is to represent blank strings as
themselves, and to represent numeric missing values with the text “NA”. You may change
these defaults by entering the appropriate text in the Label column. For example, to change
the representation of missing numeric values to, say, a period, simply type the “.” character
in the appropriate cell.
We caution that when working with maps, EViews will look for exact equality between the
value in a series and the value in the valmap. Such an equality comparison is subject to the
usual issues associated with comparing floating point numbers. To mitigate these issues and
to facilitate mapping large numbers of values, EViews allows you to define value maps
using intervals.
in our example, “[–inf, 0)”, is mathematically incorrect since the lower bound should not be
closed, but EViews allows the closed interval syntax in this case since there is no possibility
of confusion.
Once you have defined your mappings, click on the Update button on the toolbar to validate
the object. EViews will examine your valmap and will remove entries with values that are
exact duplicates. In this example, the last entry, which maps the string “0” to the value
“New Zero” will be removed since it conflicts with the first line. The second entry will be
Value Maps—173
retained since it is not an exact duplicate of any other entry. It will, however, be interpreted
only as a string since the numeric interpretation would lead to multiple mappings for the
value 0.
EViews will validate the entry and apply the specified map to the series. Note that to be
valid, the valmap must exist in the same workfile page as the series to which it is assigned.
the ordering of the entries “9” and “10” depends upon whether we are interpreting the sort
as a numeric sort, or as a text sort. Selecting Value - Numeric tells EViews that, where pos-
sible, you wish to interpret strings as numbers when performing comparisons (so that “9” is
less than “10”); selecting Value - Text says that all values should be treated as text for pur-
poses of comparison (so that “10” is less than “9”).
When applied to an ordinary numeric series, our FEMALEMAP example contains three rele-
vant definitions that provide labels for the values 0, 1, and NA. Here, EViews reports that
the numeric value mapping is one-to-one since there are no two values that produce the
same value label.
The output also reports that the FEMALEMAP has three relevant definitions for mapping the
three text values, “0”, “1”, and the blank string, into three unique labels. We see that the
text interpreted maps are also one-to-one.
Note that in settings where we map an interval into a given label, or where a given text label
is repeated for multiple values, EViews will report a many-to-one mapping. Knowing that a
valmap is many-to-one is important since it implies that the values of the underlying source
series are not uniquely identified by the label values. This lack of identification has impor-
tant implications in editing mapped series and in interpreting the results from various statis-
Value Maps—175
tical output (see “Editing a Mapped Series” on page 176 and “Valmap Definition Cautions”
on page 180).
If your mapped series is displayed in its original form using the Raw Data setting, EViews
will interpret any input as representing the underlying series values, and will place the input
directly into the series. For example, if our FEMALE series is displayed using the Raw Data
setting, any numeric input will be entered directly in the series, and any string input will be
interpreted as an NA value.
In contrast, if the series is displayed using the Default setting, EViews will use the attached
valmap both in displaying the labeled values and in interpreting any input. In this setting,
EViews will first examine the attached valmap to determine whether the given input value
is also a label in the valmap. If a matching entry is found, and the label matches a unique
Value Maps—177
underlying value, EViews will put the value in the series. If there is no matching valmap
label entry, or if there is an entry but the corresponding value is ambiguous, EViews will put
the input value directly into the series. One implication of this behavior is that so long as the
underlying values are not themselves valmap labels, you may enter data in either mapped
or unmapped form. Note, again, that text value and label matching is case-sensitive.
Alternatively, we could have directly entered the “1” corresponding to the underlying
numeric value. Since “1” is not a valmap label, EViews will put the value 1 in the series,
which will be displayed using the label “Female”.
While quite useful, entering data in mapped display mode requires some care, as your
results may be somewhat unexpected. For one, you should bear in mind that the required
reverse lookup of values associated with a given input requires an exact match of the input
to a label value, and a one-to-one correspondence between the given label and a valmap
value. If this condition is not met, the original input value will be placed in the series.
Consider, for example, the result of entering the string “female” instead of “Female”. In this
case, there is no matching valmap label entry, so EViews will put the input value, “female”,
into the series. Since FEMALE is a numeric series, the resulting value will be an NA, and the
display will show the mapped value for numeric missing values.
Similarly, suppose you enter “3” into the last observation of the FEMALE series. Again,
EViews does not find a corresponding valmap label entry, so the input is entered directly
into the series. In this case, the input represents a valid number so that the resulting value
will be a 3. Since there is no valmap entry for this value, the underlying value will be dis-
played.
Lastly, note that if the matching valmap label corresponds to multiple underlying values,
EViews will be unable to perform the reverse lookup. If, for example, we modify our valmap
so that the interval “[1, 10]” (instead of just the value 1) maps to the label “Female”, then
178—Chapter 7. Working with Data (Advanced)
when you enter “Female” as your input, it is impossible to determine a unique value for the
series. In this case, EViews will enter the original input, “Female”, directly into the series,
resulting in an NA value.
See “Valmap Definition Cautions” on page 180 for additional cautionary notes.
In appropriate settings (where the series values are treated as categories), EViews routines
will use the labels when displaying output. For example, a one-way frequency tabulation of
the FEMALE series with the assigned FEMALEMAP yields:
Cumulative Cumulative
Value Count Percent Count P ercent
Female 3 50.00 3 50.00
Male 3 50.00 6 100.00
Total 6 100.00 6 100.00
Similarly, when computing descriptive statistics for the SALES data categorized by the val-
ues of the FEMALE series, we have:
Valmap Functions
To facilitate working with valmaps, three new genr functions are provided which allow you
to translate between unmapped and mapped values. These functions may be used as part of
standard series or alpha expressions.
First, to obtain the mapped values corresponding to a set of numbers or strings, you may
use the command:
@map(arg[, map_name])
where arg is a numeric or string series expression or literal, and the optional map_name is
the name of a valmap object. If map_name is not provided, EViews will attempt to deter-
mine the map by inspecting arg. This attempt will succeed only if arg is a numeric series or
alpha series that has previously been mapped.
Let us consider our original example where the FEMALEMAP maps 0 to “Male” and 1 to
“Female”. Suppose that we have two series that contain the values 0 and 1. The first series,
MAPPEDSER, has previously applied the FEMALEMAP, while the latter series, UNMAPPED-
SER, has not.
are equivalent. Both return the labels associated with the numeric values in the series. The
first command uses the assigned valmap to determine the mapped values, while the second
uses FEMALEMAP explicitly.
will generate an error since there is no valmap assigned to the series. To use @map in this
context, you must provide the name of a valmap, as in:
alpha s4 = @map(unmappedser, femalemap)
which will return the mapped values of UNMAPPEDSER, using the valmap FEMALEMAP.
Conversely, you may obtain the numeric values associated with a set of string value labels
using the @unmap function. The @unmap function takes the general form:
@unmap(arg, map_name)
to return the numeric values that have been mapped into the string given in the string
expression or literal arg, where map_name is the name of a valmap object. Note that if a
given label is associated with multiple numeric values, the missing value NA will be
returned. Note that the map_name argument is required with the @unmap function.
180—Chapter 7. Working with Data (Advanced)
Suppose, for example, that you have an alpha series STATEAB that contains state abbrevia-
tions (“AK”, “AL”, etc.) and a valmap STATEMAP that maps numbers to the abbreviations.
Then:
series statecode = @unmap(stateab, statemap)
will contain the numeric values associated with each value of STATEAB.
Similarly, you may obtain the string values associated with a set of string value labels using:
@unmaptxt(arg, map_name)
where arg is a string expression or literal, and map_name is the name of a valmap object.
@unmaptxt will return the underlying string values that are mapped into the string labels
provided in arg. If a given label is associated with multiple values, the missing blank string
“” will be returned.
Many-to-one Valmaps
A many-to-one valmap is a useful tool for creating labels that divide series values into broad
categories. For example, you may assign the label “High” to a range of values, and the label
“Low” to a different range of values so that you may, when displaying the series labels, eas-
ily view the classification of an observation.
The downside to many-to-one valmaps is that they make interpreting some types of output
considerably more difficult. Suppose, for example, that we construct a valmap in which sev-
eral values are mapped to the label “Female”. If we then display a one-way frequency table
for a series that uses the valmap, the label “Female” may appear as multiple entries. Such a
table is almost impossible to interpret since there is no way to distinguish between the vari-
ous “Female” values.
A series with an attached many-to-one valmap is also more difficult to edit when viewing
labels since EViews may be unable to identify a unique value corresponding to a given
label. In these cases, EViews will assign a missing value to the series, which may lead to
confusion (see “Editing a Mapped Series” on page 176).
first maps the value 6 to the label “six”, and the second maps the value “six” to the label
“high”.
Now consider editing an alpha series that has this valmap attached. If we use the Default
display, EViews will show the labeled values. Thus, the underlying value “six” will display
as the value “high”; while the value “6” will display as “six”. Since the string “six” is used
both as a label and as a value, in this setting we have the odd result that it must be entered
indirectly. Thus, to enter the string “six” in the alpha series, we have the counterintuitive
result that you must type “high” instead of “six”, since entering the latter value will put “6”
in the series.
Note, however, that if you display the series in Raw Data form, all data entry is direct;
entering “six” will put the value “six” into the series and entering “high” will put the value
“high” in the series.
The series link object (or link, for short) provides you with powerful tools for combining
information from different workfile pages. Links provide an easy-to-use interface to a wide
range of sophisticated data operations such as:
• merging data from one workfile page into another
• saving “by-group” summary statistics into a workfile page
• matching observations between dated workfile pages
• performing frequency conversion between regular dated workfile pages
Links operate both dynamically and on demand, so that the desired operation is performed
only when needed, and is updated automatically whenever your data change.
You may find that working with links is in many ways similar to working with data tables in
a relational database management system. Indeed, links have specifically been designed to
provide much of the power of these sophisticated systems. But you need not have worked
with such a system to take advantage of the power, ease-of-use, and flexibility associated
with link objects.
We begin with a discussion of basic link concepts that outlines the basic operations sup-
ported by links. In later sections we document the use of links in EViews.
The basic series link employs a method called match merging to determine the link values in
the destination page. More advanced links combine match merging with automatic fre-
quency conversion. We describe these two methods in detail below, in “Linking by general
match merging” on page 184 and “Linking by date with frequency conversion” on page 193.
As the name suggests, the series link object shares most of the properties of a series. You
may, in fact, generally use a series link as though it were a series. You may examine series
views, perform series procedures, or use the series link to generate new data, or you may
use the link as a regressor in an equation specification.
Another important property of links is that they are “live”, in the sense that the values in the
link change as its underlying data change. Thus, if you have a link in a given workfile page,
the link values will automatically be updated when the source series or ID series values
change.
Lastly, links are memory efficient. Since links are computed and updated as needed, the val-
ues of the series link are not held in memory unless they are in use. Thus, it is possible to
create a page populated entirely by links that takes up only the minimum amount of mem-
ory required to perform all necessary operations.
The basic link first compares values for one or more source ID series with the values in the
destination ID series. Observations in the two pages are said to match if they have identical
ID values. When matches are observed, values from the source series are used to construct
values of the link for the corresponding observations in the destination page.
Each link contains a description of how the source series should be used to construct link
values in the destination page. Constructing values for a basic match merge link involves
two steps:
• First, we perform a contraction of the source series to ensure that there is a single
value associated with each distinct source ID value. The contraction method
employed describes how the (possibly) multiple source series observations sharing a
given ID value should be translated into a single value.
• Next, we take the distinct source IDs and contracted source series values, and per-
form a match merge in which each contracted value is repeated for all matching
observations in the destination page.
Basic Link Concepts—185
This basic method is designed to handle the most general cases involving many-to-many
match merging by first computing a many-to-one contraction (by-group summary) of the
source series, and then performing a one-to-many match merge of the contracted data.
All other match merges are handled as special cases of this general method. For a many-to-
one match merge, we first compute the contraction, then perform one-to-one matching of
the contracted data into the destination page. In the more common one-to-many or one-to-
one match merge, the contraction step typically has no practical effect since the standard
contractions simply return the original source series values. The original values are then
linked into the destination page using a simple one-to-one or one-to-many match merge.
While all of this may seem a bit abstract, a few simple examples should help to fix ideas.
Suppose first that we have a state workfile page containing four observations on the series
STATE1 and TAXRATE:
State1 TaxRate
Arkansas .030
California .050
Texas .035
Wyoming .012
In the same workfile, we have a second workfile page containing individual level data, with
a name, NAME, state of residence, STATE2, and SALES volume for six individuals:
We wish to link the data between the two pages. Note that in this example, we have given
the state series different names in the two pages to distinguish between the two. In practice
there is no reason for the names to differ, and in most cases, the names will be the same.
rate. George, for example, who lives in Arkansas, will face that state’s tax rate of 0.030. Sim-
ilarly, Mark, who lives in Texas, has a tax rate of 0.035.
We will use a series link to perform a one-to-many match merge in which we assign the
TAXRATE values in our source page to multiple individuals in our destination page.
This latter merge rule is always used for basic links involving one-to-many match merges.
Here, the rule leads to the natural result that each individual is assigned the TAXRATE value
associated with his or her state.
After performing the link, the individual page will contain the merged values for the tax rate
in TAXRATE2. We use the “2” in the TAXRATE2 name to denote the fact that these data are
generated by merging data using STATE2 as the destination ID series:
We mention one other issue in passing that will become relevant in later discussion. Recall
that all basic links with match merging first contract the source series prior to performing
the match merge. In this case, the specified merge rule implicitly defines a contraction of the
source series TAXRATE that has no effect since it returns the original values of TAXRATE. It
is possible, though generally not desirable, to define a contraction rule which will yield
alternate source values in a one-to-many match merge. See “Link calculation settings” on
page 199.
merge, since there are many observations with STATE2 ID values in the individual page for
each of the unique values of STATE1 in the state page.
Specifying the last component, the merge rule, is a bit more involved here since there are an
unlimited number of ways that we may contract the individual data. EViews provides an
extensive menu of contraction methods. Obvious choices include computing the mean, vari-
ance, sum, minimum, maximum, or number of observations for each source ID value. It is
worth noting here that only a subset of the contraction methods are available if the source is
an alpha series.
To continue with our example, suppose that we choose to take the sum of observations as
our contraction method. Then contraction involves computing the sum of the individual
observations in each state; the summary value for SALES in Arkansas is 520, the value in
California is 950, and the value in Texas is 290. Wyoming is not represented in the individ-
ual data, so the corresponding contracted value is NA.
Given this link definition, the many-to-one match merge will result in a state page contain-
ing the match merged summed values for SALES1:
Similarly, we may define a second link to the SALES data containing an alternative contrac-
tion method, say the count of non-missing observations in each state. The resulting link,
SALES1CT, shows that there are two individual observations for each of the first three
states, and none for Wyoming.
Linking the SALES data from the individual page to the panel page using the STATE2 and
STATE3 identifiers involves a many-to-many match merge since there are multiple observa-
tions for each state in both pages.
This merge rule states that we perform a many-to-many merge by first contracting the
source series, and then performing a one-to-many match merge of the contracted results
into the destination. For example, linking the SALES data from the individual page into the
panel state-year page using the sum and count contraction methods yields the link series
SALES3 and SALES3A:
It is worth noting that this many-to-many match merge is equivalent to first performing a
many-to-one link from the individual page into the state page, and then constructing a one-
to-many link of those linked values into the panel page. This two-step method may be
Basic Link Concepts—189
achieved by first performing the many-to-one link into the state page, and then performing a
one-to-many link of the SALES1 and SALES1CT links into the panel page.
The latter example is of note since it points to the fact that dates may be used as valid link
identifiers. The use of dates as identifiers requires special discussion, as the notion of a
match may be extended to take account of the calendar.
We begin our discussion of merging using dates by noting that a date may be employed as
an identifier in two distinct ways:
• First, an ID series containing date values or alphanumeric representations of dates
may be treated like any other ID series. In this case, the value in one workfile page
must be identical to the value in the other page for a match to exist.
• Alternatively, when we are working with regular frequency data, we may take advan-
tage of our knowledge of the frequency and the calender to define a broader notion of
date matching. This broader form of matching, which we term date matching,
involves comparing dates by first rounding the date ID values down to the lowest
common regular frequency and then comparing the rounded values. Note that date
matching requires the presence of at least one regular frequency for the rounding pro-
cedure to be well-defined.
In practical terms, date matching produces the outcomes that one would naturally expect.
With date matching, for example, the quarterly observation “2002Q1” matches “2002” in a
regular annual workfile, since we round the quarterly observation down to the annual fre-
quency, and then match the rounded values. Likewise, we would match the date “March 3,
2001” to the year 2001 in an annual workfile, and to “2001Q1” in a quarterly workfile. Sim-
ilarly, the date “July 10, 2001” also matches 2001 in the annual workfile, but matches
“2001Q3” in the quarterly workfile.
Quarter Profit
2002Q1 120
190—Chapter 8. Series Links
2002Q2 130
2002Q3 150
2002Q4 105
2003Q1 100
2003Q2 125
2003Q3 200
2003Q4 170
while the second page contains irregular data on special advertising events (ADVERT):
Date Advert
Jan 7, 2002 10
Mar 10, 2002 50
Apr 9, 2002 40
May 12, 2002 90
Mar 1, 2003 70
Dec 7, 2003 30
Dec 23, 2003 20
We would like to link the quarterly profit data to the irregular data in the advertising page.
The quarterly values in the source page are unique so that we have a one-to-one or one-to-
many match merge; accordingly, we may select any contraction method that leaves the orig-
inal PROFIT data unchanged (mean, unique, etc.).
We first employ date matching by using the “@DATE” and “@DATE” keywords as our ID
series. This specification instructs EViews to use the knowledge about the date structures in
the page to perform a sophisticated matching across pages. Using this approach, we con-
struct a PROFIT1 link containing the values:
In evaluating the values in PROFIT1, we simply repeat the value of PROFIT for a given quar-
ter for every matching observation in the advertising page. Since we are using date match-
ing, we employ matching across pages that uses calendar knowledge to determine matches.
For example, the observation for quarter “2002Q1” matches both “Jan 7, 2002” and “Mar
10, 2002” in the advertising page so that the latter observations are assigned the value of
120.
Conversely, using date matching to link the ADVERT series to the quarterly page, we have a
many-to-one match merge since, after rounding down to the lower frequency, multiple
observations in the advertising page have “@DATE” values that match the unique
“@DATE” values in the quarterly page. If we choose to employ the mean contraction
method in the link ADVERT1, we have:
Here, the values of ADVERT1 contain the mean values over the observed days in the quar-
ter. For example, the value for ADVERT1 in 2002Q1 is taken by averaging the values of
ADVERT for “Jan 7, 2002” and “Mar 10, 2002”. Note that the value for quarter 2002Q3 is
NA since there are no observations with matching DATE values, i.e., there are no observa-
tions in the advertising page that fall within the quarter.
It is worth noting that in both of these examples, had we employed exact matching using by
specifying our ID series as QUARTER and DATE, we would have observed no matches since
the date numbers for the quarterly data do not match any of the irregular date numbers. As
a result, all of the values in the resulting link would be assigned the value NA.
An example will illustrate the issue. Consider the following simple panel featuring quarterly
revenue data from 2002Q1 to 2003Q4:
192—Chapter 8. Series Links
We will consider the results from linking the REVENUE data into an annual page using date
matching of the QUARTER and the YEAR identifiers. Using date match merging (with the
“@DATE” and “@DATE” keywords), and employing both the sum and number of observa-
tions contractions, we observe the results in REVENUE1 (sum) and REVENUE1A (obs):
The important thing to note here is that the sums for each year have been computed over all
eight matching observations in the panel page.
The key to understanding the result is to bear in mind that date matching only changes the
way that a match between observations in the two pages is defined; the remaining match
merge operation remains unchanged. The outcome is simply the result of applying standard
link behavior in which we first identify matches, compute a contraction over all matching
observations, and perform the one-to-one match merge.
An alternative approach to obtaining annual revenue values from the panel data would be
to first contract the panel data to a quarterly frequency by averaging across firms, and then
to convert the quarterly data to an annual frequency by summing over quarters. This
Basic Link Concepts—193
approach, which produces very different results from the first method, may be undertaken
in two steps: by first linking the quarterly panel data into a quarterly page (using the mean
contraction), and then frequency converting by linking the quarterly data to the annual fre-
quency (summing over quarters).
In cases where you are linking between two panel pages at different frequencies there are
yet more complication. See “Panel frequency conversion” on page 195 for a description of
the issues involved in constructing these types of links.
You can instruct EViews to use the source series default methods for converting between
frequencies, or you may use the link definition to specify the up and down conversion meth-
ods. Furthermore, the live nature of links means that changes in the source data will gener-
ate automatic updates of the frequency converted link values.
We divide our discussion of frequency conversion links into those that link data from high
to low frequency pages and those that link from low to high frequency pages.
Given the specialized nature of frequency conversion, links specified by date with frequency
conversion offer a subset of the ordinary link contraction methods. All of the standard high
to low frequency conversion methods (average, sum, first, last, maximum and minimum)
are supported, but the match merge methods which do not preserve levels, (such as the
sum-of-squares or the variance) are not included.
194—Chapter 8. Series Links
Frequency conversion links also allow you to disable conversions for partially observed
periods, so that a missing value for the source series in a given month generates a missing
value for the corresponding quarterly observation. This option is not available for basic
match merge links.
When linking using general date match merging, the frequency conversion implied by the
one-to-many match merge may only be performed by repeating the low frequency observa-
tion for every matching high frequency observation. Thus, in a one-to-many date match
merge, an annual observation is always repeated for each matching quarter, month, or day.
Suppose that, in addition to our regular frequency quarterly PROFIT workfile page (p. 189),
we have a regular frequency monthly page containing observations spanning the period
from August 2002 to March 2003. Linking the PROFIT data from the quarterly page into the
monthly page by date, with frequency conversion, requires that we specify an up-conver-
sion method. Here, we show results of a frequency conversion link using both the simple
constant-match average (PROFIT2) and quadratic-match average (PROFIT3) methods:
Note that the PROFIT2 values are the same as those obtained by linking using simple date
match merging, since the constant-match average method simply repeats the PROFIT obser-
vations for each matching month. Conversely, the PROFIT3 values are obtained using an
interpolation method that is only available for linking by date with frequency conversion.
Basic Link Concepts—195
In all three of these cases, all of the high-to-low conversion methods are supported, but low-
to-high frequency conversion only offers Constant-match average (repeating of the low fre-
quency observations).
Lastly, frequency conversion involving a panel page with more than one dimension or an
undated page will be performed using raw data copy unless you elect to employ general
match merging, as described in “Panel links with date matching” on page 191.
An example will illustrate the general approach. Suppose again that we are working with
the regular frequency, quarterly panel REVENUE data. For convenience, we repeat the data
here:
1 2003Q3 200
1 2003Q4 170
2 2002Q1 40
2 2002Q2 40
2 2002Q3 50
2 2002Q4 35
2 2003Q1 20
2 2003Q2 25
2 2003Q3 50
2 2003Q4 40
We now wish to use frequency conversion to link these data into an annual panel, using the
average frequency conversion method to go from high-to-low frequency. Then the panel-to-
panel frequency conversion will simply perform a frequency conversion for each firm.
Here we have performed an ID specific sum as our high-to-low conversion method. The
observation for FIRM 1 in YEAR 2002 in the annual page is simply the sum of the quarterly
data for that firm in 2002. Similarly, the value for FIRM 2 in 2003 is the sum of the four
quarterly values for FIRM 2 in 2003.
It is important to note that these results differ significantly from the results obtained by gen-
eral match merging using date processing of matches (with “@DATE” and “@DATE” as the
two identifiers). Using the latter approach, we would have obtained:
While these results may at first seem a bit odd, they simply follow the logic of the discus-
sion in “Panel links with date matching” on page 191. Note that our link which matches
dates between the two panel workfile pages is an example of a many-to-many match merge,
Creating a Link—197
since there are multiple IDs with the same dates in each page. Thus, we will first contract
across IDs to obtain a unique time series in the original frequency, then frequency convert,
then one-to-many match in the destination page. In this case, the initial contraction involves
summing over firms to obtain a quarterly time series, then frequency converting (summing)
to the destination frequency to obtain annual values for 2002 (670) and 2003 (730). The
final step match merges these converted values into the annual panel using a one-to-many
match merge rule.
Creating a Link
Links may be created interactively either by copying-and-pasting or drag-and-dropping a
series from the source to the destination page, or by issuing a link declaration in the destina-
tion page.
Alternately, you may right-click to select the source series, then drag-and-drop to the desti-
nation page. EViews will display the Paste Special dialog.
Destination name
The field in the upper left-hand
portion of the dialog should be
used for specifying the name of the
destination object. Here, we have
the default wildcard value of “*”
indicating that the series named
TAXRATE in the source page will
be used in the destination page.
We may modify the name by typ-
ing an explicit name such as
“NEWTAX”, or by entering an
198—Chapter 8. Series Links
expression containing the wildcard character. For example, if we wish to use the name
“NEWTAXRATE” in the destination page, we may enter “NEW*” in the edit field.
The wildcard processing is particularly useful if you are copying multiple series into a new
page since it facilitates batch renaming of series.
Destination type
Next, you will choose between pasting the series by value, or pasting the series as a link. If
you paste by value, EViews will create an ordinary series in the destination page, and will
fill it with the values from the link evaluation. If you paste your series as a link, EViews will
create an actual link object containing the desired specification. As you might expect, there
are significant differences between the two methods of copying your series.
In the first method, the link computations are performed immediately and the destination
series values are assigned at the time the series is created. This behavior follows the tradi-
tional model of match merging and frequency conversion in which the operation is per-
formed once to compute static values.
When you paste your series as a link, EViews defines a link object containing a specification
of the match merge or frequency conversion. At creation, the link object is not evaluated
and uses no memory. Then, whenever you access the values in the link series, EViews will
determine whether the object needs evaluation and if so, will allocate memory and perform
the link calculations.
With links, you gain the benefits of efficient memory use and dynamic updating of the val-
ues in the destination, at the cost of some speed since the link calculations may be per-
formed more than once. Along these lines, it is worth pointing out that links may be
converted into ordinary series at any time. Once a series is created, however, it may not be
converted back into a link.
Match ID information
First, you must specify the information that EViews will use to identify matches between
observations in the two pages.
In the Source ID and Destination ID edit fields, you will enter the names of one or more
source ID series and one or more destination ID series. The number and order of the names
in the two fields should match. Thus, if you wish to match both CXID1 and PERIOD1 in the
source page to CXID2 and PERIOD2 in the second page, you should enter the sets of names
in parallel. Here, we choose to match observations using the values of the STATE1 series in
the source page and the values of the STATE2 series in the destination page.
Creating a Link—199
Next, there is a checkbox labeled Treat NA as ID category for whether to use observations
which have NA values in the source and destination ID values. By default, observations are
ignored if there are NAs in the ID series; by selecting this option, you instruct EViews to
match observations with NA ID values from the source page to observations with NA ID val-
ues in the destination page.
First, you should specify a source series contraction method. As described in “Linking by
general match merging” on page 184, the first step in every match merge is to perform a
contraction to ensure uniqueness of the source values. Since contraction is always per-
formed, you should pay attention to your contraction method even when the source IDs are
unique, since some settings will not yield the original source data.
For links involving alpha series, you must select from a subset of the
numeric contractions: Unique values (default), No contractions
allowed, First, Last, Maximum, Minimum, Number of obs, Number of
NAs.
Most of these options are self-explanatory, though a few comments about the choice of
method may prove useful.
First, there are two options at the bottom of the list which deserve additional explanation.
The last choice, No contractions allowed, may be used to ensure that contractions are
never performed prior in the first step of a link match merge. The option is designed for
cases where you believe that your source ID values are unique, and wish the link to gener-
ate an error if they are not.
The Unique values option provides a less strict version of the No contractions allowed set-
ting, allowing for non-unique source ID values so long as any observations with matching
IDs share the same source series value. In this case, the contraction will simply identify the
unique source value associated with each unique source ID value. If there are observations
with a single ID that have more than one source series value, the link will generate an error.
To see the difference between the two settings, note that contracting the following SOURCE
and ID series
200—Chapter 8. Series Links
ID Source
1 80
1 80
1 80
2 100
2 100
generates an error with the Unique values setting, but not with the No contractions
allowed setting. Alternatively, the SOURCE and ID series
ID Source
1 80
1 80
1 50
2 100
2 100
Second, you should note that if you select First or Last, EViews will contract the source
series by selecting the first or last observation in each set of observations with repeated
source IDs. First or Last is defined here as depending on the order in which the observa-
tions appear in the original source workfile. Thus, selecting First means that the contracted
value for each source ID value will be taken from the first observation in the workfile with
that ID value.
Lastly, you should bear in mind that unless you select No contractions allowed or Unique
values, EViews will perform a first stage contraction of the data using the specified settings.
In cases where the source ID values are not unique, this contraction is a necessary step; in
cases where the source ID values are unique, the contraction is not necessary for the result-
ing one-to-one or one-to-many match merge, but is performed so that EViews can support
more complicated many-to-many merge operations.
For most of the choices, performing a contraction on the unique source data has no practical
effect on the outcome of a one-to-one or one-to-many match merge. For example, a choice
of any of the data preserving options: Mean, Median, Maximum, Minimum, Sum, First,
Last, Unique values, or No contractions allowed will create a link that performs the stan-
dard one-to-one or one-to-many match merge of the values of the original source series into
the destination page.
Creating a Link—201
On the other hand, selecting a contraction method that alters the source values will create a
link that performs a match merge of the summary values into the destination page. Thus,
selecting Sum of Squares, Variance (population), Std. Deviation (sample), Skewness,
Kurtosis, Quantile, Number of obs, or Number of NAs, will generate link values that differ
from those obtained in a traditional one-to-one or one-to-many match merge.
It is worth emphasizing that the default contraction setting, Mean, preserves values for data
with unique source IDs. Thus, unless you specifically set the contraction method to a non-
preserving method, a one-to-one or one-to-many match merge will link the original values
into the destination page. You may also ensure that EViews performs the traditional one-to-
one or one-to-many match merge by selecting any of the other value preserving transforma-
tion methods, or even better by selecting No contractions allowed or Unique values to val-
idate the IDs.
Finally, in the Source sample edit field, you should enter a description of the source sample
to be used when constructing link values. By default, the full sample keyword “@ALL” is
entered in the field so that EViews will use all of the observations in the source page.
When one or both of the pages follow a regular frequency, we may instruct EViews to
employ date matching. We may do so by using the special ID keyword “@DATE” as an ID
in the regular frequency page ID to indicate that we wish to use date matching with the
built-in date identifiers given by the structure of the page. In this case, we will use
“@DATE” as the ID for the regular frequency quarterly page, and match it against the val-
ues in the DT series in the destination page.
Creating a Link—203
By default, EViews will use the high to low and the low to high conversion methods speci-
fied in the original source series.
Note that the last conversion method, No down conversions, may be used to disallow
down frequency conversion of the data. This setting allows you to ensure that when evalu-
ated, the link involves same frequency (one-to-one) or low to high (one-to-many) frequency
conversion, otherwise the link evaluation will generate an error.
You may, at the command line, enter the keyword link followed by the name of a new link
object. EViews will create a new, incompletely specified, link object in the current (destina-
tion) workfile page. The destination page should be active when you enter the command.
You may modify a link specification, defining link IDs, as well as contraction and in some
cases, expansion methods using the linkto proc.
Consider our earlier example where we link the TAXRATE data from the state page to the
individual page. The following command creates a link object in the current workfile page:
link taxrate2
You may modify the TAXRATE2 link by providing a link definition using the linkto proce-
dure. The linkto keyword should be followed by the name of the source series and the
source and destination IDs, with the latter separated by @src and @dest keywords. For
example, if the link object TAXRATE2 exists in our individual page, the link proc:
taxrate2.linkto state::taxrate @src state1 @dest state2
instructs EViews to define the link TAXRATE2 so that it uses the TAXRATE series in the
source page named “STATE” as the source series, and matches the source page STATE1 val-
ues to the current page STATE2 values.
In the special case where there is only one ID series in each page, we may, without intro-
ducing ambiguity, omit the @src and @dest keywords. Here, we may shorten our link defi-
nition statement to:
taxrate2.linkto state::taxrate state1 state2
Lastly, we may combine these declaration and definition statements into one. The command
link taxrate2.linkto state::taxrate state1 state2
both creates a link object in the active workfile page and defines the source and link ID
series.
In this one-to-many example where we link state data to individuals, we need not consider
contraction methods as the default (mean) contraction method preserves the original data.
If you wish to disallow contractions, or to limit them to cases where the values of the source
data are unique, you may use contraction options as in:
link taxrate2.linkto(c=none) state::taxrate state1 state2
or
link taxrate2.linkto(c=unique) state::taxrate state1 state2
Conversely, linking the SALES data from the individual page to the state page yields a
many-to-one conversion in which the contraction method is important. In this setting, we
may optionally specify a contraction method so that when the state page is active, the state-
ment
206—Chapter 8. Series Links
links the SALES data from the “INDIV” source page, matching the source page STATE2 val-
ues to the current page STATE1 values, and contracting observations using the sum trans-
formation. If the contraction option is not provided, EViews will use the mean contraction
default.
In the special case where you wish to link your data using date matching, you must use the
special keyword @date as an ID series for the regular frequency page. For example, when
linking from our quarterly to our advertising page, we may specify:
link profit1.linkto quarterly::profit @date dt
to tell EViews to link the quarterly page PROFIT data, matching the built-in identifier for the
quarter with the date series DT in the destination advertising page.
As in the copy-and-paste interface, the presence of the special @date keyword tells EViews
that you wish to perform date matching using the date structure of the corresponding regu-
lar frequency page. If @date is not specified as an ID, EViews will employ a general match
merge using the specified identifiers.
When linking data between dated regular frequency workfile pages, the linkto proc will
perform a frequency conversion link between the two pages unless ID series are explicitly
provided, or a general match merge specific conversion method (such as variance or kurto-
sis) is specified. Thus, issuing the command
link profit2.linkto quarterly::profit
in an annual page, creates a frequency conversion link PROFIT2 using the PROFIT data
from the quarterly page. Since no conversion options are provided, EViews will use the
default frequency conversion method specified in the quarterly PROFIT series.
If ID series are provided, EViews will perform the link using general match merging. Thus,
the closely related command
link profit2a.linkto quarterly::profit @date @date
will produce a link named PROFIT2A that employs date match merging using the dates in
the workfile page structures. Since no conversion options are provided. EViews will use the
default match merge contraction method, taking means, to perform the conversion.
If no ID series are specified, but a match merge specific option is provided, “@DATE
@DATE” is appended to the ID list, and general match merging is assumed. Thus, the com-
mand
link profit2b.linkto(c=med) quarterly::profit
is equivalent to
link profit2b.linkto(c=med) quarterly::profit @date @date
Working with Links—207
since “c=med” is a match merge specific conversion option. This link is evaluated using
general match merging, with date matching.
For additional details see Link (p. 267) and linkto (p. 270) in the Command and Program-
ming Reference.
Links may be identified in the workfile directory by the presence of a pink series or alpha
series icon, or by an icon containing a “?”. If a link definition uses an ordinary source series,
it will appear in the workfile directory with a pink version of the series icon. If a link uses an
alpha source series, it will appear with a pink alpha series icon. In both cases, the link may
be used as though it were a series of the specified type.
If the link source series is not specified or if its type cannot be identified, the link icon will
feature a “?” indicating that the link is unavailable. Undefined links will be classified as
numeric series that generate NA values for every observation.
Using links
Links use virtually no memory until used. A link goes into use either when you are examin-
ing the contents of the link, when it is placed in a group which evaluates the link, or when
the link is used in a series expression. Once a link goes out of use, the memory for the link
is cleared and made available for other uses. In this way, links take up only the minimum
amount of memory required to perform a given operation.
When links are in use, any modification to the data underlying the link will lead to a reeval-
uation of the link values. If you modify either the source series, or the source or destination
ID series, EViews will automatically recompute the link values. In this way, you may use
the link to define an automatically updating match merge or frequency conversion.
up no memory. Links are placed in use either by opening the link window, by placing the
link in a group object, or by using the link in a series expression. Whenever the link comes
into use, or one of the link components is changed, the link is evaluated, and its values
updated as necessary.
Tabulation of TAXRATE2
Date: 07/25/06 Time: 17:51
Sample: 1 6
Included observations: 6
Number of categories: 3
Cumulative Cumulative
Value Count Percent Count Percent
0.0300 2 33.33 2 33.33
0.0350 2 33.33 4 66.67
0.0500 2 33.33 6 100.00
Total 6 100.00 6 100.00
If you then close the link window, EViews will examine any open windows or existing
group objects to see whether the link is still in use. If the link is no longer used, its contents
will be cleared and memory will be released. The next time you use the link, it will come
into use and will be reevaluated.
Similarly, you may use TAXRATE2 in any place that a series may be used. For example, we
may generate a new series, TAXPCT that contains the values of TAXRATE2 expressed in
percentage terms:
series taxpct = taxrate2 * 100
Working with Links—209
Assuming that TAXRATE2 is not currently in use, EViews will evaluate the link and assign
values to each observation, then will multiply each of these values by 100 and assign them
to TAXPCT. When the series assignment operation is completed, the values of TAXRATE2
will no longer be used, so that EViews will clear the link contents.
Modifying links
You may, at any time, modify the definition of a link by dialog or command.
To modify a link interactively, we must open the Link Spec dialog page. First open the
desired link by double clicking on the icon in the workfile directory. Then click on the Prop-
erties toolbar button, or select View/Properties... from the main menu to bring up the link
properties dialog. Lastly, select the Link Spec tab.
To modify the link using the dialog, simply alter any of the dialog settings. For example, we
may change the link contraction method from Mean to Minimum by changing the selection
in the Contraction method combo box, or we may change the source sample by entering a
new sample in the edit box. More fundamental changes in the link will result from changing
the source series or workfile page, or any of the match merge identifiers.
To modify a link by command, you may use the linkto proc. See “Creating a link by com-
mand” on page 204 for details. Issuing a linkto proc command for an existing link will
replace the existing values with the new specification.
Breaking links
The auto-updating feature is one of the most important characteristics of links. Given the
live nature of links, changes to either the source series, or the source or destination IDs will
lead EViews to recalculate the values of the link. Links may be used to create auto-updating
match merges or frequency conversion of series between workfile pages.
Suppose, for example, that while displaying the TAXRATE2 spreadsheet view, you elect to
edit the values in the individual STATE2 ID series. Changing Mark’s value for STATE2 from
“Texas” to “Arkansas” changes the values of an ID series used to compute the values in
TAXRATE2. EViews automatically recomputes TAXRATE2, changing the value for Mark
from 0.35 to 0.30, and updates the open spreadsheet view accordingly. Furthermore, any
future use of the TAXRATE2 link will use the updated values.
In some circumstances, you may wish to fix the values of the link so that future changes to
the source or ID series do not alter the existing values. There are two ways in which you
may achieve this result. First, you may simply generate a new series that contains the cur-
rent values of the link, as in:
series fixrate = taxrate2
The new ordinary series FIXRATE contains the current values of TAXRATE2. Furthermore,
FIXRATE remains unchanged in the face of changes in TAXRATE2. With this method, both
the original link series and a new series will be kept in the workfile.
The second method of fixing values is to convert the link into a series. We term this process
unlinking or breaking the link. In this case, the existing link is replaced by a series with the
same name, containing the values in the link at the time the link is broken.
Working with Links—211
First, we describe the fundamentals of structured workfiles. You will need to under-
stand the concepts underlying structured workfiles to work with irregular dated data,
data involving cross-section identifiers, or panel structures.
Next, we outline various workfile level tools for managing your data. Among other
things, we discuss the basics of resizing a workfile, saving a workfile to foreign for-
mats, subsetting a workfile, and rearranging the format of the data in your workfile.
Structuring a Workfile
You may, at any time, change the underlying structure of an existing workfile or work-
file page by applying structuring information. We call this process structuring a work-
file. There are four primary types of structuring information that you may provide:
• regular date descriptions.
• variables containing observation identifiers for dated data.
• variables containing observation identifiers for cross-section data.
• variables containing observation identifiers defining a panel data structure.
The ability to structure your data is an important feature, and we will explore struc-
tured workfiles at some length.
Unlike regular frequency data, Irregular frequency data do not arrive in a precisely reg-
ular pattern. An important example of irregular data is found in stock and bond prices,
214—Chapter 9. Advanced Workfiles
where the presence of missing days due to holidays and other market closures means that
the data do not follow a regular daily (7- or 5-day) frequency.
The most important characteristic of regular data is that there are no structural gaps in the
data—all observations in the specified frequency exist, even if there are missing values that
are not observed. Alternatively, irregular data allow for gaps between successive observa-
tions in the given regular frequency. This is a subtle distinction, but has important conse-
quences for lag processing.
The distinction is best illustrated by an example. Suppose that we are working with a daily
calendar and that we have two kinds of data: data on bond prices (BOND), and data on tem-
perature in Los Angeles in Farenheit (TEMP):
Notice that in this example, the bond price is not available on 12/21 and 12/25 (since the
market was closed), and that the temperature reading was not available on 12/23 (due to
equipment malfunction).
Typically, we would view the TEMP series as following a 7-day regular daily frequency with
a missing value for 12/23. The key feature of this interpretation is that the day 12/23 exists,
even though a temperature reading was not taken on that day. Most importantly, this inter-
pretation implies that the lagged value of TEMP on 12/24 (the previous day’s TEMP value)
is NA.
In contrast, most analysts would view BOND prices as following an irregular daily fre-
quency in which days involving market closures do not exist. Under this interpretation, we
would remove weekends and holidays from the calendar so that the bond data would be
given by:
The central point here is that lags are defined differently for regular and irregular data.
Given a regular daily frequency, the lagged value of BOND on 12/26 would be taken from
the previous day, 12/25, and would be NA. Given the irregular daily frequency, the lagged
value on 12/26 is taken from the previous observation, 12/24, and would be 102.78. In
defining an irregular calendar, we explicitly skip over the structural gaps created by market
closure.
You may always convert irregular frequency data into regular frequency data by adding any
observations required to fill out the relevant calendar. If, for example, you have 7-day irreg-
ular data, you may convert it to a regular frequency by adding observations with IDs that
correspond to any missing days.
Here we have an alphabetically ordered dataset with 50 observations on state tax rates. We
emphasize the point that these data are undated since the common YEAR of observation
does not aid in identifying the individual observations.
These cross-section data may be treated as an unstructured dataset using the default integer
identifiers 1 to 50. Alternatively, we may structure the data using the unique values in
STATE as identifiers. These state name IDs will then be used when referring to or labeling
observations. The advantages of using the state names as identifiers should be obvious—
comparing data for observation labeled “Arizona” and “Wyoming” is much easier than
comparing data for observations “3” and “50”.
One last comment about the ordering of observations in cross-section data. While we can
(and will) define the lag observation to be that “preceding” a given observation, such a def-
inition is sensitive to the arbitrary ordering of our data, and may not be meaningful. If, as in
our example, we order our states alphabetically, the first lag of “Arkansas” is taken from the
“Arizona” observation, while if we order our observations by population, the lag of “Arkan-
sas” will be the data for “Utah”.
216—Chapter 9. Advanced Workfiles
Panel Data
Some data involve observations that possess both cross-section (group) and within-cross-
section (cell) identifiers. We will term these to be panel data. Many of the previously
encountered data structures may be viewed as a trivial case of panel data involving a single
cross-section.
To extend our earlier example, suppose that instead of observing the cross-section state tax
data for a single year, we observe these rates for several years. We may then treat an obser-
vation on any single tax rate as having two identifiers: a single identifier for STATE (the
group ID), and an identifier for the YEAR (the cell ID). The data for two of our states, “Kan-
sas” and “Kentucky” might look like the following:
We emphasize again that identifiers must uniquely determine the observation. A corollary
of this requirement is that the cell IDs uniquely identify observations within a group. Note
that requiring cell IDs to be unique within a group does not imply that the cell IDs are
unique. In fact, cell ID values are usually repeated across groups; for example, a given
YEAR value appears in many states since the tax rates are generally observed in the same
years.
If we observe repeated values in the cell identifiers within any one group, we must either
use a different cell identifier, or we must redefine our notion of a group. Suppose, for exam-
ple, that Kansas changed its tax rate several times during 2002:
In this setting, YEAR would not be a valid cell ID for groups defined by STATE, since 2002
would be repeated for STATE=“Kansas”.
There are a couple of things we may do. First, we may simply choose a different cell identi-
fier. We could, for example, create a variable containing a default integer identifier running
within each cross-section. For example, the newly created variable CELL_ID1 is a valid cell
ID since it provides each “Kansas” and “Kentucky” observation with a unique (integer)
value.
Alternately, we may elect to subdivide our groups. We may, for example, choose to use both
STATE and YEAR as the group identifier. This specification defines a group for each unique
STATE and YEAR combination (e.g. — observations for which STATE=“Kansas” and
YEAR=“2002” would comprise a single group). Given this new group definition, we may
use either CELL_ID1 or CELL_ID2 as cell identifiers since they are both unique for each
STATE and YEAR group. Notice that CELL_ID2 could not have been used as a valid cell ID
for STATE groups since it does not uniquely identify observations within Kansas.
While it may at first appear to be innocuous, the choice between creating a new variable or
redefining your groups has important implications (especially for lag processing). Roughly
speaking, if you believe that observations within the original groups are closely “related”,
you should create a new cell ID; if you believe that the subdivision creates groups that are
more alike, then you should redefine your group IDs.
In our example, if you believe that the observations for “Kansas” in “2001” and “2002” are
both fundamentally “Kansas” observations, then you should specify a new cell ID. On the
other hand, if you believe that observations for “Kansas” in “2002” are very different from
“Kansas” in “2001”, you should subdivide the original “Kansas” group by using both STATE
and YEAR as the group ID.
The primary impact of this data arrangement is its effect on lag processing. There are two
fundamental principles of lag processing in panel data structures:
218—Chapter 9. Advanced Workfiles
• First, lags and leads do not cross group boundaries, so that they never use data from
a different group.
• Second, lags and leads taken within a cross-section are defined over the sorted values
of the cell ID. This implies that lags of an observation are always associated with
lower value of the cell ID, and leads always involve a higher value (the first lag obser-
vation has the next lowest value and the first lead has the next highest value).
Let us return to our original example with STATE as the group ID and YEAR as the cell ID,
and consider the values of TAXRATE, TAXRATE(-1), and TAXRATE(1). Applying the two
rules for panel lag processing, we have:
Note in particular, that the lags and leads of TAXRATE do not cross the group boundaries;
the value of TAXRATE(-1) for Kentucky in 2001 is an NA since the previous value is from
Kansas, and the value TAXRATE(1) for Kansas in 2003 is NA is the next value is from Ken-
tucky.
Next, consider an example where we have invalid IDs since there are duplicate YEAR values
for Kansas. Recall that there are two possible solutions to this problem: (1) creating a new
cell ID, or (2) redefining our groups. Here, we see why the choice between using a new cell
ID or subdividing groups has important implications for lag processing. First, we may sim-
ply create a new cell ID that enumerates the observations in each state (CELL_ID1). If we
use CELL_ID1 as the cell identifier, we have:
Note that the only observations for TAXRATE(-1) that are missing are those at the “seams”
joining the cross-sections.
Suppose instead that we elect to subdivide our STATE groupings by using both STATE and
YEAR to identify a cross-section, and we create CELL_ID2 which enumerates the observa-
tions in each cross-section. Thus, each group is representative of a unique STATE-YEAR
pair, and the cell ID indexes observations in a given STATE for a specific YEAR. The
TAXRATE(-1) values are given in:
Once again, the missing observations for TAXRATE(-1) are those that span cross-section
boundaries. Note however, that since the group boundaries are now defined by STATE and
YEAR, there are more seams and TAXRATE(-1) has additional missing values.
In this simple example, we see the difference between the alternate approaches for handling
duplicate IDs. Subdividing our groups creates additional groups, and additional seams
between those groups over which lags and leads are not processed. Accordingly, if you wish
your lags and leads to span all of the observations in the original groupings, you should cre-
ate a new cell ID to be used with the original group identifier.
IDs are defined by a variable like YEAR, we say we have an annual panel. Similarly, if the
cell IDs are quarterly or daily identifiers, we say we have a quarterly or daily panel.
Alternatively, an undated panel uses group specific default integers as cell IDs; by default
the cell IDs in each group are usually given by the default integers (1, 2, ...).
One can convert an irregular frequency panel into a regular frequency panel by adding
observations to remove gaps in the calendar for all cross-sections. Note that this procedure
is a form of internal balancing (see “Balanced vs. Unbalanced Panels” below) which uses
the calendar to determine which observations to add instead of using the set of cell IDs
found in the data.
See “Regular and Irregular Frequency Data” on page 213 for a general discussion of these
topics.
In the simplest form of balanced panel data, every cross-section follows the same regular
frequency, with the same start and end dates—for example, data with 10 cross-sections,
each with annual data from 1960 to 2002. Slightly more complex is the case where every
cross-section has an identical set of irregular cell IDs. In this case, we say that the panel is
balanced, but irregular.
We may balance a panel by adding observations to the unbalanced data. The procedure is
quite simple—for each cross-section or group, we add observations corresponding to cell
IDs that are not in the current group, but appear elsewhere in the data. By adding observa-
tions with these “missing” cell IDs, we ensure that all of the cross-sections have the same
set of cell IDs.
To complicate matters, we may partially balance a panel. There are three possible meth-
ods—we may choose to balance between the starts and ends, to balance the starts, or to bal-
ance the ends. In each of these methods, we perform the procedure for balancing data
described above, but with the set of relevant cell IDs obtained from a subset of the data.
Performing all three forms of partial balancing is the same as fully balancing the panel.
Balancing data between the starts and ends involves adding observations with cell IDs that
are not in the given group, but are both observed elsewhere in the data and lie between the
Structuring a Workfile—221
start and end cell ID of the given group. If, for example, the earliest cell ID for a given group
is “1985m01” and the latest ID is “1990m01”, the set of cell IDs to consider adding is taken
from the list of observed cell IDs that lie between these two dates. The effect of balancing
data between starts and ends is to create a panel that is internally balanced, that is, bal-
anced for observations with cell IDs ranging from the latest start cell ID to the earliest end
cell ID.
A simple example will better illustrate this concept. Suppose we begin with a two-group
panel dataset with the following data for the group ID (INDIV), and the cell ID (YEAR):
For convenience, we show the two groups side-by-side, instead of stacked. As depicted,
these data represent an unbalanced, irregular, annual frequency panel. The data are unbal-
anced since the set of observed YEAR identifiers are not common for the two individuals;
i.e. — “1985” appears for individual 1 (INDIV=“1”), but does not appear for individual 2
(INDIV=“2”). The data are also irregular since there are gaps in the yearly data for both
individuals.
To balance the data between starts and ends, we first consider the observations for individ-
ual 1. The earliest cell ID for this cross-section is “1985” and the latest is “1996”. Next, we
examine the remainder of the dataset to obtain the cell IDs that lie between these two val-
ues. This set of IDs is given by {“1987,” “1989,” “1992,” “1994”}. Since “1989” and “1992”
do not appear for individual 1, we add observations with these two IDs to that cross-section.
Likewise, for group 2, we obtain the cell IDs from the remaining data that lie between
“1987” and “2001”. This set is given by {“1993,” “1994,” “1995,” “1996”}. Since “1993,”
“1995,” and “1996” do not appear for individual 2, observations with these three cell IDs
will be added for individual 2.
The result of this internal balancing is an expanded, internally balanced panel dataset con-
taining:
1 *1989 2 1989
1 *1992 2 1992
1 1993 2 *1993
1 1994 2 1994
1 1995 2 *1995
1 1996 2 *1996
1 — 2 1997
1 — 2 2001
We have marked the five added observations with an asterisk, and arranged the data so that
the cell IDs line up where possible. Observations that are not present in the dataset are
marked as “—”. Notice that the effect of the internal balancing is to fill in the missing cell
IDs in the central portion of the data.
It is worth a digression to note here that an alternative form of internal balancing is to add
observations to remove all gaps in the calendar between the starts and ends. This method of
balancing, which converts the data from an irregular to a regular panel, uses the calendar to
determine which observations to add instead of using the set of observed cell IDs found. If
we are balancing the expanded dataset, we would add observations with the cell IDs for
missing years: {“1986,” “1988,” “1990,” “1991”} for individual 1, and {“1988,” “1990,”
“1991,” “1998,” “1999,” “2000”} for individual 2.
Lastly, we consider the effects of choosing to balance the starts or balance the ends of our
data. In the former case, we ensure that every cross-section adds observations correspond-
ing to observed cell IDs that come before the current starting cell ID. In this case, balancing
the starts means adding an observation with ID “1985” to group 2. Similarly, balancing the
ends ensures that we add, to every cross-section, observations corresponding to observed
cell IDs that follow the cross-section end cell ID. In this case, balancing the ends involves
adding observations with cell IDs “1997” and “2001” to group 1.
Nested Panels
While cell IDs must uniquely identify observations within a group, they typically contain
values that are repeated across groups. A nested panel data structure is one in which the cell
IDs are nested, so that they are unique both within and across groups. When cell IDs are
nested, they uniquely identify the individual observations in the dataset.
Consider, for example, the following nested panel data containing identifiers for both make
and model of automobile:
Make Model
Chevy Blazer
Structuring a Workfile—223
Chevy Corvette
Chevy Astro
Ford Explorer
Ford Focus
Ford Taurus
Ford Mustang
Chrysler Crossfire
Chrysler PT Cruiser
Chrysler Voyager
We may select MAKE as our group ID, and MODEL as our cell ID. MODEL is a valid cell ID
since it clearly satisfies the requirement that it uniquely identify the observations within
each group. MODEL is also nested within MAKE since each cell ID value appears in exactly
one group. Since there are no duplicate values of MODEL, it may be used to identify every
observation in the dataset.
There are a number of complications associated with working with nested panel data. At
present, EViews does not allow you to define a nested panel data structure.
“@LAST”. Alternatively, if we provide an ending date, and enter “@FIRST” in the Start
date field, EViews will automatically calculate the date associated with “@FIRST”.
One consequence of this behavior is that resizing a workfile is a particular form of restruc-
turing. To resize a workfile, simply call up the Workfile structure dialog, and change the
beginning or ending date.
be defined from Monday at 00:00:00 through Sunday at 23:59:59. One second after this end-
ing time, 24:00:00, refers to the following Monday at midnight and is the first second of the
next period.
Not only does specifying an end time of 24:00:00 extend into the next day by one second, it
will extend by an amount relative to the frequency being defined for the workfile. For
instance, given an hourly workfile, an end time of 24:00:00 would add an extra hour to each
day, since extending even a second into the next period adds a full interval.
In general, when specifying a range of time for observations, time can be looked at in terms
of intervals or in terms of single measurements. For example, the time period 9 a.m. to
12 p.m. can be considered to be three hourly intervals: 9 a.m. to 10 a.m., 10 a.m. to 11 a.m,
and 11 a.m. to 12 p.m. Alternately, it could be considered as four on-the-hour measure-
ments: the first at 9 a.m., the second at 10 a.m., the third at 11 a.m., and the fourth at
12 p.m. While the interval model may be more frequently used for continuous measure-
ments over time, it is really up to you to decide which model fits your data better.
In the first case, which defines three intervals from 9 a.m. to 12 p.m., you would specify
your workfile with a start time of 9 a.m. and an end time of 11 a.m. This may not seem intu-
itive, but remember that specifying an end time of 12 p.m. would add an additional hour,
defining the interval from 12 p.m. to 1 p.m. In fact, you could specify any end time from
11:00:00 to 11:59:59 for the third interval.
If we wish to look at our data in terms of four discrete hourly measurements, as in the sec-
ond case, we would specify our workfile with a start time of 9 a.m. and an end time of
12 p.m. Our data points could then be measured at 9 a.m., 10 a.m., 11 a.m., and 12 p.m.
On the right side of the dialog, you will specify additional information about your workfile
structure. In the first combo box, you will choose one of the standard EViews workfile fre-
quencies (annual, quarterly, monthly, etc.). As shown in the image, there is an additional
(default) option, Auto detect, where EViews attempts to detect the frequency of your data
from the values in the specified series. In most cases you should use the default; if, how-
ever, you choose to override the auto-detection, EViews will associate the date values in the
series with observations in the specified frequency.
You may elect to use the EViews defaults, “@FIRST” and “@LAST”, for the Start date and
the End date. In this case, the earliest and latest dates found in the identifier series will be
used to define the observations in the workfile. Alternatively, you may specify the start and
end dates explicitly. If these dates involve resizing the workfile, you will be informed of this
fact, and prompted to continue.
The last option is the Insert empty obs checkbox. This option should be used if you wish to
ensure that you have a regular frequency workfile. If this option is selected, EViews will add
any observations necessary to remove gaps in the calendar at the given frequency. If the
option is not selected, EViews will use only the observed IDs in the workfile and the work-
file may be structured as an irregular workfile.
228—Chapter 9. Advanced Workfiles
Suppose, for example, that you have observation with IDs for the quarters 1990Q1, 1990Q2,
1990Q4, but not 1990Q3. If Insert empty obs is checked, EViews will remove the gap in the
calendar by adding an observation corresponding to 1990:3. The resulting workfile will be
structured as a regular quarterly frequency workfile. If you do not insert observations, the
workfile will be treated as an irregular quarterly workfile.
Once you click on OK, EViews will first look for duplicate observation IDs. If duplicates are
not found, EViews will sort the data in your workfile by the values in the date series and
define the specified workfile structure. In addition, the date series is locked so that it may
not be altered, renamed, or deleted so long as it is being used to structure the workfile.
From the workfile window we call up the Workfile structure dialog, select Dated - speci-
fied by date series as our workfile type, and enter the name “B” in the Date series edit box.
We will start by leaving all of the other settings at their defaults: the frequency is set at Auto
detect, and the start and end dates are given by “@FIRST” and “@LAST”.
Second, since we have sorted the contents of the workfile by the ID series, the values in B
and DATEID are ordered by date. Third, the lagged values of series use the irregular calen-
dar defined by DATEID—for example, the lag of the 1965 value is given by 1961.
Dated Panels
To create a dated panel workfile, you
should call up the Workfile structure
dialog then select Dated Panel as our
structure type.
To structure the panel for these data, we call up the Workfile structure dialog, select Dated
Panel as our structure type, and enter the name of the Cross-section ID series representing
firm number, FN, along with the Date series (cell ID) representing the year, YR. If we leave
the remaining settings at their default values, EViews will auto detect the frequency of the
panel, setting the start and end dates on the basis of the values in the YR series, and will
add any observations necessary so that the data between the starts and ends is balanced.
Let us now consider a slightly more complicated example involving panel data that are both
unbalanced and irregular. For simplicity, we have created an unbalanced dataset by taking a
150 observation subset of the 200 observations in the Grunfeld dataset.
Alternatively, we can elect to perform one or more forms of balancing either at the time the
panel structure is put into place, or in a restructure step. Simply call up the Workfile struc-
ture dialog and select the desired forms of balancing. If you have previously structured your
workfile, the dialog will be pre-filled with the existing identifiers and frequency. In this
example, we will have our existing annual panel structure with identifiers DATEID and FN.
Structuring a Workfile—233
In addition to choosing
whether to Balance starts and
Balance ends, you may
choose, at most, one of the
two options Balance between
starts and ends, and Insert
obs to remove date gaps so
date follows regular fre-
quency.
Simply select Undated with identifier series, enter “state” as the identifier series, and click
OK to accept the settings. EViews will sort the observations in the workfile by the values in
the ID series, and then apply the requested structure, using and locking down the contents
of STATE.
ing that the workfile has been structured. Note, however, that since the dataset is still
undated, the workfile range and sample are still expressed in integers (“1 52”).
Undated Panels
To apply an undated panel structure to your workfile, you must specify one or more Cross-
section ID series that identify members of a given group. First, select Undated Panel from
the combo box, and then enter the names of your identifier series. You may optionally
instruct EViews to balance between the starts and ends, the starts, or the ends of your data.
As an example, we consider
the Harrison and Rubinfeld
data on house prices for 506
observations located in 92
towns and cities in the harbor
area near New Bedford, MA
(Harrison and Rubinfeld 1978;
Gilley and Pace 1996).
If you click on No, EViews will return you to the specification page where you may define a
different set of group identifiers. If you choose to continue, EViews will create a new series
with a name of the form CELLID## (e.g., CELLID, CELLID01, CELLID02, etc.) containing the
default integer cell identifiers. This series will automatically be used in defining the workfile
structure.
When you click on Yes to continue, EViews will restructure the workfile using the identifi-
ers TOWNID and CELLID##. The data will be sorted by the two identifiers, and the two-
dimensional panel structure applied. The workfile window will change to show this restruc-
turing. As depicted in the upper portion, we have a 506 observation, undated panel with
dimension (92, 30)—92 groups with a maximum of 30 observations in any group.
EViews will either error, or issue a warning and offer a possible solution. Some common
errors warrant additional discussion.
Non-unique identifiers
The most important characteristic of observation identifiers is that they uniquely identify
every observation. If you attempt to structure a workfile with identifiers that are not unique,
EViews will warn you of this fact, will offer to create a new cell ID, and will prompt you to
proceed. If you choose to proceed, EViews will then prompt you to create a panel workfile
structure using both the originally specified ID(s) and the new cell ID to identify the obser-
vations. We have seen an example of this behavior in our discussion of the undated panel
workfile type (“Undated Panels” on page 235).
In some cases, however, this behavior is not desired. If EViews reports that your date IDs
are not unique, you might choose to go back and either modify or correct the original ID val-
ues, or specify an alternate frequency in which the identifiers are unique. For example, the
date string identifier values “1/1/2002” and “2/1/2002” are not unique in a quarterly work-
file, but are unique in a monthly workfile.
If EViews is unable to translate your date information into date values, it will issue an error
indicating that the date series has invalid values or that it is unable to interpret your date
specification. You must either edit your date series, or structure your workfile as an undated
workfile with an ID series.
In cases where your date information is valid, but contains values that correspond to
unlikely dates, EViews will inform you of this fact and prompt you to continue. Suppose, for
example, that you have a series that contains 4-digit year identifiers (“1981,” “1982,” etc.),
but also has one value that is coded as a 2-digit year (“80”). If you attempt to use this series
as your date series, EViews will warn you that it appears to be an integer series and will ask
you if you wish to recode the data as integer dates. If your proceed, EViews will alter the
values in your series and create an integer dated (i.e., not time dated) workfile, which may
not be what you anticipated.
Alternately, you may cancel the restructure procedure, edit your date info series so that it
contains valid values, and reattempt to apply a structure.
238—Chapter 9. Advanced Workfiles
Missing values are not allowed in situations where EViews expects date information. If
EViews encounters missing values in a date ID series, it will issue a warning and will
prompt you to delete the corresponding observations. If you proceed, EViews will remove
the observations from the workfile. If removed, the observations may not be recovered,
even if you subsequently change or remove the workfile structure.
If the missing values are observed in an observation or group ID series, EViews will offer
you a choice of whether to keep or remove the corresponding observations, or whether to
cancel the restructure. If you choose to keep the observations, the missing value, NA, for
numeric series, and a blank string for alpha series, will be used as an observation or cross-
section ID in the restructured workfile. If you choose to drop the observations, EViews will
simply remove them from the workfile. These observations may not be recovered.
EViews will remove the workfile structure and will unlock any series used as date, group, or
observation identifiers.
Resizing a Workfile
Resizing a workfile page is a special case of restructuring. Simply call up the Workfile
structure dialog for any workfile page by selecting Proc/“Structure/Resize Current
Page...” from a workfile window, or by clicking on the “Range:” description header near the
top of the main workfile window. EViews will open the workfile structure dialog with your
current settings displayed in the appropriate fields.
To change the sizes of regular frequency workfiles, enter the appropriate Start date and End
date information using explicit dates or offsets from “@FIRST” and “@LAST”.
Resizing a Workfile—239
To change the size of an unstructured workfile, change the number of Observations. Note
that for unstructured data, you may only add or delete observations from the end of the
workfile, you may not change the starting observation; if you wish to modify the starting
observation you will need to work with an integer dated workfile.
Given your start and end date values, EViews will analyze your date identifiers to determine
whether you need to add or remove observations. If required, EViews will inform you of the
number of observations to be added or deleted, and you will be prompted to continue. If
observations are added, the date series will be modified to hold the corresponding date val-
ues. As with other forms of restructuring, deleted observations may not be recovered.
An observation will be deleted if the corresponding date ID falls outside the range implied
by the start and end dates. If we enter “1970” as the Start date and “2010” as the End date
in our annual workfile, any observations whose date series value is earlier than 1970 or later
than 2010 will be removed from the workfile. If we enter “@FIRST+2” and “@LAST-3” as
our Start date and End date, EViews will delete the first two and last three observations
from the workfile.
EViews will add observations to the workfile if the Start date is earlier than “@FIRST” or
the End date is later than “@LAST”. The observations to be added are determined by exam-
ining the regular frequency calendar to find all possible dates which fall in the desired
range. If, in our annual workfile that ranges from 1980 to 2000, we specify a Start date of
“1975”, EViews will add observations for all of the years from 1975 to 1979, and will modify
the date series so that it contains the associated date values. Alternatively, entering
240—Chapter 9. Advanced Workfiles
“@FIRST–2” and “@LAST+2” adds two observations corresponding to 1978 and 1979, and
two observations corresponding to 2001 and 2002.
Note that there is a bit of asymmetry here in the use of offsets to “@FIRST” and “@LAST”.
Offsets that remove observations from the workfile simply count from the first or last obser-
vation, while offsets that add observations to the workfile use the regular frequency calen-
dar to determine the dates to be added.
Dated Panel
For dated panel workfiles, the prefilled Start date and End date values will contain
“@FIRST” and “@LAST” as stand-ins for the cross-section specific earliest and latest
observed dates. To resize a dated panel workfile, you may enter an explicit date value in
one or both of those fields. If you elect to use offsets, you must take care to understand the
inherent complexities involved.
When you enter “@FIRST+2” and “@LAST–2”, EViews trims off 2 observations from the
beginning and end of each cross-section. Used in this fashion, “@FIRST” refers to the earli-
est date for each cross-section, and the offsets are in observation space.
If we combine this trimming with balancing starts or ends, balancing occurs prior to the
trimming of observations. Interestingly, this means that the starts or ends will not necessar-
ily be balanced following trimming.
In order to use “@FIRST–2” or “@LAST+2”, EViews must balance starts or ends. The
interpretation of the offsets that extend beyond the range of observations differs since they
are evaluated in regular date space. If you enter “@FIRST–2” and choose to balance starts,
the behavior is: first balance starts, then add two observations to the beginning in date
space. Note that this operation is the same as adding two observations in regular date space
to the cross-section with the earliest observed date and then balancing starts.
This behavior means that you cannot easily add two observations (in date space) to the start
or end of each cross-section, without possibly adding more via start or end balancing. The
panel data will have balanced starts or ends following the operation.
To alter the identifier series you must first remove the workfile structure. Call up the Work-
file structure dialog and select Unstructured/Undated from the combo box. Click on OK.
EViews will remove the existing workfile structure and will unlock the ID series.
Appending to a Workfile—241
If you wish to remove observations, you should edit one of the ID series so that the desired
observations have missing IDs. If you reapply the original Undated with ID series or
Undated Panel structure, EViews will prompt you to remove observations with the missing
ID values. We remind you that this step will remove all observations with missing values for
the identifiers; if you originally used the missing value as a valid identifier, the correspond-
ing observation will also be removed.
To add observations, you must first append observations to the workfile by expanding the
unstructured workfile and then editing the ID series to add unique identifiers for the new
values, or by using the built-in tools to append to the workfile page described below. Once
you have added the new observations, you may reapply the workfile structure. EViews will
sort your data using the identifier values, lock down the ID series, and then apply the struc-
ture to the expanded workfile.
Appending to a Workfile
One method of combining two workfile pages is to append observations from a source
workfile page to the end of a target workfile page. When appending data, EViews first
removes any structure from the target page, then expands its range to encompass the com-
bined range of the original page and the appended data. The data from the source page are
then copied to the expanded part of the target workfile range, either in existing series or
alpha objects, or in newly created objects.
When appending, you should first make certain that the workfiles containing both the
source and target page are open in EViews. In some cases (for example, concatenating a
workfile page with itself), you only need to have a single open workfile since the source and
target workfiles are the same.
To open the Workfile Append dialog, click on the Proc button on the target workfile tool-
bar and select Append to Current Page..., or select Proc/Append to Current Page... from
the main menu.
242—Chapter 9. Advanced Workfiles
Selecting Data to
Append
You should begin by
selecting a workfile page
containing data to be
appended to the target
page. The first combo box
contains a list of all work-
files currently in memory
from which you should
select the source workfile;
in the second combo box,
you should choose a page
from those in the workfile
you have selected. Here,
we have instructed EViews
to append data from the ANNUAL page in the workfile LINK_SALES.
Next, you should specify a sample of observations in the source page to be appended; any
valid EViews sample may be provided. Here, we have specified the default sample “@ALL”,
which ensures that we use all of the observations in the source page.
If you wish, you may use the Objects to append settings to specify the objects to be
appended or copied. By default (All series & alpha), EViews will append all series and
alphas (and links) from the source page into the destination page. If you select All objects,
EViews will append all series and alphas, and will copy all other objects into the destina-
tion. Alternatively, choosing Listed objects allows you to specify the individual objects to
be copied by name, using wildcards if convenient. To append only those data objects that
exist in both pages, you should select Series & alpha that exist in both workfiles. If this
setting is selected, a series or numeric link Y in the source page will only be appended if a
series Y exists in the active page, and an alpha or alpha link X in the source will only be
appended if an alpha series X exists in the destination.
• an object with the same name exists in the target, but the object type is not compati-
ble.
• an object with the same name exists in the target, and the object type is compatible
with the source object.
In saying that the source and destination objects are compatible, we indicate that the source
data may be added to the end of the existing object. Series and numeric link data may only
be added to the end of series objects, while alpha and alpha link data may only be added to
the end of alpha objects. All other combinations of objects are said to be incompatible.
Suppose that we wish to append the source series X or numeric link to the target page. If
there is no object with the same name in the target page, EViews will create a new series, X,
containing NA values for the original target page observations, and the values of the source
series X for observations in the expanded part of the range.
If there is an incompatible matching object, a new object will be created with a name
formed from the original name and the text specified in the Suffix to apply to renamed
objects edit field. If, for example, the target page contains an incompatible X (e.g., it con-
tains the equation X), EViews will create a new series using the original name, and the spec-
ified suffix, for example, “X_A” (using the default suffix, “_A”).
If there is a compatible matching object, EViews will examine your dialog settings to deter-
mine the appropriate behavior. By default, EViews will append the data from a compatible
source object to the end of the existing object. Thus, data from the series or numeric link X
will be copied to the expanded part of the range of the target series X, and data from the
alpha or alpha link Y will be copied to the end of the alpha series Y. You may override this
default so that EViews creates a new object even when the matching objects are compatible,
by unselecting the Merge series or Merge alpha checkboxes.
To save a series containing the date or observation ID associated with each observation in
the combined workfile, you should enter a unique name in the edit field labeled Date/Obs
ID. The specified series will be created in the target page, and will contain the observation
or cell identifiers given by the structures associated with the source and the original target
pages. Saving the IDs is particularly useful since appending to a workfile removes the exist-
ing page structure.
The optional Workfile ID series identifies the source of the observation in the combined
workfile: observations in the original target page are assigned the value 0, while observa-
tions in the appended portion of the target will be given the value 1.
244—Chapter 9. Advanced Workfiles
Contracting a Workfile
Samples are an important tool for restricting the set of observations used by EViews when
performing calculations. You may, for example, set an estimation sample to restrict the
observations used in a regression to only include females, or to only use the observations
with dates between 1990 and 2003. An important advantage to working with samples is that
the exclusion of observations is temporary, and may be reset simply by providing a new
sample specification. Note also that even as they are excluded from calculations, out-of-
sample observations still exist, and are used for lag processing.
There may be times, however, when you wish to drop or remove observations from a work-
file page. For example, if you have daily data on stock trades and want lags to skip holidays,
you must permanently remove holidays from the workfile. Similarly, if the focus of your
analysis is on female labor force participation, you may wish to subset your workfile by
excluding all males. Contracting the workfile in this fashion both reduces the size of the
workfile and makes it easier to work with, since you no longer have to remember to set all
samples to exclude males.
To contract a workfile page in place, you should click on the Proc button on the workfile
toolbar and select Contract Current Page..., or select Proc/Contract Current Page... from
the main menu.
We emphasize that the workfile contraction occurs in place so that the existing workfile
page will no longer exist. If you wish to keep the original page, you should make a copy of
the page, or save it to disk.
Copying or extracting the series object data may be performed in two distinct ways: by cre-
ating links in a new page in the same workfile, or by copying the series objects into a new
page in the existing or an alternate workfile.
The first method uses link objects to create memory efficiently, dynamically updating copies
of the data in your series, link, and alpha objects, but requires that the new destination page
be in the same workfile.
The second method copies the actual values in the objects. Since links are not involved, you
may use this approach to copy data into new pages in different workfiles. In addition, when
copying by value, you may copy other types of EViews objects and you will have access to
built-in tools for creating random samples of the observations in the source workfile.
Copying by Link
To copy all or part of the data in a workfile by creating links, you should select Proc/“Copy
Extract from Current Page”/By Link to New Page.... EViews will open the Workfile Copy
By Link dialog in which you will specify the data to be copied.
If the Include Links checkbox is selected, EViews will copy series and alpha links along
with ordinary series and alphas. If you uncheck Include Links, EViews will drop all link
objects from the copy list.
246—Chapter 9. Advanced Workfiles
Next, EViews will copy, by value, the ID series used to structure the source workfile page
for the specified sample of observations. Using the new series, EViews will structure the
new workfile in a manner similar to the source workfile page. If, for example, you have an
undated workfile that is structured using an ID series COUNTRIES, EViews will create a
series in the destination page, copy the relevant values, and structure the page as an
undated workfile using the new ID series COUNTRIES. Similarly, if the original page has an
annual panel structure that is defined using multiple ID series, all of the ID series will be
copied to the new page, and the page will be structured as an annual panel using these new
series.
Lastly, EViews will create links in the new page for all of the specified series objects. The
links will be defined as general match merge links using the source and destination ID
series. Since the new page is a subset of the original page, the contraction methods will be
set to No contractions allowed (see “Link calculation settings” on page 199).
Copying by Value
To copy all or part of the workfile by value, you should select Proc/“Copy/Extract from
Current Page”/By Value to New Page or Workfile.... EViews will open the Workfile Copy
By Value dialog.
Copying from a Workfile—247
In the remainder of the dialog page you should specify the objects to be copied. There are
two parts to the object specification: a list of object names, and a set of modifiers for object
types.
By default, the All objects radio button is selected so that the list of object names provided
to EViews will include every object in the source workfile. You may instead provide an
explicit list by clicking on the Listed objects radio button and entering the names of objects
(using wildcards if appropriate).
The type matching checkboxes (Series - Alphas - Valmaps, Links, Estimation & Model
Objects, All others) may be used to restrict the object list on the basis of broad classifica-
tions for type; an object will be copied only if it is in the list of object names provided in the
edit box, and if its type matches a classification that you elect to copy. If, for example, you
wish to remove all objects that are not series objects or valmaps from your list, you should
uncheck the Estimation & Model objects and the All others checkboxes.
248—Chapter 9. Advanced Workfiles
Lastly, you may optionally provide a destination workfile page. By default, EViews will copy
the data to a new workfile in a page named after the workfile page structure (e.g., “Quar-
terly,” “Monthly”). You may provide an alternative destination by clicking on the Page Des-
tination tab in the dialog, and entering the desired destination workfile and/or page.
When you click on OK, EViews examines your source workfile and the specified sample,
and creates a new page with the appropriate number of observations. EViews then copies
the ID series used to structure the source workfile, and structures the new workfile in iden-
tical fashion. Lastly, the specified objects are copied to the new workfile page.
Reshaping a Workfile
In a typical study, each subject (individual, firm, period, etc.) is observed only once. In
these cases, each observation corresponds to a different subject, and each series, alpha, or
link in the workfile represents a distinct variable.
In contrast, repeated measures data may arise when the same subject is observed at differ-
ent times or under different settings. The term repeated measures comes from the fact that
for a given subject we may have repeated values, or measures, for some variables. For
example, in longitudinal surveys, subjects may be asked about their economic status on an
annual basis over a period of several years. Similarly, in clinical drug trials, individual
patient health may be observed after several treatment events.
It is worth noting that standard time series data may be viewed as a special case of repeated
measures data, in which there are repeated higher frequency observations for each lower
frequency observation. Quarterly data may, for example, be viewed as data in which there
are four repeated values for each annual observation. While time series data are not typi-
cally viewed in this context, the interpretation suggests that the reshaping tools described in
this section are generally applicable to time series data.
There are two basic ways that repeated measures data may be organized in an EViews
workfile. To illustrate the different formats, we consider a couple of simple examples.
We may view these data as representing repeated measures on subjects with identifiers
given in ID1, or as repeated measures for subjects with names provided in ID2. There are,
for example, two repeated values for subjects with “ID1=1”, and three repeated values for
SALES for Jason. Note that in either case, the repeated values for the single series SALES are
represented in multiple observations.
We can rearrange the layout of the data into an equivalent form where the values of ID2 are
used to break SALES into multiple series (one for each distinct value of ID2):
The series ID2 no longer exists as a distinct series in the new format, but instead appears
implicitly in the names associated with the new series (SALESJASON and SALESADAM).
The repeated values for SALES are no longer represented by multiple observations, but are
instead represented in the multiple series values associated with each value of ID1.
Note also that this representation of the data requires that we add an additional observation
corresponding to the case ID1=3, ID2=“Adam”. Since the observation did not exist in the
original representation, the corresponding value of SALESADAM is set to NA.
Alternatively, we may rearrange the data using the values in ID1 to break SALES into multi-
ple series:
In this format, the series ID1 no longer exists as a distinct series, but appears implicitly in
the series names for SALES1, SALES2, and SALES3. Once again, the repeated responses for
SALES are not represented by multiple observations, but are instead held in multiple series.
The original data format is often referred to as repeated observations format, since multiple
observations are used to represent the SALES data for an individual ID1 or ID2 value. The
latter two representations are said to be in repeated variable or multivariate form since they
employ multiple series to represent the SALES data.
When data are rearranged so that a single series in the original workfile is broken into mul-
tiple series in a new workfile, we term the operation unstacking the workfile. Unstacking a
workfile converts data from repeated observations to multivariate format.
250—Chapter 9. Advanced Workfiles
When data are rearranged so that sets of two or more series in the original workfile are com-
bined to form a single series in a new workfile, we call the operation stacking the workfile.
Stacking a workfile converts data from multivariate to repeated observations format.
In a time series context, we may have the data in the standard stacked format:
where we have added the columns labeled YEAR and QUARTER so that you may more
readily see the repeated measures interpretation of the data.
Year Z1 Z2 Z3 Z4
2000 2.1 3.2 5.7 6.3
2001 7.4 8.1 8.8 9.2
EViews provides you with convenient tools for reshaping workfiles between these different
formats. These tools make it easy to prepare a workfile page that is set up for use with built-
in pool or panel data features, or to convert data held in one time series representation into
an alternative format.
Reshaping a Workfile—251
Unstacking a Workfile
Unstacking a workfile involves taking series objects in a workfile page, and in a new work-
file, breaking the original series into multiple series.
To ensure that each series observation in the new workfile contains no more than one
observation from the existing workfile, we require that the unstacking ID and the observa-
tion ID are chosen such that no two observations in the original workfile have the same set
of values for the identifier series. In other words, the identifier series must together uniquely
identify observations in the original workfile.
While you may use any series in the workfile as your unstacking and observation identifier
series, an obvious choice for the identifiers will come from the set of series used to structure
the workfile (if available). In a dated panel, for example, the cross-section ID and date ID
series uniquely identify the rows of the workfile. We may then choose either of these series
as the unstacking ID, and the other as the observation ID.
If we unstack the data by the cross-section ID, we end up with a simple dated workfile with
each existing series split into separate series, each corresponding to a distinct cross-section
ID value. This is the workfile structure used by the EViews pool object, and is commonly
used when the number of cross-sectional units is small. Accordingly, one important applica-
tion of unstacking a workfile involves taking a page with a panel structure and creating a
new page suitable for use with EViews pool objects.
On the other hand, if we unstack the panel workfile by date (using the date ID series or
@DATE), we end up with a workfile where each row represents a cross-sectional unit, and
each original series is split into separate series, one for each observed time period. This for-
mat is frequently used in the traditional repeated measures setting where a small number of
variables in a cross-sectional dataset have been observed at different times.
To this point, we have described the unstacking of panel data. Even if your workfile is struc-
tured using a single identifier series, however, it may be possible to unstack the workfile by
first splitting the single identifier into two parts, and using the two parts as the identifier
series. For example, consider the simple quarterly data given by:
Date X Y
2000Q1 NA -2.3
2000Q2 5.6 -2.3
252—Chapter 9. Advanced Workfiles
Suppose we wish to unstack the X series. We may split the date identifier into a year compo-
nent and a quarter component (using, say, the EViews @YEAR and @QUARTER functions).
If we extract the QUARTER and YEAR from the date and use the QUARTER as the unstack-
ing identifier, and the YEAR as the observation identifier, we obtain the unstacked data:
Year X1 X2 X3 X4
2000 NA 5.6 8.7 9.6
2001 12.1 8.6 14.1 15.2
Note that we have chosen to form the series names by concatenating the name of the X
series, and the values of the QUARTER series.
Alternatively, if we use YEAR as the unstacking ID, and QUARTER as the observation ID,
we have:
In some cases, a series in the original workfile will not vary by the unstacking ID. In our
example, we have a series Y that is only updated once a year. Stacking by QUARTER yields:
Year Y1 Y2 Y3 Y4
2000 -2.3 -2.3 -2.3 -2.3
2001 1.6 1.6 1.6 1.6
Since there is no change in the observations across quarters, these data may be written as:
Reshaping a Workfile—253
Year Y
2000 -2.3
2001 1.6
without loss of information. When unstacking, EViews will automatically avoid splitting any
series which does not vary across different values of the unstacking ID. Thus, if you ask
EViews to unstack the original Y by QUARTER, only the compacted (single series) form will
be saved. Note that unstacking by YEAR will not produce a compacted format since Y is not
constant across values of YEAR for a given value of QUARTER.
Unstacking Identifiers
To unstack data contained in a workfile page,
your source page must contain a series object
containing the unstacking identifiers associ-
ated with each observation. For example, you
may have an alpha series containing country
abbreviations (“US,” “JPN,” “UK”), or indi-
vidual names (“Joe Smith,” “Jane Doe”), or a
numeric series with integer identifiers (“1,” “2,” “3,” “50,” “100,” ...). Typically, there will
be repeated observations for each of the unique unstacking ID values.
You should provide the name of your unstacking ID series object in the top edit field of the
dialog. When unstacking, EViews will create a separate series for each distinct value of the
ID series, with each of these series containing the multiple observations associated with that
value. The series used as the unstacking ID is always dropped from the destination workfile
since its values are redundant since they are built into the multiple series names.
254—Chapter 9. Advanced Workfiles
If you wish to unstack using values in more than one series, you must create a new series
that combines the two identifiers by identifying the subgroups, or you may simply repeat
the unstacking operation.
Observation Identifiers
Next, you must specify a series object containing an observation ID series in the second edit
field. The values of this series are used to identify both the individual observations in the
unstacked series and the structure of the destination page.
Once again, if your workfile is structured, an obvious choice for the unstacking identifier
series comes from the series used to structure the workfile, either directly (the date or cross-
section ID in a panel page), or indirectly (the YEAR or QUARTER extracted from a quarterly
date).
EViews will, if necessary, create a new observation ID series in the unstacked page with the
same name as, and containing the unique values of, the original observation ID series. This
series will be used to structure the workfile.
If the original observation ID is an ordinary series or alpha, the new page will be structured
as a cross-section page using the new identifier series. Alternatively, if the observation ID is
a date series or the “@DATE” keyword, EViews will analyze the observed date values and
will create a dated page with the appropriate frequency.
Series to be Unstacked
You may enter the names of the series, alphas, and links that you wish to unstack in the edit
field Series to be unstacked into new workfile page. You may enter the names directly, or
use expressions containing wildcards. For example, the expression “SALES A*” instructs
EViews to unstack both the SALES series as well as all series objects beginning with the let-
ter “A”.
Note that the RESID series and the unstacking ID series may not be unstacked.
By default, the wildcard pattern “*?” will be used, meaning that unstacked series names will
be constructed by concatenating the name of the series object to be unstacked and a string
containing one of the unique values found in the unstacking ID series.
In our example above, when unstacking the SALES series using NAME as the unstacking ID
series and the wildcard name pattern “*?”, EViews will create the series JASONSALES and
ADAMSALES. If instead, we enter the pattern “?_*”, EViews will put the unstacked values
in the series SALES_JASON and SALES_ADAM.
Reshaping a Workfile—255
Unstacking Destination
By default, EViews will unstack the data in a new UNTITLED page in the existing workfile.
You may provide an alternative destination by clicking on the Page Destination tab in the
dialog, and entering the desired destination.
An Example
Consider a workfile that contains the
series GDP and CONS, which contain
the values of Gross Domestic Product
and consumption for three countries
stacked on top of each other.
In this example, we start with a balanced panel with 10 distinct values for DATEID, and
three distinct values in COUNTRY. The resulting UNTITLED workfile page will follow an
annual frequency from the 10 observations from 1991 to 2000, and will have three
unstacked series corresponding to each of the source series. The names of these series will
be formed by taking the original series name and appending the distinct values in COUN-
TRY (“US,” “UK,” and “JPN”).
Lastly, EViews has created a pool object named COUNTRY, corresponding to the specified
unstack ID series, containing all of the unstacking identifiers. Since the unstacked series
have names that were created using the specified name pattern, this pool object is perfectly
set up for working with the unstacked data.
Stacking a Workfile
Stacking a workfile involves combining sets of series with related names into single series,
or repeatedly stacking individual series into single series, and placing the results in a new
workfile. The series in a given set to be stacked may be thought of as containing repeated
measures data on a given variable. The individual series may be viewed as ordinary, non-
repeated measures data.
The stacking operation depends crucially on the set of stacking identifiers. These identifiers
are used to determine the sets of series, and the number of times to repeat the values of
individual series.
In order for all of the series in a given set to be stacked, they must have names that contain
a common component, or base name, and the names must differ systematically in contain-
ing an identifier. The identifiers can appear as a suffix, prefix, or even in the middle of the
base name, but they must be used consistently across all series in each set.
Suppose, for example, we have a workfile containing the individual series Z, and the two
groups of series: XUS, XUK and XJPN, and US_Y, UK_Y, and JPN_Y. Note that within each
set of series, the identifiers “US,” “UK,” and “JPN” are used, and that they are used consis-
tently within each set of series.
If we employ the set of three identifier values “US,” “UK,” and “JPN” to stack our workfile,
EViews will stack the three series XUS, XUK, and XJPN on top of each other, and the series
258—Chapter 9. Advanced Workfiles
US_Y, UK_Y, and JPN_Y on top of each other. Furthermore, the individual series Z will be
stacked on top of itself three times so that there are three copies of the original data in the
new series.
Stacking Identifiers
There are three distinct methods that you
may use to specify your stack ID values:
Second, you may enter the name of an existing pool object that contains the identifier val-
ues.
Lastly, you may instruct EViews to extract the ID values from a set of series representing
repeated measures on some variable. To use this method, you should enter a series name
pattern containing the base name and the “?” character in place of the IDs. EViews will use
this expression to identify a set of series, and will extract the ID values from the series
names. For example, if you enter “SALES?”, EViews will identify all series in the workfile
with names beginning with the string “SALES”, and will form a list of identifiers from the
remainder of the observed series names. In our example, we have the series SALES1,
SALES2, and SALES3 in the workfile, so that the list of IDs will be “1”, “2”, and “3”.
Reshaping a Workfile—259
Series to be Stacked
Next, you should enter the list of series, alphas, and links that you wish to stack. Sets of
series objects that are to be treated as repeated measures (stacked on top of each other)
should be entered using “?” series name patterns, while individual series (those that should
be repeatedly stacked on top of themselves), should be entered using simple names or wild-
cards.
You may specify the repeated measures series by listing individual stacked series with “?”
patterns (“CONS? EARN?”), or you may use expressions containing the wildcard character
“*” (“*?” and “?C*”) to specify multiple sets of series. For example, entering the expression
“?C* ?E*” will tell EViews to find all repeated measures series that begin with the letters “C”
or “E” (e.g., “CONS? CAP? EARN? EXPER?”), and then to stack (or interleave) the series
using the list of stack ID values. If one of the series associated with a particular stack ID
does not exist, the corresponding stacked values will be assigned the value NA.
Individual series may also be stacked. You may list the names of individual simple series
(e.g., “POP INC”), or you can specify your series using expressions containing the wildcard
character “*” (“*”, “*C”, “F*”). The individual series will repeatedly be stacked (or inter-
leaved), once for each ID value. If the target workfile page is in the same workfile, EViews
will create a link in the new page; otherwise, the stacked series will contain repeated copies
of the original values.
It should be noted that the wildcard values for individual series are processed after the
repeated measures series are evaluated, so that a given series will only be used once. If a
series is used as part of a repeated measures series, it will not be used when matching wild-
cards in the list of individual series to be stacked.
The default value “*? *” is suitable for settings where the repeated series have names
formed by taking the base name and appending the stack ID values. The default will stack
all repeated measures series, and all remaining individual series (except for RESID). Enter-
ing “*” alone will copy or link all series, but does not identify any repeated measures series.
This default rule will create naming problems when the base name of a repeated measures
series is also the name of an individual series. Accordingly, EViews allows you to specify an
alternative rule for naming your stacked repeated measures series in the Name for stacked
series section of the dialog.
260—Chapter 9. Advanced Workfiles
The default naming rule may be viewed as one in which we form names by replacing the
“?” in the original specification with a blank space. To replace the “?” with a different string,
you should enter the desired string in the edit field. For example, if you enter the string
“_STK”, then EViews will name the stacked series “CONS?” and “EARN?” as “CONS_STK”
and “EARN_STK” in the destination workfile.
Stacking Order
EViews will, by default, create series in the new page by stacking series on top of one
another. If we have identifiers “1”, “2”, and “3”, and the series SALES1, SALES2, and
SALES3, EViews will stack the entire series SALES1 followed by the entire series SALES2,
followed by SALES3.
You may instruct EViews to interleave the data, by selecting the Interleaved radio button in
the Order of Obs section of the dialog. If selected, EViews will stack the first observations
for SALES1, SALES2, and SALES3, on top of the second observations, and so forth.
It is worth pointing out that stacking by series means that the observations contained in a
given series will be kept together in the stacked form, while interleaving the data implies
that the multiple values for a given original observation will be kept together. In some con-
texts, one form may be more natural than another.
In the case where we have time series data with different series representing different coun-
tries, stacking the data by series means that we have the complete time series for the “US”
(USGDP), followed by the time series for the “UK” (UKGDP), and then “JPN” (JPNGDP).
This representation is more natural for time series analysis than interleaving so that the
observations for the first year are followed by the observations for the second year, and so
forth.
Alternatively, where the series represent repeated measures for a given subject, stacking the
data by series arranges the data so that all of the first measures are followed by all of the
second measures, and so on. In this case, it may be more natural to interleave the data, so
that all of the observations for the first individual are followed by all of the observations for
the second individual, and so forth.
One interesting case where interleaving may be desirable is when we have data which has
been split by period, within the year. For example, we may have four quarters of data for
each year:
If we stack the series using the identifier list “Q1 Q2 Q3 Q4”, we get the data:
Reshaping a Workfile—261
Year ID01 X
2000 Q1 NA
2001 Q1 12.1
2000 Q2 5.6
2001 Q2 8.6
2000 Q3 8.7
2001 Q3 14.1
2000 Q4 9.6
2001 Q4 15.2
which is not ordered in the traditional time series format from earliest to latest. If instead,
we stack by “Q1 Q2 Q3 Q4” but interleave, we obtain the standard format:
Year ID01 X
2000 Q1 NA
2000 Q2 5.6
2000 Q3 8.7
2000 Q4 9.6
2001 Q1 12.1
2001 Q2 8.6
2001 Q3 14.1
2001 Q4 15.2
Note that since interleaving changes only the order of the observations in the workfile and
not the structure, we can always sort or restructure the workfile at a later date to achieve
the same effect.
Stacking Destination
By default, EViews will stack the data in a new page in the existing workfile named “UNTI-
TLED” (or the next available name, “UNTITLED1,” “UNTITLED2,” etc., if there are existing
pages in the workfile with the same name).
262—Chapter 9. Advanced Workfiles
An Example
Consider an annual (1971 to 2000) workfile, “Wfstack.WF1”, that contains the six series:
CONSUS, CONSUK, CONSJPN, and GDPUS, GDPUK, GDPJPN, along with the ordinary
series CONSTVAL and WORLDGDP.
Assuming that we have entered “US UK JPN” or “GDP?” in the Stacking Identifiers edit
box, we may then enter the expression
gdp? cons?
as our Series to stack. We leave the remainder of the dialog settings at their defaults, and
click on OK.
Note that EViews will only apply a panel structure to the new page if we stack the data by
series, but not if we interleave observations. Here, had we chosen to interleave, we would
obtain a new 90 observation unstructured page containing the series GDP and CONS and
the alpha ID01 and series ID02, with the observations for 1971 followed by observations for
1972, and so forth.
264—Chapter 9. Advanced Workfiles
We may add our individual series to the stacked series list, either directly by entering their
names, or using wildcard expressions. We may use either of the stack series expressions:
gdp? cons? worldgdp constval
or
gdp? cons? *
to stack the various “GDP?” and “CONS?” series on top of each other, and the individual
series WORLDGDP and CONSTVAL will be linked to the new page so that the original series
values are repeatedly stacked on top of themselves.
It is worth reminding you that the wildcard values for individual series are processed after
the repeated measures series “GDP?” and “CONS?” are evaluated, so that a given series will
only be used once. Thus, in the example above, the series CONSUS is used in forming the
stacked CONS series, so that it is ignored when matching the individual series wildcard.
Lastly, we note that since EViews will, by default, create a new page in the existing work-
file, all individual series will be stacked or interleaved by creating link objects. If, for exam-
ple, you enter the stack series list
gdp? cons? worldgdp constval
the series WORLDGDP and CONSTVAL will be linked to the destination page using the ID02
values. Alternately, if we were to save the stacked data to a new workfile, by clicking on the
Page Destination tab and entering appropriate values, EViews will copy the original
WORLDGDP and CONSTVAL series to the new page, repeating the values of the original
series in the stacked series.
Exporting from a Workfile—265
Sorting a Workfile
Basic data in workfiles are held in objects called series. If you click on Proc/Sort Current
Page … in the workfile toolbar, you can sort all of the series in an unstructured workfile on
the basis of the values of one or more of the series. A dialog box will open where you can
provide the details about the sort.
Foreign Formats
To save your series (and possibly value map data) into a foreign data source, first select
File/Save As..., from the workfile menu to bring up the standard file Save dialog. Clicking
on the Files of type combo box brings up a list of the output file types that EViews currently
supports.
The data export interface is available for Microsoft Access, Aremos TSD, Gauss Dataset,
GiveWin/Pc-Give, Rats 4.x, Rats Portable, SAS program files, SAS Transport, native SPSS
(using the SPSS Input/output .DLL installed on your system), SPSS Portable, Stata, TSP Por-
266—Chapter 9. Advanced Workfiles
table, Excel, raw ASCII or binary files, or ODBC Databases (using the ODBC driver already
present on your system).
References
Baltagi, Badi H. (2005). Econometric Analysis of Panel Data, Third Edition, West Sussex, England: John
Wiley & Sons.
Gilley, O.W., and R. Kelley Pace (1996). “On the Harrison and Rubinfeld Data,” Journal of Environmental
Economics and Management, 31, 403–405.
Harrison, D. and D. L. Rubinfeld (1978). “Hedonic Housing Prices and the Demand for Clean Air,” Jour-
nal of Environmental Economics and Management, 5, 81-102.
Chapter 10. EViews Databases
EViews databases also differ from workfiles in that they support powerful query features
which can be used to search through the database to find a particular series or a set of series
with a common property. This makes databases ideal for managing large quantities of data.
While EViews has its own native storage format for databases, EViews also allows direct
access to data stored in a variety of other formats through the same database interface. You
can perform queries, copy objects to and from workfiles and other databases, and rename
and delete objects within a database, all without worrying about in what format the data are
actually stored.
Database Overview
An EViews database is a set of files containing a collection of EViews objects. In this chapter
we describe how to:
• Create a new database or open an existing database.
• Work with objects in the database, including how to store and fetch objects into
workfiles, and how to copy, rename and delete objects in the database.
• Use auto-series to work with data directly from the database without creating a copy
of the data in the workfile.
• Use the database registry to create shortcuts for long database names and to set up a
search path for series names not found in the workfile.
• Perform a query on the database to get a list of objects with particular properties.
• Use object aliases to work with objects whose names are illegal or awkward.
• Maintain a database with operations such as packing, copying, and repairing.
• Work with remote database links to access data from remote sites.
268—Chapter 10. EViews Databases
Database Basics
What is an EViews Database?
An EViews native format database consists of a set of files on disk. There is a main file with
the extension .EDB which contains the actual object data, and a number of index files with
extensions such as .E0, .E1A and .E1B which are used to speed up searching operations on
the database. In normal use, EViews manages these files for the user, so there is no need to
be aware of this structure. However, if you are copying, moving, renaming, or deleting an
EViews database from outside of EViews (using Windows Explorer for example), you
should perform the operation on both the main database file and all the index files associ-
ated with the database. If you accidentally delete or damage an index file, EViews can
regenerate it for you from the main data file using the repair command (see “Maintaining
the Database” on page 293).
The fact that EViews databases are kept on disk rather than in memory has some important
consequences. Any changes made to a database cause immediate changes to be made to the
disk files associated with the database. Therefore, unlike workfiles, once a change is made
to a database, there is no possibility of discarding the change and going back to the previ-
ously saved version. Because of this, you should take care when modifying a database, and
should consider keeping regular backup copies of databases which you modify frequently.
EViews also allows you to deal with a variety of foreign format databases through the same
interface provided to EViews’ native format databases. Foreign databases can have many
different forms, including files on disk, or data made available through some sort of network
server. See “Foreign Format Databases” on page 295 for a discussion of the different types
of foreign databases that EViews can access.
Creating a Database
To create a database, simply select File/New/Database… from the main menu.
and close the file dialog. EViews will put the new path and filename in the DB File name/
path edit field.
The Database/File Type field allows you to create different types of databases. See “Foreign
Format Databases” on page 295 for a discussion of working with different database types.
The Open As field allows you to specify the shorthand that will be associated with this data-
base. A shorthand is a short text label which is used to refer to the database in commands
and programs. If you leave this field blank, a default shorthand will be assigned automati-
cally (see “Database Shorthands” on page 271).
The Browse Registry and Add to Registry buttons provide a convenient way to recall infor-
mation associated with a previously registered database or to include the new database in
the database registry (see “The Database Registry” on page 281).
A database can also be created from the command line or in a program using the command:
dbcreate db_name
where db_name is the name of the database using the same rules given above.
To open a database window for an existing database, select File/Open/Database… from the
main menu. The same dialog will appear as was used during database creation. To open an
EViews database, use the Browse Files button to select a file using the common file dialog,
then click on OK to open the file. A new window should appear representing the open data-
base.
From the command line or in a program, you can open a database window by typing:
dbopen db_name
Unlike a workfile window, a database window does not display the contents of the database
when it is first opened, although it does tell you how many objects are in the database. The
second line of the window text shows the number of objects currently displayed (zero when
the window is first opened) followed by the total number of objects stored in the database.
270—Chapter 10. EViews Databases
You can bring up an alphabetical listing of every object in the database by clicking on the
All button:
When working with foreign databases, the object names may appear in color to indicate
that they are illegal names or that an alias has been attached to an object name (see “Object
Aliases and Illegal Names” on page 291).
The “Packable space” field in the database window displays the percentage of unused space
in the database that can be recovered by a database pack operation (see “Packing the Data-
base” on page 293).
A brief technical note: having a database window open in EViews generally does not keep a
file open at the operating system level. EViews will normally open files only when it is per-
forming operations on those files. Consequently, multiple users may have a database open
at the same time and can perform operations simultaneously. There are some limits
imposed by the fact that one user cannot read from a database that another user is writing
to at the same time. However, EViews will detect this situation and continue to retry the
operation until the database becomes available. If the database does not become available
within a specified time, EViews will generate an error stating that a “sharing violation” on
the database has occurred.
For some foreign formats, even minor operations on a database may require full rewriting of
the underlying file. In these cases, EViews will hold the file open as long as the database
window is open in order to improve efficiency. The formats that currently behave this way
Database Basics—271
are Aremos TSD files, RATS Portable/TROLL files and TSP portable files. When using these
formats, only one user at a time may have an open database window for the file.
Database Shorthands
In many situations, EViews allows you to prefix an object name with a database identifier to
indicate where the series is located. These database identifiers are referred to as “short-
hands”. For example, the command:
fetch db1::x db2::y
indicates to EViews that the object named X is located in the database with the shorthand
db1 and the object named y is located in the database with the shorthand db2.
For example, if we open two databases with the same name in a program:
dbopen test.edb
dbopen test.dat
then the first database will receive the shorthand “TEST” and the second database will
receive the shorthand “TEST1”. If we then issue the command:
fetch test::x
the object X will be fetched from the EViews database TEST.EDB. To fetch X from the Haver
database TEST.DAT we would use:
fetch test1::x
To minimize confusion, you should assign explicit shorthands to databases whenever ambi-
guity could arise. For example, we could explicitly assign the shorthand TEST_HAVER to
the second database by replacing the second dbopen command with:
dbopen test.dat as test_haver
The shorthand attached to a database remains in effect until the database is closed. The
shorthand assigned to an open database is displayed in the title bar of the database window.
272—Chapter 10. EViews Databases
The default database is set by opening a new database window, or by clicking on an already
open database window if there are multiple databases open on the screen. The name of the
default database is listed in the status line at the bottom of the main EViews window (see
Chapter 4. “Object Basics,” on page 67, for details). The concept is similar to that of the cur-
rent workfile with one exception: when there are no currently open databases there is still a
default database; when there are no currently open workfiles, the current workfile is listed
as “none.”
While the new database features added to EViews provide a superior method of archiving
and managing your data, .DB? files provide backward compatibility and a convenient
method of distributing data to other programs. Series .DB files are now supported by a large
number of programs including TSP, RATS, and SHAZAM. Additionally, some organizations
such as the National Bureau of Economic Research (NBER), distribute data in .DB format.
You will also need to manage the objects inside a database. You can create duplicate copies
of objects, change their names, or remove them from the database entirely. The sections on
copying, renaming and deleting discuss how these operations can be carried out.
provide a number of options for renaming the object and determining where the object
should be stored.
The first method is to click on the button marked Fetch on the toolbar of the workfile into
which you would like to fetch the object. A dialog will come up which is similar to the dia-
log for store:
274—Chapter 10. EViews Databases
The fields labeled Database Alias or Path and Fetch from are the same as for the store dia-
log with one exception. In addition to EViews Database and Individual .DB? files, Fetch
from has an option titled Search Databases. This option tells EViews to search multiple
databases for objects which match the specified names. To use this option, you must first
define a search order in the database registry (see “The Database Registry” on page 281).
The checkbox labeled Link objects to database on the bottom of the dialog instructs
EViews to bring any listed series or alpha objects into the workfile as links to the data in the
database. When you open an existing workfile containing database links, EViews will
prompt you for whether you wish to refresh the data series. If you click on No, EViews will
retain the existing data in the link, otherwise the data will be reimported from the database
when you load the workfile. You may also update existing links manually by selecting
Object/Manage Links & Formulae... in the workfile window, specifying the links to
update, and clicking on the Refresh Links - update data from source button.
When you click on OK, EViews will fetch all the objects. If an object which is being fetched
is already contained in the workfile, a dialog will appear asking whether to replace the
object or not. Click on Yes to replace the object in the workfile or No to leave the object in
the workfile unchanged.
Because a workfile has a fixed frequency and range, fetching a series into a workfile may
cause the data in the series to be modified to match the frequency and range of the workfile
(see “Frequency Conversion” on page 117). Be aware that loading a series into a workfile
then saving it back into the database can cause truncation and frequency conversion of the
series stored in the database.
Object/Update selected from DB… from the workfile toolbar is the same as Fetch except
that there is no overwrite warning message. If the object in the database is the same type as
the one in the workfile, it is automatically overwritten. If it is of a different type, the fetch
Working with Objects in Databases—275
does not proceed. Update is also available from the Object button in individual object win-
dows.
Database Export
You can also move data into a workfile from the database window. From an open database
window, select the objects you would like to copy using the mouse, then click on the button
marked Export in the toolbar at the top of the database window. The Database Export dia-
log will appear on the screen:
There is an extra option in the list of open workfiles for specifying a new workfile as your
copy destination. If you select New Workfile, EViews will create a new workfile containing
the objects you have selected. After you click on OK, a second dialog will appear in which
you can set the frequency and range of the workfile to be created. The default frequency is
set to the lowest frequency of any of the objects selected, and the default range is set to
cover all the data points contained in the objects. Clicking on OK will open a new workfile
window and copy the selected objects into it, performing frequency conversion where nec-
essary.
Lastly, you may export your series or alpha objects to the workfile as database links. When
you reopen your workfile containing database links, EViews will prompt you for whether
you wish to refresh the data series from the database.
Copying Objects
In addition to the above methods for moving objects, EViews provides general support for
the copying of objects between any two EViews container objects (workfiles or databases).
You may use these features to move objects between two databases or between two work-
files, to create duplicate copies of objects within a workfile or database, or as an alternative
method for store and fetch.
Copy-and-Paste
For copying objects between containers, the procedure is very similar no matter what types
of container objects are involved. Before you start, make sure that the windows for both
276—Chapter 10. EViews Databases
containers are open on the screen. In the container from which you would like to copy the
objects, select the objects then click on Edit/Copy in the EViews program menu. Click on
the container object into which you would like to paste the objects, then select Edit/Paste or
Edit/Paste Special... from the EViews program menu.
Depending on the types of the two containers, you may be presented with one or more dia-
logs. If, for example, you are performing a copy to or from a database, and click on Edit/
Paste, the standard Store or Fetch dialogs will appear as if you had carried out the opera-
tions using the toolbar buttons on the workfile window. If you click on Edit/Paste Spe-
cial..., an alternate dialog will be displayed, allowing you to override the default frequency
conversion methods.
If, instead, you are copying between two workfiles, selecting Edit/Paste will simply copy
the series using the default frequency conversion if necessary. You will only be prompted
with a dialog if there is name collision. Selecting Edit/Paste Special... will display a dialog
allowing you to override the default conversion methods.
Drag-and-Drop
An alternative to copy-and-paste is to use drag-and-drop to copy files between containers. If
you use the right-mouse button to select the series, dropping them on the new tab is equiv-
alent to copying and then selecting Edit/Paste Special...
Copy Procedure
You may perform similar operations using the object
copy procedure. From the main menu select Object/
Copy (this may appear as Object/Copy selected…).
The Object Copy dialog will be displayed.
where source_db:: is optional, and indicates which database the objects should be copied
from (if no database name is supplied, the source is taken to be the default workfile), and
source_pattern is either a simple object name or a name pattern. A name pattern may
include the wildcard characters “?” which matches any single character, and “*” which
matches zero or more characters.
dest_db::dest_name
where dest_db:: is again optional, and indicates which database the objects should be
copied to (if no database name is supplied, the destination is taken to be the default work-
file), and dest_name, which is also optional, is the name to be given to the new copy of the
object. If no name is given, the object will be copied with its existing name. If a pattern was
used when specifying the source, a pattern must also be used when specifying the destina-
tion (see “Source and Destination Patterns” on page 544 of the Command and Programming
Reference).
For example, to copy an object from the database DB1 to the database DB2, keeping the
existing name, you would fill in the dialog:
source: db1::object_name
destination: db2::
To copy all the objects in the database DB1 beginning with the letter X into the current
workfile, changing the names so that they begin with Y, you would fill in the dialog
source: db1::x*
destination: y*
To make a duplicate copy of the object named ABC in the database DB1, giving it the new
name XYZ, you would fill in the dialog:
source: db1::abc
destination: db1::xyz
store, fetch, or copy operation on a group object, an issue arises as to whether you want to
do the operation on each of the series or to the group definition list.
By default, EViews will display a dialog asking you to select a group store option every time
you store a group object. You can, however, instruct EViews to suppress the dialog and use
the global option setting. Simply click on Options/Database Storage Defaults... in the main
EViews menu to bring up a dialog that allows you both to set the global storage options, and
to suppress the group store option dialog.
You can click on Options/Database Default Storage Options... in the main menu to bring
up a dialog that allows you both to set the global fetch options, and to suppress the fetch
option dialog.
Database Auto-Series
We have described how to fetch series into a workfile. There is an alternative way of work-
ing with databases which allows you to make direct use of the series contained in a data-
base without first copying the series. The advantage of this approach is that you need not go
through the process of importing the data every time the database is revised. This approach
follows the model of auto-series in EViews as described in “Auto-series,” beginning on
page 145.
280—Chapter 10. EViews Databases
There are many places in EViews where you can use a series expression, such as log(X),
instead of a simple series name, and EViews will automatically create a temporary auto-
series for use in the procedure. This functionality has been extended so that you can now
directly refer to a series in a database using the syntax:
db_name::object_name
where db_name is the shorthand associated with the database. If you omit the database
name and simply prefix the object name with a double colon like this:
::object_name
EViews will fetch the series named GDP from the database with the shorthand MACRO_DB,
and put the log of GDP in a new series named LGDP in the workfile. It then deletes the
series GDP from memory, unless it is in use by another object. Note that the generated
series LGDP only contains data for observations within the current workfile sample.
This will fetch the series named Y and X from the databases named DB1 and DB2, perform
any necessary frequency conversions and end point truncation so that they are suitable for
use in the current workfile, take the log of each of the series, then run the requested regres-
sion. Y and X are then deleted from memory unless they are otherwise in use.
The auto-series feature can be further extended to include automatic searching of databases
according to rules set in the database registry (see “The Database Registry” on page 281).
Using the database registry you can specify a list of databases to search whenever a series
you request cannot be found in the workfile. With this feature enabled, the series com-
mand:
series lgdp = log(gdp)
looks in the workfile for a series named GDP. If it is not found, EViews will search through
the list of databases one by one until a series called GDP is found. When found, the series
will be fetched into EViews so that the expression can be evaluated. Similarly, the regres-
sion:
equation logyeq.ls log(y) c log(x)
will fetch Y and X from the list of databases in the registry if they are not found in the work-
file. Note that the regression output will label all variables with the database name from
which they were imported.
The Database Registry—281
In general, using auto-series directly from the database has the advantage that the data will
be completely up to date. If the series in the database are revised, you do not need to repeat
the step of importing the data into the workfile. You can simply reestimate the equation or
model, and EViews will automatically retrieve new copies of any data which are required.
There is one complication to this discussion which results from the rules which regulate the
updating and deletion of auto-series in general. If there is an existing copy of an auto-series
already in use in EViews, a second use of the same expression will not cause the expression
to be reevaluated (in this case reloaded from the database); it will simply make use of the
existing copy. If the data in the database have changed since the last time the auto-series
was loaded, the new expression will use the old data.
One implication of this behavior is that a copy of a series from a database can persist for any
length of time if it is stored as a member in a group. For example, if you type:
show db1::y db2::x
this will create an untitled group in the workfile containing the expressions db1::y and
db2::x. If the group window is left open and the data in the database are modified (for
example by a store or a copy command), the group and its window will not update auto-
matically. Furthermore, if the regression:
equation logyeq.ls log(db1::y) c log(db2::x)
is run again, this will use the copies of the series contained in the untitled group; it will not
refetch the series from the database.
Selecting Options/Data-
base Registry… from the
main menu brings up the
Database Registry dialog
allowing you to view and
edit the database registry:
Long database names such as these also cause output labels to truncate, making it difficult
to see which series were used in a procedure.
By assigning full database path and name the alias DRI, we may employ the more readable
command:
Querying the Database—283
and the regression output will be labeled with the shorter names. To minimize the possibil-
ity of truncation, we recommend the use of short alias names if you intend to make use of
database auto-series.
Finally, you should tell EViews if you want to include the database in automatic database
searches by checking the Include in auto search checkbox. Click on OK to add your entry
to the list
Any registry entry may be edited, deleted, switched on or off for searching, or moved to the
top of the search order by highlighting the entry in the list and clicking the appropriate but-
ton to the right of the list box.
The remainder of the Database Registry dialog allows you to set options for automatic data-
base searching. The Auto-search checkbox is used to control EViews behavior when you
enter a command involving a series name which cannot be found in the current workfile. If
this checkbox is selected, EViews will automatically search all databases that are registered
for searching, before returning an error. If a series with the unrecognized name is found in
any of the databases, EViews will create a database auto-series and continue with the proce-
dure.
The last section of the dialog, Default Database in Search Order, lets you specify how the
default database is treated in automatic database searches. Normally, when performing an
automatic search, EViews will search through the databases contained in the Registry
Entries window in the order that they are listed (provided that the Include in auto search
box for that entry has been checked). These options allow you to assign a special role to the
default database when performing a search.
• Include at start of search order—means that the current default database will be
searched first, before searching the listed databases.
• Include at end of search order—means that the current default database will be
searched last, after searching the listed databases.
• Do not include in search—means that the current default database will not be
searched unless it is already one of the listed databases.
The query capabilities of the database can only be used interactively from the database win-
dow. There are two ways of performing a query on the database: the easy mode and the
284—Chapter 10. EViews Databases
advanced mode. Both methods are really just different ways of building up a text query to
the database. The easy mode provides a simpler interface for performing the most common
types of queries. The advanced mode offers more flexibility at the cost of increased com-
plexity.
Easy Queries
To perform an easy query, first open the database, then click on the EasyQuery button in
the toolbar at the top of the database window. The Easy Query dialog will appear containing
two text fields and a number of check boxes:
The name and description fields are each used to specify a pattern expression that the
object must meet in order to satisfy the query. The simplest possible pattern expression con-
sists of a single pattern. A pattern can either be a simple word consisting of alphanumeric
characters, or a pattern made up of a combination of alphanumeric characters and the wild-
card symbols “?” and “*”, where “?” means to match any one character and “*” means to
match zero or more characters. For example:
pr?d*ction
would successfully match the words production, prediction, and predilection. Frequently
used patterns include “s*” for words beginning in “S,” “*s” for words ending in “S,” and
“*s*” for words containing “S.” Upper or lower case is not significant when searching for
matches.
Matching is done on a word-by-word basis, where at least one word in the text must match
the pattern for it to match overall. Since object names in a database consist of only a single
word, pattern matching for names consists of simply matching this word.
Querying the Database—285
For descriptions, words are constructed as follows: each word consists of a set of consecu-
tive alphanumeric characters, underlines, dollar signs, or apostrophes. However, the follow-
ing list words are explicitly ignored: “a,” “an,” “and,” “any,” “are,” “as,” “be,” “between,”
“by,” “for,” “from,” “if,” “in,” “is,” “it,” “not,” “must,” “of,” “on,” “or,” “should,” “that,”
“the,” “then,” “this,” “to,” “with,” “when,” “where,” “while.” (This is done for reasons of
efficiency, and to minimize false matches to patterns from uninteresting words.) The three
words “and,” “or,” and “not” are used for logical expressions.
For example:
bal. of p’ment: seas.adj. by X11
is broken into the following words: “bal,” “p’ment,” “seas,” “adj,” and “x11.” The words
“of” and “by” are ignored.
A pattern expression can also consist of one or more patterns joined together with the logi-
cal operators “and,” “or,” and “not” in a manner similar to that used in evaluating logical
expressions in EViews. That is, the keyword and requires that both the surrounding condi-
tions be met, the keyword or requires that either of the surrounding conditions be met, and
the keyword not requires that the condition to the right of the operator is not met. For
example:
s* and not *s
matches all objects which contain words which begin with, but do not end with, the letter
“S”.
More than one operator can be used in an expression, in which case parentheses can be
added to determine precedence (the order in which the operators are evaluated). Operators
inside parentheses are always evaluated logically prior to operators outside parentheses.
Nesting of parentheses is allowed. If there are no parentheses, the precedence of the opera-
tors is determined by the following rules: not is always applied first; and is applied second;
and or is applied last. For example:
p* or s* and not *s
matches all objects which contain words beginning with P, or all objects which contain
words which begin with, but do not end with, the letter S.
The third filter provided in the Easy Query dialog is the ability to filter by object type. Sim-
ply select the object types which you would like displayed, using the set of check boxes near
the bottom of the dialog.
Advanced Queries
Advanced queries allow considerably more control over both the filtering and the results
which are displayed from a query. Because of this flexibility, advanced queries require some
understanding of the structure of an EViews database to be used effectively.
286—Chapter 10. EViews Databases
Each object in an EViews database is described by a set of fields. Each field is identified by
a name. The current list of fields includes:
An advanced query allows you to examine the contents of any of these fields, and to select
objects from the database by placing conditions on these fields. An advanced query can be
performed by opening the database window, then clicking on the button marked Query in
the toolbar at the top of the window. The Advanced Query dialog is displayed.
together in the database window. The Ascending and Descending buttons can be used to
reverse the ordering of the objects. For example, to see objects listed from those most
recently written in the database to those least recently written, one could simply sort by the
field last_write in Descending order.
The Where edit field is the most complicated part of the query. Input consists of a logical
expression built up from conditions on the fields of the database. The simplest expression is
an operator applied to a single field of the database. For example, to search for all series
which are of monthly or higher frequencies (where higher frequency means containing
more observations per time interval), the appropriate expression is:
freq >= monthly
Field expressions can also be combined with the logical operators and, or and not with pre-
cedence following the same rules as those described above in the section on easy queries.
For example, to query for all series of monthly or higher frequencies which begin before
1950, we could enter the expression:
freq >= monthly and start < 1950
Each field has its own rules as to the operators and constants which can be used with the
field.
Name
The name field supports the operators “<“, “<=”, “>”, “>=”, “=”, and “<>” to per-
form typical comparisons on the name string using alphabetical ordering. For example,
name >= c and name < m
will match all objects with names beginning with letters from C to L. The name field also
supports the operator “matches”. This is the operator which is used for filtering the name
field in the easy query and is documented extensively in the previous section. Note that if
matches is used with an expression involving more than one word, the expression must be
contained in quotation marks. For example,
name matches "x* or y*" and freq = quarterly
is a syntax error because the part of the expression that is related to the matches operator is
ambiguous.
Type
The type field can be compared to the standard EViews object types using the “=” operator
and the keywords: alpha, coef, equation, factor, graph, group, logl, matrix,
model, pool, sample, scalar, series, spool, sspace, string, svector, sym, system,
288—Chapter 10. EViews Databases
table, text, var, vector. Relational operators are defined for the type field, although
there is no particular logic to the ordering. The ordering can be used, however, to group
together objects of similar types in the Order By field.
Freq
The frequency field has one of the following values:
u Undated
2y, 3y, 4y, 5y, Multi-year in intervals of: 2, 3, 4, 5, 6, 7, 8,
6y, 7y, 8y, 9y, 9, 10, or 20 years, respectively.
10y, 20y
a Annual
s Semiannual
q Quarterly
m Monthly
bm Bimonthly
f Fortnight
t Ten-day (daily in intervals of ten)
w Weekly
5 5 day daily, Monday through Friday
7 7 day daily
h Hourly
min Minute
sec Second
Any word beginning with the letter above is taken to denote that particular frequency, so
that monthly can either be written as “m” or “monthly”. Ordering over frequencies is
defined so that a frequency with more observations per time interval is considered “greater”
than a series with fewer observations per time interval. The operators “<”, “>”, “<=”,
“>=”, “=”, “<>” are all defined according to these rules. For example,
freq <= quarterly
will match objects whose frequencies are quarterly, semiannual, annual or undated.
between the year and period number. Weekly, 5-day daily, and 7-day daily data are denoted
by a date in the format:
mm/dd/yyyy
where m denotes a month digit, d denotes a day digit, and y denotes a year digit.
Operators on dates are defined in accordance with calendar ordering where an earlier date is
less than a later date. Where a number of days are contained in a period, such as for
monthly or quarterly data, an observation is ordered according to the first day of the period.
For example:
start <= 1950
will include dates whose attributed day is the first of January 1950, but will not include
dates which are associated with other days in 1950, such as the second, third, or fourth
quarter of 1950. However, the expression:
start < 1951
where m represents a month digit, d represents a day digit, y represents a year digit, h repre-
sents an hour digit and m represents a minute digit.
The comparison operators are defined on the time fields so that earlier dates and times are
considered less than later dates and times. A typical comparison has the form:
last_write >= mm/dd/yyyy
A day constant always refers to twelve o’clock midnight at the beginning of that day. There
is no way to specify a particular time during the day.
Query Examples
Suppose you are looking for data related to gasoline consumption and gasoline prices in the
database named DRIBASIC. First open the database: click File/Open, select Files of type:
Database.edb and locate the database. From the database window, click Query and fill in
the Advanced Query dialog as follows:
Select: name, type, freq, description
Where: description matches gasoline
If there are any matches, the results are displayed in the database window similar to the fol-
lowing:
To view the contents of all fields of an item, double click on its name. EViews will open an
Object Description window that looks as follows:
To further restrict your search to series with at least quarterly frequency and to display the
start and end dates of the results, click Query and again and modify the fields as follows:
Select: name, type, start, end, description
Where: description matches gasoline and freq>=q
Object Aliases and Illegal Names—291
If you are interested in seasonally adjusted series, which happen to contain sa or saar in
their description in this database, further modify the fields to
Select: name, type, start, end, description
Where: description matches "gasoline and (sa or saar)" and freq>=q
The display of the query results now looks as follows:
The basic idea is as follows: each database can have one or more object aliases associated
with it where each alias entry consists of the name of the object in the database and the
name by which you would like it to be known in EViews.
The easiest way to create an object alias for an illegal name is to attempt to fetch the object
with the illegal name into EViews. If you are working with query results, you can tell which
object names are illegal because they will be displayed in the database window in red.
When you try to fetch an object with an illegal name, a dialog will appear.
292—Chapter 10. EViews Databases
When EViews displays an object in the database window for which an alias has been set,
EViews will show the alias, rather than the underlying name of the object. In order to indi-
cate that this substitution has been done, EViews displays the name of the aliased object in
blue.
Creating an alias can cause shadowing of object names. Shadowing occurs when you create
an alias for an object in the database, but the name you use as an alias is the name of
another object in the database. Because the existence of the alias will stop you from access-
ing the other object, that object is said to be shadowed. To indicate that an object name
being displayed has been shadowed, EViews displays the name of shadowed objects in
green. You will not be able to fetch an object which has been shadowed without modifying
either its name or the alias which is causing it to be shadowed. Even if the shadowed series
is explicitly selected with the mouse, operations performed on the series will use the series
with the conflicting alias, not the shadowed series.
You can view a list of the aliases currently defined for any database by clicking on the View
button at the top of the database window, then selecting Object Aliases. A list of all the
aliases will be displayed in the window.
Each line represents one alias attached to the database and follows the format:
Maintaining the Database—293
alias = database_object_name
You can edit the list of aliases to delete unwanted entries, or you can type in, or cut-and-
paste, new entries into the file. You must follow the rule that both the set of aliases and the
set of database names do not contain any repeated entries. (If you do not follow this rule,
EViews will refuse to save your changes). To save any modifications you have made, simply
switch back to the Object Display view of the database. EViews will prompt you for
whether you want to save or discard your edits.
The list of currently defined database aliases for all databases is kept in the file OBALIAS.INI
in the EViews installation directory. If you would like to replicate a particular set of aliases
onto a different machine, you should copy this file to the other machine, or use a text editor
to combine a portion of this file with the file already in use on the other machine. You must
exit and restart EViews to be sure that EViews will reread the aliases from the file.
Note that file operations do not automatically update the database registry. If you delete or
rename a database that is registered, you should either create a new database with the same
name and location, or edit the registry.
A database can be compacted down to its minimum size by using the pack procedure. Sim-
ply click on the button marked Proc in the toolbar at the top of the database window, then
select the menu item Pack the Database. Depending on the size of the database and the
294—Chapter 10. EViews Databases
speed of the computer which you are using, performing this operation may take a significant
amount of time.
You can get some idea of the amount of space that will be reclaimed during a pack by look-
ing at the Packable Space percentage displayed in the top right corner of the database win-
dow. A figure of 30%, for example, indicates that roughly a third of the database file
consists of unused space. A more precise figure can be obtained from the Database Statis-
tics view of a database. The number following the label “unused space” gives the number of
unused bytes contained in the main database file.
The best way to protect against damage to a database is to make regular backup copies of
the database. This can be performed easily using the Copy the Database procedure docu-
mented above. EViews provides a number of other features to help you deal with damaged
databases.
Damaged databases can be divided into two basic categories depending on how severely the
database has been damaged. A database which can still be opened in a database window
but generates an error when performing some operations may not be severely damaged and
may be reparable. A database which can no longer be opened in a database window is
severely damaged and will need to be rebuilt as a new database.
EViews has two procedures designed for working with databases which can be opened: Test
Database Integrity and Repair Database. Both procedures are accessed by clicking on the
button marked Proc in the database window toolbar, then selecting the appropriate menu
item.
Test Database Integrity conducts a series of validity checks on the main database and
index files. If an error is detected, a message box will be displayed, providing some informa-
tion as to the type of error found and a suggestion as to how it might be dealt with. Because
testing performs a large number of consistency checks on the database files, it may take
considerable time to complete. You can monitor its progress by watching the messages dis-
played in the status line at the bottom of the EViews window. Testing a database does not
modify the database in any way, and will never create additional damage to a database.
Repair Database will attempt to automatically detect and correct simple problems in the
database. Although care has been taken to make this command as safe as possible, it will
attempt to modify a damaged database, so it is probably best to make a back up copy of a
damaged database before running this procedure.
Foreign Format Databases—295
The dbrebuild command does a low level scan through the main data file of the database
old_dbname looking for any objects which can be recovered. Any such objects are copied
into the new database new_dbname. This is a very time consuming process, but it will
recover as much data as possible from even heavily damaged files.
When copying objects, EViews preserves not only the data itself, but as much as possible of
any date information and documentation associated with the object. Missing values are
translated automatically.
One significant difference is the time taken to search for objects using keywords in the
description field. If the data are in EViews format, EViews can typically query databases
containing tens of thousands of series in a couple of seconds. When working with other for-
mats, you may find that this same operation takes much longer, with the time increasing
substantially as the database grows.
On the other hand, keeping the data in the foreign format may allow you to move between
a number of applications without having to retranslate the file. This minimizes the number
of copies of the data you have available, which may make the data easier to update and
maintain.
296—Chapter 10. EViews Databases
Using EViews, you can either translate your data or work with your data directly in the for-
eign format. You should choose between the two based on your particular needs.
If the database is accessed through a client-server model, selecting the dialog will change to
show extra fields necessary for making the connection to the server. For example, when
accessing a database located on a FAME server, the dialog will include fields for the FAME
server, username and password.
When performing a database copy to a new format, objects which cannot be copied due to
incompatibility between formats will result in error messages in the EViews command win-
Foreign Format Databases—297
dow but will not halt the copying process. Upon completion, a message in the status line
reports how many objects could not be copied.
In addition, you must be able to access to the Thomson Datafeeds service using Datastream
Advance through an internet connection, and you must have a valid XML API account from
Thomson Financial. (Note that the XML API user name is not the Datastream user name as
used with thick client products such as Datastream Advance.)
DRIPro Link
A DRIPro link is a special type of database which allows you to fetch data remotely over the
internet from DRI’s extensive collection of economic data. To access these data, you must
have a valid DRIPro account with DRI, and you must have already installed and configured
the DRIPro server software.
There are special issues involved with using DRIPro links, which are discussed in detail in
“Working with DRIPro Links” on page 306.
DRIBase Database
The DRIBase system is a client server system used by DRI to provide databases at the client
site which can be kept current by remote updates. Customers can also use DRIBase as a
means of storing their own databases in an Sybase or Microsoft SQL Server system.
To access DRIBase databases, the TSRT library from DRI must already be installed on the
client machine (this will normally be done by DRI as part of the DRIBase installation proce-
dure).
When working with DRIBase databases, the Server specification field should be set to con-
tain the DRIBase database prefix, while the Database name field should contain the DRIB-
ase bank name, including the leading “@” where appropriate. Note that these fields, as well
298—Chapter 10. EViews Databases
as the Username and Password fields may be case sensitive, so make sure to preserve the
case of any information given to you.
A DRIBase database has slightly different handling of frequencies than most other databases
supported by EViews. See “Issues with DRI Frequencies” on page 310 for details. You
should also read “Dealing with Illegal Names” on page 309 for a discussion of how DRI
names are automatically remapped by EViews.
For further information on DRIBase, please contact IHS Global Insight (http://www.globa-
linsight.com).
EcoWin
EcoWin database support provides online access to economic and financial market data
from EcoWin. The EcoWin Economic and Financial databases contain global international
macroeconomic and financial data from more than 100 countries and multinational aggre-
gates. Additional databases provide access to equities information and detailed country-spe-
cific information on earnings estimates, equities, funds, fixed income, and macroeconomics.
For further information on EcoWin data and software, please contact EcoWin directly
(http://www.thomsonreuters.com/products_services/financial/financial_products/
investment_management/research_analysis/ecowin_pro).
With EViews Enterprise Edition, you can open an EViews window into an online EcoWin
database. This window allows browsing and text search of the series in the database, select-
ing series, and copying/exporting series into an EViews workfile or another EViews data-
base. In addition, EViews provides a set of commands that may be used to perform tasks
such as fetching a particular series from a EcoWin database.
Access to EcoWin databases within EViews Enterprise Edition requires that the EcoWin Pro
software has already been installed on the local machine, and that configuration of EcoWin
database access using the EcoWin Database Configuration software has already been com-
pleted outside of EViews.
Foreign Format Databases—299
The EcoWin Query window provides you with two methods for selecting series to be
brought into your EViews database.
First, you may use Tree Search to browse a directory structure of the online database. You
should use the tree on the left to navigate to the directory of interest, then select series in
the window on the right by clicking or control-clicking on the entry, or by clicking on the
300—Chapter 10. EViews Databases
right-mouse button and choosing Select All. Once the desired series have been highlighted,
click on OK to bring the selected data into your EViews database.
Highlight the series of interest and click on OK to bring them into the database. Repeat the
tree browsing or search method of adding series until the list in the database is complete,
then click on Cancel to close the query window.
Once series of interest have been included in the database window, all of the standard
EViews database tools, such as copy and paste into an existing workfile or database using
the right mouse menus, creating a new EViews workfile containing the data using the
Export button, or importing data into an existing EViews workfile using the Fetch menu
item from the workfile window, are available.
Note that after you have completed your initial query, you may reopen the EcoWin query
window at any time. To add series to those already available in the database window, press
the Query Append Select button in the database window, then browse or search for your
series. To first clear the contents of the database window, you should press the Query
Select button instead of the Query Append Select button.
Once the EcoWin database has been put in the registry, it may be referred to by its alias
(short hand) name. For example, if you have assigned the EcoWin database the alias “EW”,
you can open the database with the simple command:
dbopen ew
or by using the Browse Registry button in the Database Specification dialog. The database
name “EW” will be added to the most recently used file list, where it may be selected at a
later time to reopen the database.
Assigning the EcoWin database a shorthand name also allows you to reference data without
explicitly opening the database. For example, the command
equation eq1.ls ew::usa09016 c ew:usa09016(-1) @trend
runs a regression of U.S. unemployment on an intercept, its own lagged value, and a time
trend. The series USA09016 will be accessed directly from the EcoWin servers, and does not
need to appear within a currently open database window for this command to be used.
302—Chapter 10. EViews Databases
Other commands such as copy allow the name associated with the series to be changed
during the procedure, as well as supporting the copying of series directly from an EcoWin
database to another EViews database.
show ew::usa09016
Note that series in the EcoWin “Economic” or EcoWin “Financial” databases may be refer-
enced merely by using the database shorthand and the series name. In the example above,
EViews looks for USA09016 in the two base EcoWin databases.
where we follow the database name with the add-on name BOE. The series will be named
“BOE\LUM5WTL” in EViews. Note that the add-on name BOE is taken from the EcoWin
name prefix (for example, LUM5WTL appears as “BOE:LUM5WTL” within EcoWin.
FactSet
The FactSet database is a remote database provided by FactSet Research Systems. It is com-
posed of more than 800 commercial data sets of financial data. Data include international
macroeconomic, commodity, and financial time series from more than 150 countries.
Use of FactSet databases requires the Enterprise Edition of EViews and installation of Fact-
Set client software. For further information on using Factset please contact Factset directly
(http://www.factset.com).
FAME
The FAME format is a binary file format written by FAME database products. FAME pro-
vides a variety of products and services for working with time series data.
In order to access FAME databases, a valid installation of FAME must already be available.
EViews makes use of the FAME C Host Language Interface (C HLI) library, and will error
unless the FAME .DLLs are correctly installed on the machine. EViews currently supports
only version 8 of the FAME libraries.
Foreign Format Databases—303
A local FAME database can have any file extension, and EViews supports access to a FAME
database with any name. However, because many commands in EViews use the file exten-
sion to automatically detect the file type, you will generally find it easier to work with FAME
databases which have the default “.DB” extension.
EViews also allows access to FAME databases located on a FAME Database Server. When
working with a FAME server, the Server specification should be given in the form:
#port_number@ip_address
For example, the server specification for access to a FAME/Channel database might appear
as:
#[email protected]
Access to a server will require a valid username and password for that server.
FRED
FRED (Federal Reserve Economic Data) is a publicly accessible database of more than
20,000 U.S. and international time series of multiple frequencies, provided by the Economic
Research Division of the Federal Reserve Bank of St. Louis. The FRED database offers a
wide variety of freely downloadable data, including interest rates, exchange rates, national
income accounts, and many others. Data found in FRED are drawn from several national
and international sources and is updated frequently.
Prior to EViews 7, importing data from FRED required that the data first be downloaded into
either a Microsoft Excel or text file, and then be imported into an EViews workfile. EViews
users can now use EViews to directly connect to, open, query, and import data from the
FRED database using the familiar EViews database interface.
Both the Standard and Enterprise versions of EViews offer FRED access. Please note that an
internet connection will be required to obtain FRED data.
Haver
The Haver database format is a binary file format used by Haver Analytics when distributing
data.
Direct access to Haver database files is only available in the Enterprise Edition of EViews.
304—Chapter 10. EViews Databases
The main difference between Haver databases and other file formats supported by EViews is
that Haver databases are read-only. You cannot create your own database in Haver format,
nor can you modify an existing database. EViews will error if you try to do so.
Moody’s Economy.com
The Moody's Economy.com format is a binary file format written by Moody's Economy.com
tools. Moody s Economy.com features a database containing more than 190 million eco-
nomic, financial, and demographic time series covering more than 180 countries and their
sub-regions.
The Enterprise Edition of EViews is required to read Moody’s Economy.com formatted data.
AREMOS TSD
The TSD format is a portable ASCII file format written by the AREMOS package. The EViews
database tools provide an intuitive graphical interface to the data, and allows you to move
data directly in and out of an EViews database without having to move the data through a
workfile (which may force the data to be converted to a single frequency).
GiveWin/PcGive
The GiveWin/PcGive format is a binary file format used by GiveWin, PcGive versions 7
through 10, and PcFiml.
There are two issues when working with GiveWin/PcGive files. The first is that EViews is
case insensitive when working with object names, while GiveWin and PcGive are case sen-
sitive. Because of this, if you intend to work with a file in both packages, you should avoid
having two objects with names distinguished only by case. If your files do not follow this
rule, EViews will only be able to read the last of the objects with the same name. Any early
objects will be invisible.
The second issue concerns files with mixed frequency. The GiveWin/PcGive file format
does support series of mixed frequency, and EViews will write to these files accordingly.
However, GiveWin itself appears to only allow you to read series from one frequency at a
time, and will ignore (with error messages) any series which do not conform to the chosen
frequency. Consequently, depending on your application, you may prefer to store series of
only one frequency per GiveWin/PcGive file.
Foreign Format Databases—305
RATS 4.x
The RATS 4.x format is a binary file format used by RATS Version 4 through 7 on all plat-
forms.
The main issue to be aware of when working with RATS 4.x format files is that the “.RAT”
extension is also used by RATS version 3 files. EViews will neither read from nor write to
RATS files in this earlier format. If you try to use EViews to open one of these files, EViews
will error, giving you a message that the file has a version number which is not supported.
To work with a RATS Version 3 file in EViews, you will first have to use RATS to translate
the file to the Version 4 format. To convert a Version 3 file to a Version 4 file, simply load
the file into RATS and modify it in some way. When you save the file, RATS will ask you
whether you would like to translate the file into the new format. One simple way to modify
the file without actually changing the data is to rename a series in the file to the name which
it already has. For example, if we have a Version 3 file called “OLDFILE.RAT”, we can con-
vert to a Version 4 by first opening the file for editing in RATS:
dedit oldfile.rat
then renaming one of the series (say “X”) to its existing name
rename x x
At this point, you will be prompted whether you would like to translate the file into the Ver-
sion 4 format.
RATS Portable/TROLL
The RATS portable format is an ASCII file format which can be read and written by RATS. It
is generally slower to work with than RATS native format, but the files are human readable
and can be modified using a text editor.
You can read the contents of a RATS portable file into memory in RATS with the following
commands:
open data filename.trl
data(format=portable) start end list_of_series
close data
TSP Portable
The TSP portable format is an ASCII file format which can be read and written by copies of
TSP on all platforms. The file consists of a translation of a TSP native databank (which typ-
ically have the extension “.TLB”) into a TSP program which, when executed, will regenerate
the databank on the new machine.
To create a TSP portable file from a TSP databank file, use the DBCOPY command from
within TSP:
dbcopy databank_name
To translate a TSP portable file back into a TSP databank file, simply execute the TSP file as
a TSP program.
Once the data are in TSP databank format, you can use the TSP command,
in databank_name
to set the automatic search to use this databank and the TSP command,
out databank_name
to save any series which are created or modified back to the databank.
Although the interface to remote databases is very similar to that of local databases, there
are some differences due to the nature of the connection. There are also some issues specif-
ically related to accessing DRI data. The following sections document these differences.
Access to DRI data will not be possible unless you have already installed and configured the
DRIPro server software. If you have difficulties with getting the software to work, you
should contact Global Insight directly for technical support.
You can create a database link by following a similar procedure to that used to create a local
database. Select File/New/Database… from the main menu, then select DRIPro Link in the
field Database/File Type. The dialog should change appearance so that a number of extra
fields are displayed. Enter the name you would like to give the new database link in Cache
name/path. You may wish to name the database link after the DRI databank to which it
links.
The Local Password field may be used to set a password that must be entered whenever
you wish to use the database link. This should not be confused with your DRIPro username
and password, which you must already have provided in the DRIPro configuration program.
Accessing a database link which contains a local password will cause a dialog to appear
which prompts the user to input the password. Access to the remote database is only pro-
vided if the remote password is valid. Leave this field blank if you do not want a password
to be attached to the database link.
308—Chapter 10. EViews Databases
When you have finished filling in the dialog fields, click on the OK button. A new database
will be created and a database window should appear on the screen.
The database link window is very similar to a normal EViews database window. You should
be able to perform basic query operations and simple fetching of series without any special
instructions. Note, however, that it is not possible to modify a remote DRI database from
within EViews, so operations which involve writing to the database have been removed.
There are a number of other complications related to dealing with DRIPro databases that are
described “Issues with DRI Frequencies” on page 310.
You can regulate the caching behavior of the database link in a number of different ways.
The basic option which determines under what circumstances a new copy of the data
should be fetched is the days before refresh. If you attempt to fetch an object from the data-
base link, and the copy of the object currently in the cache was fetched more recently than
the days before refresh value, then the object currently in the cache will be returned instead
of a fresh copy being fetched. For example, if days before refresh is set to one, any object
which has already been fetched today will be retrieved from the cache, while any object
which has not yet been fetched today will be retrieved from the remote site. Similarly, if
days before refresh is set to seven, then an object in the cache must be more than a week
old before a new copy of the object will be fetched. If days before refresh is set to zero, then
a new copy of the data is fetched every time it is used.
You can change the days before refresh setting by clicking on the Proc button at the top of
the database link window, then choosing Link Options… from the pop-up menu. A dialog
will appear:
time each object is fetched, it is guaranteed that a fresh copy will be retrieved. This provides
a simple way for you to be certain that the database link will not return any data fetched
before a particular time.
The dialog also contains some options for managing the size of the cache. The field marked
Maximum cache size in kilobytes can be used to set the maximum size that the cache will
be allowed to grow to on disk. If the cache grows above this size, a prompt will appear
warning you that the cache has exceeded the limit and asking if you would like to compact
the cache. Compacting is performed by deleting objects from oldest to newest until the
cache size is reduced to less than three quarters of its maximum size. The cache is then
packed to reclaim the empty space.
You can also completely clear the contents of the cache at any time by clicking on the but-
ton marked Reset & Clear Cache Now.
You can always examine the current contents of the database cache by clicking on the
Cache button at the top of the database link window. This will display the names of all
objects currently in the cache.
The values are attached to a particular database link, and can be reset at any time.
Because the “@” symbol is so common in DRI names, while the underline symbol (which is
a legal character in EViews) is unused, we have hard-coded the rule that all underlines in
EViews are mapped into “@” symbols in DRI names when performing operations on an DRI
database link. For example, if there is a series with the name JQIMET@UK, you should refer
310—Chapter 10. EViews Databases
to this series inside EViews as JQIMET_UK. Note that when performing queries, EViews will
automatically replace the “@” symbol by an underline in the object name before displaying
the query results on the screen. Consequently, if you are fetching data by copying-and-past-
ing objects from a query window, you do not need to be aware of this translation.
For other illegal names, you should use the object aliasing features (see “Object Aliases and
Illegal Names” on page 291) to map the names into legal EViews object names.
Because this approach is inconsistent with the way that EViews works, we have tried to cre-
ate a simpler interface to DRI data where you do not need to keep track of the frequency of
each series that you would like to fetch. Instead, you can simply fetch a series by name or
by selecting it from the query window, and EViews will do whatever is necessary to find out
the frequency for you.
An ambiguity can arise in doing this, where a series with the same name appears at a vari-
ety of different frequencies in the DRI databank. By default, EViews resolves this ambiguity
by always fetching the highest frequency data available. EViews will then perform necessary
frequency conversions using the standard rules for frequency conversion in EViews (see
“Frequency Conversion” on page 117).
In many cases, this procedure will exactly replicate the results that would be obtained if the
lower frequency data was fetched directly from DRIPro. In some cases (typically when the
series in question is some sort of ratio or other expression of one or more series), the figures
may not match up exactly. In this case, if you know that the DRI data exists at multiple fre-
quencies and you are familiar with DRI frequency naming conventions, you can explicitly
fetch a series from a DRI database at a particular frequency by using a modified form of the
command line form of fetch. Simply add the DRI frequency in parentheses after the name of
the series. For example, the command:
fetch x(Q) y(A)
will fetch the series X and Y from the current default database, reading the quarterly fre-
quency copy of X and the annual frequency copy of Y. If you request a frequency at which
the data are not available, you will receive an error message. You should consult DRI docu-
mentation for details on DRI frequencies.
Working with DRIPro Links—311
First, queries on DRI databases allow only a subset of the fields available in EViews data-
bases to be selected. The fields supported are: name, type, freq, start, end,
last_update and description.
Second, the only fields which can be used in “where” conditions in a query on a DRIPro
database link are name and description. (EViews does not support queries by frequency
because of the ambiguities arising from DRI frequencies noted above).
Each of these fields has only one operator, the “matches” operator, and operations on the
two fields can only be joined together using the “and” operator.
The “matches” operator is also limited for queries on DRI databases, matching only a subset
of the expressions available for EViews databases. In particular, the pattern expression in a
query on an DRI database must either have the form
a or b or … c
or the form
a and b and … c
Mixing of “and” and “or” is not allowed, and the “not” operator is not supported.
Patterns, however, are allowed and follow the normal EViews rules where “?” denotes any
single character and “*” denotes zero or more characters.
Assuming that you have correctly configured your DRIPro connection, in most cases EViews
will be able to recover adequately from unexpected problems which arise during a DRIPro
session without user intervention. Sometimes this will require EViews to automatically dis-
connect then reconnect to DRI.
There are some circumstances in which EViews may have problems making a connection.
In order to connect to DRI, EViews uses a program written by DRI called DRIprosv. You can
tell when this program is running by looking for the icon labeled “DRIpro server” in the
Windows taskbar. Because of problems that can arise with multiple connections, EViews
will not attempt to use the program if it is already running. Instead, EViews will report an
312—Chapter 10. EViews Databases
error message “DRI server software already running”. If there is another application which
is using the connection to DRI, you can simply close down that program and the DRIPro
server software should shut down automatically. If this is not the case, you may have to
close down the DRIPro server software manually. Simply click on the icon in the Windows
taskbar with the right mouse button, then select Close from the pop-up menu.
You may also use this as a procedure for forcing the DRIPro connection to terminate. Clos-
ing down the server software may cause EViews to report an error if it is currently carrying
out a database transaction, but should otherwise be safe. EViews will restart the server soft-
ware whenever it is needed.
Note that running other DRIPro software while EViews is using the DRIPro server software
may cause EViews to behave unreliably.
Part II. Basic Data Analysis
The following chapters describe the EViews objects and tools that you will use to perform
basic data analysis.
• Chapter 11. “Series,” beginning on page 315 describes the series object. Series are the
basic unit of numeric data in EViews and are the basis for most univariate analysis.
This chapter documents the basic data analysis and display features associated with
series.
• Chapter 12. “Groups,” on page 379 documents the views and procedures for the
group object. Groups are collections of series (and series equivalent objects) which
form the basis for a variety of multivariate graphical display and data analyses.
• Chapter 13. “Graphing Data,” beginning on page 435 describes the display of graph
views of data in series and group objects.
• Chapter 14. “Categorical Graphs,” on page 523 describes the construction of categori-
cal graphs formed using subsets of the data in series or groups
314—Part II. Basic Data Analysis
Chapter 11. Series
Series views compute various statistics for a single series and display these statistics in
various forms such as spreadsheets, tables, and graphs. The views range from a simple
line graph, to kernel density estimators. Series procedures create new series from the
data in existing series. These procedures include various seasonal adjustment meth-
ods, exponential smoothing methods, and the Hodrick-Prescott filter.
The group object is used when working with more than one series at the same time.
Methods which involve groups are described in Chapter 12. “Groups,” on page 379.
To access the views and procedures for series, open the series window by double
clicking on the series name in the workfile, or by typing show followed by the name of
the series in the command window.
Spreadsheet
Graph
The Graph... menu item brings up the Graph Options dialog, which allows you to select
various types of graphical display of the series. You can create graph objects by freezing
these views. See Chapter 13. “Graphing Data,” beginning on page 435 for a discussion of
techniques for creating and customizing the graphical display.
(If you would like to produce a histogram were you have greater control over the bin width
and placement, or if you would like to construct related graphs such as a kernel density plot
or histogram polynomial, you should use the graph view of the series.)
A complement of standard
descriptive statistics are
displayed along with the
histogram. All of the statis-
tics are calculated using
the observations in the
current sample.
• Mean is the average
value of the series,
obtained by adding
up the series and
dividing by the num-
ber of observations.
• Median is the mid-
dle value (or aver-
age of the two middle values) of the series when the values are ordered from the
smallest to the largest. The median is a robust measure of the center of the distribu-
tion that is less sensitive to outliers than the mean.
• Max and Min are the maximum and minimum values of the series in the current sam-
ple.
• Std. Dev. (standard deviation) is a measure of dispersion or spread in the series. The
standard deviation is given by:
Ê N 2ˆ
s = Á Â ( yi – y ) ˜ § ( N – 1 ) (11.1)
Ëi = 1 ¯
where N is the number of observations in the current sample and y is the mean of
the series.
• Skewness is a measure of asymmetry of the distribution of the series around its
mean. Skewness is computed as:
N 3
1 i – yˆ
Ê y-------------
S = ----
N Â Ë ĵ ¯
- (11.2)
i =1
where ĵ is an estimator for the standard deviation that is based on the biased estima-
tor for the variance ( ĵ = s ( N – 1 ) § N ) . The skewness of a symmetric distribution,
such as the normal distribution, is zero. Positive skewness means that the distribution
318—Chapter 11. Series
has a long right tail and negative skewness implies that the distribution has a long left
tail.
• Kurtosis measures the peakedness or flatness of the distribution of the series. Kurto-
sis is computed as
N 4
1 yi – y
K = ----
N Â ÊË -------------
ĵ ¯
-ˆ (11.3)
i= 1
where ĵ is again based on the biased estimator for the variance. The kurtosis of the
normal distribution is 3. If the kurtosis exceeds 3, the distribution is peaked (leptokur-
tic) relative to the normal; if the kurtosis is less than 3, the distribution is flat
(platykurtic) relative to the normal.
• Jarque-Bera is a test statistic for testing whether the series is normally distributed.
The test statistic measures the difference of the skewness and kurtosis of the series
with those from the normal distribution. The statistic is computed as:
2
N (K – 3)
Jarque-Bera = ---- Ê S + --------------------- ˆ
2
(11.4)
6Ë 4 ¯
where S is the skewness, and K is the kurtosis.
Under the null hypothesis of a normal distribution, the Jarque-Bera statistic is distrib-
2
uted as x with 2 degrees of freedom. The reported Probability is the probability that
a Jarque-Bera statistic exceeds (in absolute value) the observed value under the null
hypothesis—a small probability value leads to the rejection of the null hypothesis of a
normal distribution. For the LWAGE series displayed above, we reject the hypothesis
of normal distribution at the 5% level but not at the 1% significance level.
Stats Table
The Stats Table view displays
descriptive statistics for the series in
tabular form.
Stats by Classification
This view allows you to compute
the descriptive statistics of a series
for various subgroups of your sam-
ple. If you select View/Descriptive
Descriptive Statistics & Tests—319
By default, EViews excludes observations which have missing values for any of the classifi-
cation series. To treat NA values as a valid subgroup, select the NA handling option.
The Layout option allows you to control the display of the statistics. Table layout arrays the
statistics in cells of two-way tables. The list form displays the statistics in a single line for
each classification group.
The Table and List options are only relevant if you use more than one series as a classifier.
The Sparse Labels option suppresses repeating labels in list mode to make the display less
cluttered.
The Row Margins, Column Margins, and Table Margins instruct EViews to compute sta-
tistics for aggregates of your subgroups. For example, if you classify your sample on the
basis of gender and age, EViews will compute the statistics for each gender/age combina-
tion. If you elect to compute the marginal statistics, EViews will also compute statistics cor-
responding to each gender, and each age subgroup.
A classification may result in a large number of distinct values with very small cell sizes. By
default, EViews automatically groups observations into categories to maintain moderate cell
sizes and numbers of categories. Group into Bins provides you with control over this pro-
cess.
320—Chapter 11. Series
Setting the # of values option tells EViews to group data if the classifier series takes more
than the specified number of distinct values.
The Avg. count option is used to bin the series if the average count for each distinct value
of the classifier series is less than the specified number.
The Max # of bins specifies the maximum number of subgroups to bin the series. Note that
this number only provides you with approximate control over the number of bins.
The default setting is to bin the series into 5 subgroups if either the series takes more than
100 distinct values or if the average count is less than 2. If you do not want to bin the series,
unmark both options.
For example, consider the following stats by classification table view of the series LWAGE,
categorized by values of MARRIED and UNION (from the workfile “Cps88.WF1”):
Mean
Media n
Std. Dev. UNION
Obs. 0 1 All
0 1.993829 2.3 87019 2.052972
1.906575 2.4 09132 2.014903
0.574636 0.3 95838 0.568689
305 54 359
The header indicates that the table cells are categorized by two series MARRIED and
UNION. These two series are dummy variables that take only two values. No binning is per-
formed; if the series were binned, intervals rather than a number would be displayed in the
margins.
The upper left cell of the table indicates the reported statistics in each cell; in this case, the
median and the number of observations are reported in each cell. The row and column
labeled All correspond to the Row Margin and Column Margin options described above.
Descriptive Statistics & Tests—321
For series functions that compute by-group statistics and produce new series, see “By-Group
Statistics” on page 400 in the Command and Programming Reference.
Mean Test
Carries out the test of the null hypothesis that
the mean m of the series X is equal to a specified
value m against the two-sided alternative that it
is not equal to m :
H0: m = m
(11.5)
H 1 : m π m.
If you do not specify the standard deviation of X, EViews reports a t-statistic computed as:
X–m
t = --------------- (11.6)
s§ N
where X is the sample mean of X, s is the unbiased sample standard deviation, and N is
the number of observations of X. If X is normally distributed, under the null hypothesis the
t-statistic follows a t-distribution with N – 1 degrees of freedom.
322—Chapter 11. Series
If you specify a value for the standard deviation of X, EViews also reports a z-statistic:
X–m
z = ---------------- (11.7)
j§ N
where j is the specified standard deviation of X. If X is normally distributed with standard
deviation j , under the null hypothesis, the z-statistic has a standard normal distribution.
To carry out the mean test, type in the value of the mean under the null hypothesis in the
edit field next to Mean. If you want to compute the z-statistic conditional on a known stan-
dard deviation, also type in a value for the standard deviation in the right edit field. You can
type in any number or standard EViews expression in the edit fields.
The reported probability value is the p-value, or marginal significance level, against a two-
sided alternative. If this probability value is less than the size of the test, say 0.05, we reject
the null hypothesis. Here, we strongly reject the null hypothesis for the two-sided test of
equality. The probability value for a one-sided alternative is one half the p-value of the two-
sided test.
Variance Test
Carries out the test of the null hypothesis that the variance of a series X is equal to a speci-
2 2
fied value j against the two-sided alternative that it is not equal to j :
2
H 0 : var ( x ) = j
(11.8)
2
H 1 : var ( x ) π j .
2
EViews reports a x statistic computed as:
2
2 ( N – 1 )s -
x = -----------------------
2
(11.9)
j
where N is the number of observations, s is the sample standard deviation, and X is the
sample mean of X. Under the null hypothesis and the assumption that X is normally distrib-
2
uted, the statistic follows a x distribution with N – 1 degrees of freedom. The probability
Descriptive Statistics & Tests—323
2
value is computed as min ( p, 1 – p ) , where p is the probability of observing a x -statistic
as large as the one actually observed under the null hypothesis.
To carry out the variance test, type in the value of the variance under the null hypothesis in
the field box next to Variance. You can type in any positive number or expression in the
field.
Median Test
Carries out the test of the null hypothesis that the median of a series X is equal to a specified
value m against the two-sided alternative that it is not equal to m :
H 0 : med ( x ) = m
(11.10)
H 1 : med ( x ) π m.
EViews reports three rank-based, nonparametric test statistics. The principal references for
this material are Conover (1980) and Sheskin (1997).
• Binomial sign test. This test is based on the idea that if the sample is drawn ran-
domly from a binomial distribution, the sample proportion above and below the true
median should be one-half. Note that EViews reports two-sided p-values for both the
sign test and the large sample normal approximation (with continuity correction).
• Wilcoxon signed ranks test. Suppose that we compute the absolute value of the dif-
ference between each observation and the mean, and then rank these observations
from high to low. The Wilcoxon test is based on the idea that the sum of the ranks for
the samples above and below the median should be similar. EViews reports a p-value
for the asymptotic normal approximation to the Wilcoxon T-statistic (correcting for
both continuity and ties). See Sheskin (1997, p. 82–94) and Conover (1980, p. 284).
• Van der Waerden (normal scores) test. This test is based on the same general idea
as the Wilcoxon test, but is based on smoothed ranks. The signed ranks are smoothed
by converting them to quantiles of the normal distribution (normal scores). EViews
reports the two-sided p-value for the asymptotic normal test described by Conover
(1980).
324—Chapter 11. Series
To carry out the median test, type in the value of the median under the null hypothesis in
the edit box next to Median. You can type any numeric expression in the edit field.
Total 1000
For single sample tests, see the discussion of “Simple Hypothesis Tests” on page 321. For
tests of equality across different series, see “Tests of Equality” on page 408.
where x g is the sample mean within group g and x is the overall sample mean. The F-sta-
tistic for the equality of group means is computed as:
SS B § ( G – 1 )
F = ------------------------------------
- (11.13)
SS W § ( N – G )
where N is the total number of observations. The F-statistic has an F-distribution with
G – 1 numerator degrees of freedom and N – G denominator degrees of freedom under
the null hypothesis of independent and identical normal distributed data, with equal means
and variances in each subgroup.
When the subgroup variances are heterogeneous, we may use the Welch (1951) version of
the test statistic. The basic idea is to form a modified F-statistic that accounts for the
unequal variances. Using the Cochran (1937) weight function,
2
w g = ng § sg (11.14)
2
where s g is the sample variance in subgroup g , we form the modified F-statistic
G
2
 w g ( x g – x∗ ) § ( G – 1 )
F∗ = -----------------------------------------------------------------
g = 1 -
2
(11.15)
G
2(G – 2) ( 1 – hg )
1 + --------------------- - Â ----------------------
G –1
2 ng – 1
g = 1
The numerator of the adjusted statistic is the weighted between-group mean squares and
the denominator is the weighted within-group mean squares. Under the null hypothesis of
equal means but possibly unequal variances, F∗ has an approximate F-distribution with
( G – 1, DF∗ ) degrees-of-freedom, where
2
( G – 1)
DF∗ = ------------------------------------ (11.17)
G 2
( 1 – hg )
3 Â --------------------- -
ng – 1
g = 1
For tests with only two subgroups ( G = 2 ) , EViews also reports the t-statistic, which is
simply the square root of the F-statistic with one numerator degree of freedom. Note that
for two groups, the Welch test reduces to the Satterthwaite (1946) test.
The top portion of the output contains the ANOVA results for a test of equality of means for
LWAGE categorized by the four groups defined by the series MARRIED and UNION:
The results show that there is strong evidence that LWAGE differs across groups defined by
MARRIED and UNION; both the standard ANOVA and the Welch adjusted ANOVA statistics
are in excess of 40, with probability values near zero.
The analysis of variance table shows the decomposition of the total sum of squares into the
between and within sum of squares, where:
Mean Sq. = Sum of Sq./df
Category Statistics
Std. Err.
UNION MARRIED Count Mean Std. Dev. of Mean
0 0 305 1.993829 0.574636 0.032904
0 1 479 2.368924 0.557405 0.025468
1 0 54 2.387019 0.395838 0.053867
1 1 162 2.492371 0.380441 0.029890
All 1000 2.275496 0.563464 0.017818
We note that the “median” category in which we place these tests is somewhat misleading
since the tests focus more generally on the equality of various statistics computed across
subgroups. For example, the Wilcoxon test examines the comparability of mean ranks
across subgroups. The categorization reflects common usage for these tests and various
textbook definitions. The tests should, of course, have power against median differences.
In the two group setting, the null hypothesis is that the two subgroups are independent sam-
ples from the same general distribution. The alternative hypothesis may loosely be defined
as “the values [of the first group] tend to differ from the values [of the second group]” (see
Conover 1980, p. 281 for discussion). See also Bergmann, Ludbrook and Spooren (2000) for
a more precise analysis of the issues involved.
• Wilcoxon rank sum test. This test is computed when there are two subgroups. The
test is identical to the Wilcoxon signed rank median test (“Median Test” on page 323)
but the division of the series into two groups is based upon the values of the classifi-
cation variable instead of the value of the observation relative to the median.
• Chi-square test for the median. This is a rank-based ANOVA test based on the com-
parison of the number of observations above and below the overall median in each
subgroup. This test is sometimes referred to as the median test (Conover, 1980).
Under the null hypothesis, the median chi-square statistic is asymptotically distrib-
2
uted as a x with G – 1 degrees of freedom. EViews also reports Yates’ continuity
corrected statistic. You should note that the use of this correction is controversial
(Sheskin, 1997, p. 218).
• Kruskal-Wallis one-way ANOVA by ranks. This is a generalization of the Mann-
Whitney test to more than two subgroups. The idea behind the Mann-Whitney test is
to rank the series from smallest value (rank 1) to largest, and to compare the sum of
328—Chapter 11. Series
the ranks from subgroup 1 to the sum of the ranks from subgroup 2. If the groups
have the same median, the values should be similar.
EViews reports the asymptotic normal approximation to the U-statistic (with continu-
ity and tie correction) and the p-values for a two-sided test. For details, see Sheskin
(1997). The test is based on a one-way analysis of variance using only ranks of the
2
data. EViews reports the x chi-square approximation to the Kruskal-Wallis test sta-
tistic (with tie correction). Under the null hypothesis, this statistic is approximately
2
distributed as a x with G – 1 degrees of freedom (see Sheskin, 1997).
• van der Waerden (normal scores) test. This test is analogous to the Kruskal-Wallis
test, except that we smooth the ranks by converting them into normal quantiles
(Conover, 1980). EViews reports a statistic which is approximately distributed as a
2
x with G – 1 degrees of freedom under the null hypothesis.
The top portion of the output displays the test statistics:
In addition to the test statistics and p-values, EViews reports values for the components of
the test statistics for each subgroup of the sample. For example, the column labeled Mean
Score contains the mean values of the van der Waerden scores (the smoothed ranks) for
each subgroup.
Category Statistics
> Overall
UNION MARRIED Count Median Median Mean Rank Mean Score
0 0 305 1.906575 89 358.9082 -0.489333
0 1 479 2.327278 245 540.5073 0.161730
1 0 54 2.409132 35 568.6852 0.194415
1 1 162 2.525729 109 626.0556 0.380258
All 1000 2.302585 478 500.5000 0.000322
Descriptive Statistics & Tests—329
Levene (Conover, et al. (1981), Brown and Forsythe (1974a, 1974b), Neter, et al.
(1996)).
As with the other equality tests, the top portion of the output displays the test results:
The bottom portion of the output shows the intermediate calculations used in forming the
test statistic:
Category Statistics
You can test whether your series is normally distributed, or whether it comes from, among
others, an exponential, extreme value, logistic, chi-square, Weibull, or gamma distribution.
You may provide parameters for the distribution, or EViews will estimate the parameters for
you.
To carry out the test, simply double click on the series and select View/Descriptive Statis-
tics & Tests/Empirical Distribution Tests... from the series window.
Descriptive Statistics & Tests—331
The Estimation Options tab provides control over any iterative estimation that is required.
You should not need to use this tab unless the output indicates failure in the estimation pro-
cess. Most of the options in this tab should be self-explanatory. If you select User-specified
starting values, EViews will take the starting values from the C coefficient vector.
It is worth noting that some distributions have positive probability on a restricted domain. If
the series data take values outside this domain, EViews will report an out-of-range error.
Similarly, some of the distributions have restrictions on domain of the parameter values. If
you specify a parameter value that does not satisfy this restriction, EViews will report an
error message.
The output from this view consists of two parts. The first part displays the test statistics and
associated probability values.
Here, we show the output from a test for normality where both the mean and the variance
are estimated from the series data. The first column, “Value”, reports the asymptotic test
statistics while the second column, “Adj. Value”, reports test statistics that have a finite
332—Chapter 11. Series
sample correction or adjusted for parameter uncertainty (in case the parameters are esti-
mated). The third column reports p-value for the adjusted statistics.
All of the reported EViews p-values will account for the fact that parameters in the distribu-
tion have been estimated. In cases where estimation of parameters is involved, the distribu-
tions of the goodness-of-fit statistics are non-standard and distribution dependent, so that
EViews may report a subset of tests and/or only a range of p-value. In this case, for exam-
ple, EViews reports the Lilliefors test statistic instead of the Kolmogorov statistic since the
parameters of the normal have been estimated. Details on the computation of the test statis-
tics and the associated p-values may be found in Anderson and Darling (1952, 1954), Lewis
(1961), Durbin (1970), Dallal and Wilkinson (1986), Davis and Stephens (1989), Csörgö and
Faraway (1996) and Stephens (1986).
The second part of the output table displays the parameter values used to compute the the-
oretical distribution function. Any parameters that are specified to estimate are estimated by
maximum likelihood (for the normal distribution, the ML estimate of the standard deviation
is subsequently degree of freedom corrected if the mean is not specified a priori). For
parameters that do not have a closed form analytic solution, the likelihood function is max-
imized using analytic first and second derivatives. These estimated parameters are reported
with a standard error and p-value based on the asymptotic normal distribution.
One-Way Tabulation
Cross-tabulation ( n -way tabulation) is also available as a group view. See “N-Way Tabula-
tion” on page 404 for details.
Correlogram
of the series.
You should also specify the highest order of lag to display the correlogram; type in a posi-
tive integer in the field box. The series view displays the correlogram and associated statis-
tics:
334—Chapter 11. Series
Autocorrelations (AC)
The autocorrelation of a series Y at lag k is estimated by:
T
 ( Y t – Y ) ( Yt – k – Y )
tk = = k+1
t-------------------------------------------------------------------
- (11.19)
T
2
 ( Yt – Y)
t=1
where Y is the sample mean of Y . This is the correlation coefficient for values of the series
k periods apart. If t 1 is nonzero, it means that the series is first order serially correlated. If
t k dies off more or less geometrically with increasing lag k , it is a sign that the series obeys
a low-order autoregressive (AR) process. If t k drops to zero after a small number of lags, it
is a sign that the series obeys a low-order moving-average (MA) process. See “Serial Corre-
lation Theory” on page 705 of User’s Guide II for a more complete description of AR and MA
processes.
Note that the autocorrelations estimated by EViews, which follow those in the literature, dif-
fer slightly from the theoretical definition of the autocorrelation:
T
 ( ( Yt – Y )( Yt – k – Yt – k ) ) § ( T – K )
tk = =k+1
t---------------------------------------------------------------------------------------------------------
- (11.20)
T
2
 ( Yt – Y ) § T
t =1
The dotted lines in the plots of the autocorrelations are the approximate two standard error
bounds computed as ± 2 § ( T ) . If the autocorrelation is within these bounds, it is not sig-
nificantly different from zero at (approximately) the 5% significance level.
The PAC of a pure autoregressive process of order p , AR( p ), cuts off at lag p , while the
PAC of a pure moving average (MA) process asymptotes gradually to zero.
Ï t1 for k = 1
Ô
Ô k–1
Ô
fk = Ì
tk – Â f k – 1, j t k – j
(11.21)
= for k > 1
Ô j 1
------------------------------------------------
k–1
-
Ô
Ô
Ó
1– Â f k – 1, j t k – j
j =1
where e t is a residual. The dotted lines in the plots of the partial autocorrelations are the
approximate two standard error bounds computed as ± 2 § ( T ) . If the partial autocorrela-
tion is within these bounds, it is not significantly different from zero at (approximately) the
5% significance level.
Q-Statistics
The last two columns reported in the correlogram are the Ljung-Box Q-statistics and their p-
values. The Q-statistic at lag k is a test statistic for the null hypothesis that there is no auto-
correlation up to order k and is computed as:
336—Chapter 11. Series
k 2
tj
Q LB = T ( T + 2 ) Â -------------
T–J
- (11.24)
j = 1
where t j is the j-th autocorrelation and T is the number of observations. If the series is not
based upon the results of ARIMA estimation, then under the null hypothesis, Q is asymptot-
2
ically distributed as a x with degrees of freedom equal to the number of autocorrelations. If
the series represents the residuals from ARIMA estimation, the appropriate degrees of free-
dom should be adjusted to represent the number of autocorrelations less the number of AR
and MA terms previously estimated. Note also that some care should be taken in interpret-
ing the results of a Ljung-Box test applied to the residuals from an ARMAX specification (see
Dezhbaksh, 1990, for simulation evidence on the finite sample performance of the test in
this setting).
The Q-statistic is often used as a test of whether the series is white noise. There remains the
practical problem of choosing the order of lag to use for the test. If you choose too small a
lag, the test may not detect serial correlation at high-order lags. However, if you choose too
large a lag, the test may have low power since the significant correlation at one lag may be
diluted by insignificant correlations at other lags. For further discussion, see Ljung and Box
(1979) or Harvey (1990, 1993).
Long-run Variance
You may compute estimates of the long-run variance of a series using this view. See
Appendix E. “Long-run Covariance Estimation,” beginning on page 1413 of User’s Guide II
for a discussion of the long-run variance and role of this statistic in modern econometric
analysis.
The group object version of this view, which is almost identical to the series object version,
is described in detail in “Long-run Covariance” on page 422.
In the panel context, this view carries out Levin, Lin and Chu, Breitung, Im, Pesaran and
Shin, Fisher-type tests using ADF and PP tests (Maddala and Wu, and Choi), and Hadri
panel unit root tests.
Label—337
See “Unit Root Testing” on page 999 of User’s Guide II for a discussion of stationary and
nonstationary time series and additional details on how to carry out the unit roots tests in
EViews.
See “Variance Ratio Test” on page 1022 of User’s Guide II for a discussion of the Lo and
MacKinlay test and other variance ratio tests that you may perform using the series view.
The BDS test is a portmanteau test for time based dependence in a series. It can be used for
testing against a variety of possible deviations from independence, including linear depen-
dence, non-linear dependence, or chaos. The test can be applied to a series of estimated
residuals to check whether the residuals are independent and identically distributed (iid).
For example, the residuals from an ARMA model can be tested to see if there is any non-lin-
ear dependence in the series after the linear ARMA model has been fitted.
See “BDS Independence Test” on page 1031 of User’s Guide II for a description of the BDS
test.
Label
This view displays a description of the series object.
The Name is the series name as it appears in the workfile; you can rename your series by
editing this cell. If you fill in the Display Name field, this name may be used in tables and
graphs in place of the standard object name. Unlike ordinary object names, Display Names
may contain spaces and preserve capitalization (upper and lower case letters).
See Chapter 10. “EViews Databases,” on page 267 for further discussion of label fields and
their use in Database searches.
Properties
Clicking on the Properties button on the series toolbar provides access to the dialog control-
ling various series properties.
There are several tabs in the dialog. The first tab, labeled Display, allows you to set the
default display characteristics for the series (see “Changing the Spreadsheet Display” on
page 82). The Values tab may be used to define or modify a formula, turning the series into
an auto-updating series, or to freeze the series values at their current levels (see “Defining
an Auto-Updating Series” on page 156). The last Value Map tab should be used to assign
value maps to the series (see “Value Maps” on page 169).
Each series has a default up and down frequency conversion method. By default, the series
will take its settings from the EViews global options (see “Frequency Conversion” on
page 624). This default series setting is labeled EViews default. You may, of course, over-
ride these settings for a given series. Here, instead of using the global defaults, the high to
low conversion method is set to Sum observations without propagating NAs.
Generate by Classification—339
When working with numeric series, you may also use series
procs to resample from the original series, to perform sea-
sonal adjustment or exponential smoothing, to filter the
series using the Hodrick-Prescott or band-pass filters, or to
output data used in constructing various distribution graphs
such as histograms and kernel density plots.
For alpha series you may use a series proc to make a valmapped
numeric series. EViews will create a new numeric series and val-
map so that each value in the numeric series is mapped to the original alpha series value.
Generate by Equation
This is a general procedure that allows you to create new series by using expressions to
transform the values in the existing series. The rules governing the generation of series are
explained in detail in “Series Expressions” on page 133.
Generate by Classification
The series classification procedure generates a categorical series using ranges, or bins, of
values in the numeric source series. You may assign individuals into one of k classes based
any of the following: equally sized ranges, ranges defined by quantile values, arbitrarily
defined ranges. A variety of options allow you to control the exact definition of the bins, the
method of encoding, and the assignment of value maps to the new categorical series.
We illustrate these features using data on the 2005 Academic Performance Index (API) for
California public schools and local educational agencies (“Api05btx.WF1”). The API is a
numeric index ranging from 200 to 1000 formed by taking the weighted average of the stu-
dent results from annual statewide testing at grades two through eleven.
340—Chapter 11. Series
Output
In the Output section you will list
the name of the target series to
hold the classifications, and
optionally, the name of a valmap
object to hold information about the mapping. Here, we will save the step size classification
into the series API5B_CT and save the mapping description in API5B_MP. If the classifica-
tion series already exists, it will be overwritten; if an object with the map name already
exists, the map will be saved in the next available name (“API5B_MP01”, etc.).
Specification
The Specification section is where you will define the basic method of classification. The
Method combo allows you to choose from the four methods of defining ranges: Step Size,
Number of Bins, Quantile Values, Limit Values. The first two methods specify equal sized
bins, the latter two define variable sized bins.
Step Size
We will begin by selecting the default Step Size method and entering “100” and “200” for
the Step size and Grid start edit fields. The step size method defines a grid of bins of fixed
size (the step size) beginning at the specified grid start, and continuing through the grid
end. In this example, we have specified a step size of 100, and a Grid start value of 200.
The Grid end is left blank so EViews uses the data maximum extended by 5%, ensuring
that the rightmost bin extends beyond the data values. These settings define a set of ranges
of the form: [100, 200), [200, 300), ..., [1000, 1100). Note that by default the ranges are
closed on the left so that we say x lies in the first bin if 100 £ x < 200 .
Generate by Classification—341
Number of Bins
The second method of creating equal
sized bins is to select Number of Bins in
the Method combo. The label for the
second edit field will change from “Bin
size” to “# of bins”, prompting you for an integer value k . EViews will define a set of bins
by dividing the grid range into k equal sized bins. For example, specifying 9 bins beginning
at 200 and ending at 1100 generates a classification that is the same as the one specified
using the step size of 100.
Quantile Values
One commonly employed method of classifying observations is to divide the data into quan-
tiles. In the previous example, each school was assigned a value 1 to 9 depending on which
of 9 equally sized bins contained its API. We may instead wish to assign each school an
index for its decile. In this way we can determine whether a given school falls in the lowest
10% of schools, second lowest 10%, etc.
342—Chapter 11. Series
Limit Values
You may also define your bins by provid-
ing an arbitrary set of two or more limit
points. Simply select Limit Values from
the Method combo and provide a list of
numeric values, scalars, or vectors.
EViews will sort the numbers and define a set of bins using those limits.
Options
EViews provides various options that allow you to fine tune the
classification method or to alter the encoding of classification
values.
Encoding
The combo box labeled Encoding allows you to select different
methods of assigning values to the classified observations. By
default, EViews classifies observations using the integers 1, 2, etc. so that the observations
falling in the first bin are assigned the value 1, observations in the second bin are assigned
2, and so forth.
In addition to the default Index (0, 1, 2,...) method, you may elect to use the Left edges of
bins, the Right edges of bins, or the Midpoints of bins. Each of these encoding methods
Generate by Classification—343
should be self-explanatory. Note that index encoding is the only method available for classi-
fication by quantile values.
Value maps are not created for classifications employing non-index encoding.
NA classification
By default, observations in the original series which are NA are given the value NA in the
classification series. If you treat the NA as a category by checking Include NAs in classifica-
tion, EViews will assign NAs the index value of 0 in the classification, and will map this
value to the label “NA”.
For example, re-running our first example (step size of 100, a grid start value of 200) but
keeping NAs, we have the following raw data. Note that the mapped values will be identical
to those from the earlier example, so we have switched the series to Raw Data to see the
values for NA:
We see that the observations 2 and 6, which were missing values in the original data, are
encoded with the index value 0.
Out-of-Range Values
You may instruct EViews to generate an error if it encounters an observation that does not
fall into one of the specified bins; by default, observations that lie outside the bin range are
simply assigned an NA.
Right-closed Bins
Bins are left-closed by default, so that x lies in the bin defined by a and b if a £ x < b . To
change the non-strict inequality from the left to the right a < x £ b , you must instruct
EViews to use right-closed bins by checking the box Right-closed bin intervals (a, b]. This
setting should have little effect, if any, if your data are reasonably continuous.
344—Chapter 11. Series
A Couple of Warnings
In determining whether an observation is in a particular interval, EViews performs compar-
isons of real numbers to assess, for example, whether a £ x and whether x < b . We urge
you to exercise caution in cases where a and b are finite precision representations of real
numbers.
To take a specific example, suppose that we wish to divide the interval from 0 to 1 into bins
of size 0.1 (so that our limit points are 0.1, 0.2, 0.3, etc.). Since 0.1 cannot be represented in
floating point by a computer, comparisons will be made with numbers that are close to, but
not exactly equal to 0.1. As a result, when there are data values approximately equal to the
limit points, classifications may behave unexpectedly since they are based on a comparison
of two floating point numbers.
A related issue occurs when you classify by number of bins, and set the start or end values
equal to the data minimum or maximum. In this situation, depending upon whether you
have selected left or right-closed intervals, observations with values equal to the start or end
may fall out-of-range.
To illustrate this issue, we extend our example by assuming that we wish to divide the 0–1
range into right-closed bins. Each bin will be of the form [0.1 ( i – 1 ) , 0.1 i ). with the first
interval given by (0, 1]. Now consider classifying those data values that are exactly equal to
0, and note that these values are out-of-range since they lie outside the first interval. The
same is true for observations equal to 1 if we have defined left-closed bins. The comparison
is more complex if the relevant endpoint is real valued since the out-of-range status would
depend upon a floating point comparison.
The obvious recommendation in this latter case are that: (1) you specify at most only one of
range start and range end at the data extremes, and (2) if you set either the start or end to
the corresponding data extreme, you define the intervals so that they are closed on that end
(i.e., starts that equal the minimum have left-closed intervals, and ends that equal the max-
imum have right-closed intervals) and you set the range so that it extends past the other
extreme. Our first example above adopts this strategy, setting the low value to the data min-
imum (200), setting the step size, and leaving the upper limit unspecified.
More generally, we urge you to exercise caution when defining intervals with real-valued
limits.
Resample
The series resampling procedure selects from the observations in a series to create a new
series (the resampled series). You may draw your new sample with replacement (allow a
given observation to be drawn multiple times) or without replacement. When you select
Proc/Resample... from the series window, you will be prompted to specify various options.
Resample—345
Input Sample
Describes the sample from which
observations are to be drawn. The
default is the current workfile sample.
Output Sample
Specifies the sample into which the resampled series will be saved. Any value outside the
output sample will not be changed. The default output sample is the current workfile sam-
ple. If you select the Draw without replacement option, the output sample cannot be larger
than the input sample.
NA Handling
The default Include NAs in draws instructs EViews to draw from every observation in the
input sample, including those that contain missing values. Alternatively, you may select the
Exclude NAs from draws option so that you draw only from observations in the input sam-
ple that do not contain any missing values. Finally, the Exclude NAs from draws but copy
NA rows to output option first copies matching observations in the input sample that con-
tain missing values to the output sample. The remaining rows of the output sample are then
filled by drawing from observations in the input sample that do not contain any missing val-
ues. This option keeps observations with missing values fixed and resamples those that do
not contain any missing values.
Series Name
The new series will be named using the specified series name. You may provide a series
name or a wildcard expression. If you use a wildcard expression, EViews will substitute the
existing series name in place of the wildcard. For example, if you are sampling from the
series X and specify “*_SMP” as the output series, EViews will save the results in the series
X_SMP. You may not specify a destination series that is the same as the original series.
If another series with the specified name exists in the workfile, the existing values in the out-
put sample will be overwritten with the resampled values. Any values outside the output
sample will remain unchanged. If there is a non-series object with the specified name,
EViews will return an error message.
346—Chapter 11. Series
Because of these naming conventions, your original series cannot be an auto-series. For
example, if the original series is X(-1) or LOG(X), EViews will issue an error. You will have
to generate a new series, say by setting XLAG = X(-1) or LOGX = LOG(X), and then resam-
ple from the newly generated series.
Weighting
By default, the procedure draws from each row in the input sample with equal probabilities.
If you want to attach different probabilities to the rows (importance sampling), you can
specify a name of an existing series that contains weights that are proportional to the
desired probabilities in each row. The weight series must have non-missing non-negative
values in the input sample, but the weights need not add up to 1 since EViews will normal-
ize the weights.
Block Length
By default, sets the block length to 1, meaning that we draw one observation at a time from
the input sample. If you specify a block length larger than 1, EViews will draw blocks of
consecutive rows of the specified length. The blocks drawn in the procedure form a set of
overlapping moving blocks in the input sample. The drawn blocks will be appended one
after the other in the output series until it fills the output sample (the final block will be
truncated if the block size is not an integer multiple of the output sample size). Block resa-
mpling with a block length larger than 1 makes the most sense when resampling time series
data.
Block resampling requires a continuous output sample. Therefore a block length larger than
1 cannot be used when the output sample contains “gaps” or when you have selected the
Exclude NAs from draws but copy NA rows to output option. If you choose the Exclude
NAs from draws option and the block length is larger than 1, the input sample will shrink
in the presence of NAs in order to ensure that there are no missing values in any of the
drawn blocks.
Interpolate
The interpolation procedure for a series fills in missing values, or NAs, within a series by
interpolating from values that are non-missing. EViews offers a number of different algo-
rithms for performing the interpolation: Linear, Log-Linear, the Catmull-Rom Spline, and the
Cardinal Spline.
The Linear interpolation method simply computes a linear approximation based on the pre-
vious non-missing value and the next non-missing value. The interpolated value is then cal-
culated as:
IV Li n = ( 1 – l )P i – 1 + lPi + 1 (11.25)
Interpolate—347
where P i – 1 is the previous missing value, P i + 1 is the next non-missing value, and l is
the relative position of the missing value divided by the total number of missing values in a
row.
Thus if you have a single NA, then the interpolated value will be half way between the pre-
vious value and the next value. If you have two NAs in a row, the first will be interpolated
as 1/3 of the distance between the previous value and the next. The second value will be
interpolated as 2/3 of the distance.
Log-linear interpolation is calculated in the same way as the Linear method, but the series
values are logged before the calculation is made, then the interpolated value is exponenti-
ated. If the source series contains negative values before and after the missing values, then
the absolute value is used for interpolation, with the result being negated. If the values to
either side of the missing values contain both a negative and a positive number, the interpo-
lation routine will return an NA. Thus the interpolated value is calculated as:
IV p os = EXP [ ( 1 – l ) log ( P i – 1 ) + l log ( P i + 1 ) ] (11.26)
IV neg = – EXP [ ( 1 – l ) log ( – P i – 1 ) + l log ( – P i + 1 ) ] (11.27)
Note that both the linear and log-linear routines will return an NA if there are no previous or
next non-missing values available – i.e. if the first observation in the sample is an NA, it will
not be interpolated since there is no previous value available.
The Cardinal Spline is based on the previous two non-missing values, and the next two non-
missing values, and tries to fit the missing data to a non-linear, or curved, pattern. Denoting
P i – 2 and Pi – 1 as the previous two non-missing values, and P i + 1 and P i + 2 as the next
two non-missing values, the interpolated value is calculated as:
3 2 3 2
IV C S = ( 2l – 3l + 1 )P i – 1 + ( 1 – t ) ( l – 2l + l ) ( Pi + 1 – P i – 2 ) – (11.28)
3 2 3 2
( 2l – 3l )Pi + 1 + ( 1 – t ) ( l – l ) ( P i + 2 – P i – 1 )
where t is a called a tension parameter and affects the curvature of the spline.
The Catmull-Rom Spline is a special case of the Cardinal Spline, with the tension parameter,
t , set at 0.
Note that as with the linear and log-linear routines, both spline routines will return an NA if
either P i – 1 or P i + 1 are missing. However if P i – 2 is missing, it is simply set equal to
P i – 1 , and if Pi + 2 is missing, it is set equal to P i + 1 .
For example, the following series is interpolated using Linear and Log-Linear interpolation:
For this series, the first missing value is at observation 3. The linear interpolation of this
value is simply 1/2 of the value of observation two (the previous non-missing observation)
plus 1/2 of the value of observation four (the next non-missing observation), i.e. 1/2*-0.8 +
1/2*(-0.4). The second missing value is at observation five, and is equal to 2/3 of the value
of observation four, plus (1-1/3) of the value of observation 7, i.e., 2/3*(-0.4)+1/3*(-1.2).
The final interpolated value, at observation six, is calculated as 1/3*(-0.4) + 2/3*(-1.2)
For log-linear interpolation, the calculated value for observation three is equal to the nega-
tive of the exponent of 1/2 of the logged value at observation two (negated since it is nega-
tive) plus 1/2 of the value of observation five (negated):
1 1
– exp ÊË --- log ( 0.8 ) + --- log ( 0.4 )ˆ¯ (11.29)
2 2
For the Catmull-Rom spline, the calculated value for observation three is equal to:
3
Ê 2Ê 1 1 2 1 3 1 2 1
--- ˆ – 3 Ê --- ˆ + 1ˆ ( – 0.8 ) + Ê Ê --- ˆ – 2 Ê --- ˆ + ---ˆ ( – 0.4 + 1 ) – (11.32)
Ë Ë 2¯ Ë 2¯ ¯ ËË 2 ¯ Ë 2¯ 2¯
3 2 3 2
1 1 1 1
Ê 2 Ê --- ˆ – 3 Ê --- ˆ ˆ ( – 0.4 ) + Ê Ê --- ˆ – Ê --- ˆ ˆ ( – 1.2 + 0.8 ) = – 0.4750
Ë Ë 2¯ Ë 2¯ ¯ ËË 2 ¯ Ë 2¯ ¯
The values at observations five and six are calculated similarly, although note that both for
both observations, P i + 1 and P i + 2 are equal to -1.2.
Seasonal Adjustment—349
The Sample box lets you select a sample over which the interpolation will run. If left blank,
the default workfile sample will be used. Note that observations outside of the selected sam-
ple will not be interpolated, nor will they be used as part of the interpolation calculations.
The checkbox labeled Insert source series for out of sample observations controls whether
the output series will be filled with the source series values for out of sample observations,
or will be filled with NAs.
Seasonal Adjustment
Time series observed at quarterly and monthly frequencies often exhibit cyclical movements
that recur every month or quarter. For example, ice cream sales may surge during summer
every year and toy sales may reach a peak every December during Christmas sales. Seasonal
adjustment refers to the process of removing these cyclical seasonal movements from a
series and extracting the underlying trend component of the series.
Census X12
EViews provides a convenient front-end for accessing the U.S. Census Bureau’s X12 sea-
sonal adjustment program from within EViews. The X12 seasonal adjustment program
X12A.EXE is publicly provided by the Census and is installed in your EViews directory.
When you request X12 seasonal adjustment from EViews, EViews will perform all of the fol-
lowing steps:
• write out a specification file and data file for the series.
350—Chapter 11. Series
• execute the X12 program in the background, using the contents of the specification
file.
• read back the output file and saved data into your EViews workfile.
The following is a brief description of the EViews menu interface to X12. While some parts
of X12 are not available via the menus, EViews also provides a more general command
interface to the program (see x12 (p. 458) in the Command and Programming Reference).
Users who desire a more detailed discussion of the X12 procedures and capabilities should
consult the Census Bureau documentation. The full documentation for the Census program,
X12-ARIMA Reference Manual, can be found in the “docs” subdirectory of your EViews
installation directory in the PDF files “Finalpt1.PDF” and “Finalpt2.PDF”.
It is worth noting that when you open the X12 dialog, the options will be set to those from
the previously executed X12 dialog. One exception to this rule is the outlier list in the Outli-
ers tab, which will be cleared unless the previous seasonal adjustment was performed on
the same series.
approximate the results from the previous X11 program’s default filter, choose the X11-
default option. You should note the following:
• The seasonal filter specified in the dialog is used for all frequencies. If you wish to
apply different filters to different frequencies, you will have to use the more general
X12 command language described in detail in x12 (p. 458) in the Command and Pro-
gramming Reference.
• X12 will not allow you to specify a 3 ¥ 15 seasonal filter for series shorter than 20
years.
• The Census Bureau has confirmed that the X11-default filter option does not produce
results which match those obtained from the previous version of X11. The difference
arises due to changes in extreme value identification, replacement for the latest val-
ues, and the way the end weights of the Henderson filter is calculated. For compara-
bility, we have retained the previous (historical) X11 routines as a separate procedure
(see “Census X11 (Historical)” on page 358). Please note that the old X11 program is
year 2000 compliant only through 2100 and supports only DOS 8.3 format filenames.
The Trend Filter (Henderson) settings allow you to specify the number of terms in the
Henderson moving average used when estimating the trend-cycle component. You may use
any odd number greater than 1 and less than or equal to 101. The default is the automatic
procedure used by X12.
You must provide a base name for the series stored from the X12 procedure in the Name for
Adjusted Series/Component Series to Save edit box. To save a series returned from X12 in
the workfile, click on the appropriate check box. The saved series will have the indicated
suffix appended to the base name. For example, if you enter a base name of “X” and ask to
save the seasonal factors (“_SF”), EViews will save the seasonal factors as X_SF.
You should take care when using long base names, since EViews must be able to create a
valid series using the base name and any appended Census designations. In interactive
mode, EViews will warn you that the resulting name exceeds the maximum series name
length; in batch mode, EViews will create a name using a truncated base name and
appended Census designations.
The dialog only allows you to store the four most commonly used series. You may, how-
ever, store any additional series as listed on Table 6-8 (p. 74) of the X12-ARIMA Reference
Manual by running X12 from the command line (see x12 (p. 458) in the Command and Pro-
gramming Reference).
352—Chapter 11. Series
ARIMA Options
The X12 program also allows you to fit
ARMA models to the series prior to sea-
sonal adjustment. You can use X12 to
remove deterministic effects (such as hol-
iday and trading day effects) prior to sea-
sonal adjustment and to obtain forecasts/
backcasts that can be used for seasonal
adjustment at the boundary of the sam-
ple. To fit an ARMA, select the ARIMA
Options tab in the X12 Options dialog
and fill in the desired options.
Ï log ( y t ) if l = 0
Ì 2 (11.33)
Ó l + ( ylt – 1 ) § l if l π 0
See the “transform spec” (p. 60–67) of the X12-ARIMA Reference Manual for further details.
ARIMA Specification allows you to choose between two different methods for specifying
your ARIMA model. The Specify in-line option asks you to provide a single ARIMA specifi-
cation to fit. The X12 syntax for the ARIMA specification is different from the one used by
EViews and follows the Box-Jenkins notation “(p d q)(P D Q)” where:
p nonseasonal AR order
d order of nonseasonal differences
q nonseasonal MA order
P (multiplicative) seasonal AR order
D order of seasonal differences
Q (multiplicative) seasonal MA order
The default specification “(0 1 1)(0 1 1)” is the seasonal IMA model:
Seasonal Adjustment—353
s s
( 1 – L ) ( 1 – L )yt = ( 1 – v 1 L ) ( 1 – v s L )e t (11.34)
(1 0 0) ( 1 – fL ) y t = e t
(0 1 1) ( 1 – L ) yt = ( 1 – vL )e t
(1 0 1)(1 0 0) s
( 1 – f 1 L ) ( 1 – f s L )y t = ( 1 – vL )e t
where s = 4 for quarterly data and s = 12 for
monthly data.
You can skip lags using square brackets and explicitly specify the seasonal order after the
parentheses:
([2 3] 0 0) 2 3
( 1 – f2L – f3L ) yt = et
(0 1 1)12 12 12
( 1 – L ) yt = ( 1 – vL )e t
See the X12-ARIMA Reference Manual (p. 110–114) for further details and examples of
ARIMA specification in X12. Note that there is a limit of 25 total AR, MA, and differencing
coefficients in a model and that the maximum lag of any AR or MA parameter is 24 and the
maximum number of differences in any ARIMA factor is 3.
Alternatively, if you choose Select from file, X12 will select an ARIMA model from a set of
possible specifications provided in an external file. The selection process is based on a pro-
cedure developed by Statistics Canada for X11-ARIMA/88 and is described in the X12-
ARIMA Reference Manual (p. 133). If you use this option, you will be asked to provide the
name of a file that contains a set of possible ARIMA specifications. By default, EViews will
use a file named X12A.MDL that contains a set of default specifications provided by Census
(the list of specifications contained in this file is given below).
To provide your own list in a file, the ARIMA specification must follow the X12 syntax as
explained in the ARIMA Specification section above. You must specify each model on a sep-
arate line, with an “X” at the end of each line except the last. You may also designate one of
the models as a “default” model by marking the end of a line with an asterisk “*” instead of
“X”; see p. 133 of the X12-ARIMA Reference Manual for an explanation of the use of a
default model. To ensure that the last line is read, it should be terminated by hitting the
return key.
For example, the default file (X12A.MDL) provided by X12 contains the following specifica-
tions:
(0 1 1)(0 1 1) *
354—Chapter 11. Series
(0 1 2)(0 1 1) x
(2 1 0)(0 1 1) x
(0 2 2)(0 1 1) x
(2 1 2)(0 1 1)
There are two additional options for Select from file. Select best checks all models in the
list and looks for the model with minimum forecast error; the default is to select the first
model that satisfies the model selection criteria. Select by out-of-sample-fit uses out-of-
sample forecast errors (by leaving out some of the observations in the sample) for model
evaluation; the default is to use within-sample forecast errors.
The Regressors option allows you to include prespecified sets of exogenous regressors in
your ARIMA model. Simply use the checkboxes to specify a constant term and/or (centered)
seasonal dummy variables. Additional predefined regressors to capture trading day and/or
holiday effects may be specified using the Trading Day/Holiday tab. You can also use the
Outlier tab to capture outlier effects.
• X11 step: seasonally adjust the series from step 2 using backcasts/forecasts from the
ARIMA model.
While it is possible to perform trading day/holiday adjustments in both the X11 step and the
ARIMA step, Census recommends against doing so (with a preference to performing the
adjustment in the ARIMA step). EViews follows this advice by allowing you to perform the
adjustment in only one of the two steps.
If you choose to perform the adjustment in the X11 step, there is an additional setting to
consider. The checkbox Apply only if significant (AIC) instructs EViews to adjust only if
warranted by examination of the Akaike information criterion.
It is worth noting that in X11, the significance tests for use of trading day/holiday adjust-
ment are based on an F-test. For this, and a variety of other reasons, the X12 procedure
with “X11 settings” will not produce results that match those obtained from historical X11.
To obtain comparable results, you must use the historical X11 procedure (see “Census X11
(Historical)” on page 358).
Once you select your adjustment method, the dialog will present additional adjustment
options:
• Trading Day Effects — There are two options for trading day effects, depending on
whether the series is a flow series or a stock series (such as inventories). For a flow
series, you may adjust for day-of-week effects or only for weekday-weekend con-
trasts. Trading day effects for stock series are available only for monthly series and
the day of the month in which the series is observed must be provided.
• Holiday Effects — Holiday effect adjustments apply only to flow series. For each hol-
iday effect, you must provide a number that specifies the duration of that effect prior
to the holiday. For example, if you select 8, the level of daily activity changes on the
seventh day before the holiday and remains at the new level until the holiday (or a
day before the holiday, depending on the holiday).
Note that the holidays are as defined for the United States and may not apply to other coun-
tries. For further details, see the X12-ARIMA Reference Manual, Tables 6–15 (p. 94) and 6–
18 (p. 133).
356—Chapter 11. Series
Outlier Effects
As with trading day/holiday adjustments,
outlier effects can be adjusted either in
the X11 step or in the ARIMA step (see
the discussion in “Trading Day and Holi-
day Effects” on page 354). However, out-
lier adjustments in the X11 step are done
only to robustify the trading day/holiday
adjustments in the X11 step. Therefore,
in order to perform outlier adjustment in
the X11 step, you must perform trading
day/holiday adjustment in the X11 step.
Only additive outliers are allowed in the
X11 step; other types of outliers are avail-
able in the ARIMA step. For further infor-
mation on the various types of outliers,
see the X12-ARIMA Reference Manual,
Tables 6–15 (p. 94) and 6–18 (p. 133).
Diagnostics
This tab provides options for various
diagnostics. The Sliding spans and His-
torical revisions options test for stability
of the adjusted series. While Sliding
spans checks the change in adjusted
series over a moving sample of fixed size
(overlapping subspans), Historical revi-
sions checks the change in adjusted
series over an increasing sample as new
observations are added to the sample.
See the X12-ARIMA Reference Manual for
further details and references of the test-
ing procedure. You may also choose to
display various diagnostic output:
• Residual diagnostics will report
standard residual diagnostics (such
as the autocorrelation functions
and Q-statistics). These diagnos-
Seasonal Adjustment—357
tics may be used to assess the adequacy of the fitted ARIMA model. Note that this
option requires estimation of an ARIMA model; if you do not provide an ARIMA
model nor any exogenous regressors (including those from the Trading day/Holiday
or Outlier tab), the diagnostics will be applied to the original series.
• Outlier detection automatically detects and reports outliers using the specified
ARIMA model. This option requires an ARIMA specification or at least one exogenous
regressor (including those from the Trading day/Holiday or Outlier tab); if no
regression model is specified, the option is ignored.
• Spectral plots displays the spectra of the differenced seasonally adjusted series (SP1)
and/or of the outlier modified irregular series (SP2). The red vertical dotted lines are
the seasonal frequencies and the black vertical dashed lines are the trading day fre-
quencies. If you observe peaks at these vertical lines it is an indication of inadequate
adjustment. For further details, see Findley et al. (1998, section 2.1). If you request
this option, data for the spectra will be stored in a matrix named seriesname_SA_SP1
and seriesname_SA_SP2 in your workfile. The first column of these matrices are the
frequencies and the second column are 10 times the log spectra at the corresponding
frequency.
X11/X12 Troubleshooting
The currently shipping versions of X11 and X12 as distributed by the Census have the fol-
lowing limitation regarding directory length. First, you will not be able to run X11/X12 if
you are running EViews from a shared directory on a server which has spaces in its name.
The solution is to map that directory to a letter drive on your local machine. Second, the
temporary directory path used by EViews to read and write data cannot have more than
four subdirectories. This temporary directory used by EViews can be changed by selecting
Options/File Locations.../Temp File Path in the main menu. If your temporary directory
has more than four subdirectories, change the Temp File Path to a writeable path that has
fewer subdirectories. Note that if the path contains spaces or has more than 8 characters, it
may appear in shortened form compatible with the old DOS convention.
358—Chapter 11. Series
The X11 programs may be executed directly from DOS or from within EViews. If you run
the X11 programs from within EViews, the adjusted series and the factor series will be auto-
matically imported into your EViews workfile. X11 summary output and error messages will
also be displayed in the series window at the end of the procedure.
The X11 method has many options, the most important of which are available in the Sea-
sonal Adjustment dialog. However, there are other options not available in the EViews dia-
log; to use these other options, you should run the X11 programs from the DOS command
line. All options available in the X11 methods are described in the X11DOC text files in your
EViews directory.
You should note that there is a limit on the number of observations that you can seasonally
adjust. X11 only works for quarterly and monthly frequencies, requires at least four full
years of data, and can adjust only up to 20 years of monthly data and up to 30 years of quar-
terly data.
Tramo/Seats
Tramo (“Time Series Regression with ARIMA Noise, Missing Observations, and Outliers”)
performs estimation, forecasting, and interpolation of regression models with missing obser-
vations and ARIMA errors, in the presence of possibly several types of outliers. Seats (“Sig-
nal Extraction in ARIMA Time Series”) performs an ARIMA-based decomposition of an
observed time series into unobserved components. The two programs were developed by
Victor Gomez and Agustin Maravall.
Used together, Tramo and Seats provide a commonly used alternative to the Census X12
program for seasonally adjusting a series. Typically, individuals will first “linearize” a series
using Tramo and will then decompose the linearized series using Seats.
Seasonal Adjustment—359
EViews provides a convenient front-end to the Tramo/Seats programs as a series proc. Sim-
ply select Proc/Seasonal Adjustment/Tramo Seats... and fill out the dialog. EViews writes
an input file which is passed to Tramo/Seats via a call to a .DLL, and reads the output files
from Tramo/Seats back into EViews (note: since EViews uses a new .DLL version of Tramo/
Seats, results may differ from the older DOS version of the program).
Since EViews only provides an interface to an external program, we cannot provide any
technical details or support for Tramo/Seats itself. Users who are interested in the technical
details should consult the original documentation Instructions for the User which is provided
as a .PDF file in the DOCS/TRAMOSEATS subdirectory of your EViews directory.
Dialog Options
The Tramo/Seats interface from the dialog provides access to the most frequently used
options. Users who desire more control over the execution of Tramo/Seats may use the
command line form of the procedure as documented in tramoseats (p. 446) in the Com-
mand and Programming Reference.
The dialog contains three tabs. The main tab controls the basic specification of your Tramo/
Seats run.
• Run mode: You can
choose either to run only
Tramo or you can select
the Run Seats after Tramo
checkbox to run both. In
the latter case, EViews uses
the input file produced by
Tramo to run Seats. If you
wish to run only Seats, you
must use the command line
interface.
• Forecast horizon: You may
set the number of periods
to forecast outside the cur-
rent sample. If you choose
a number smaller than the number of forecasts required to run Seats, Tramo will
automatically lengthen the forecast horizon as required.
• Transformation: Tramo/Seats is based on an ARIMA model of the series. You may
choose to fit the ARIMA model to the level of the series or to the (natural) log of the
series, or you select Auto select level or log. This option automatically chooses
between the level model and the log transformed model using results from a trimmed
360—Chapter 11. Series
If you selected a trading day adjustment option, you have the option of specifying
exogenous series to be treated as a holiday series. The specification of the holiday
series will depend on whether you chose a weekday/weekend adjustment or a 5-day
adjustment. See the original Tramo/Seats documentation for further details.
If you are running Seats after Tramo, you must specify which component to allocate
the regression effects. The Tramo default is to treat the regression effect as a separate
additional component which is not included in the seasonally adjusted series.
EViews will write a separate data file for each entry in the exogenous series list which
is passed to Tramo. If you have many exogenous series with the same specification, it
is best to put them into one group.
• Easter/Trading day adjustment: These options are intended for monthly data; see
the original Tramo/Seats documentation for details.
• Outlier detection: You may either ask Tramo to automatically detect possible outliers
or you can specify your own outlier but not both. If you wish to do both, create a
series corresponding to the known outlier and pass it as an exogenous series.
Similarly, the built-in intervention option in Tramo is not supported from the dialog.
You may obtain the same result by creating the intervention series in EViews and
passing it as an exogenous series. See the example below.
The original Tramo/Seats documentation provides definitions of the various outlier
types and the method to detect them.
After you click OK, the series window will display the text output returned by Tramo/Seats.
If you ran both Tramo and Seats, the output from Seats is appended at the end of Tramo
output. Note that this text view will be lost if you change the series view. You should freeze
the view into a text object if you wish to refer to the output file without having to run
Tramo/Seats again.
It is worth noting that when you run Tramo/Seats, the dialog will generally contain the set-
tings from the previous run of Tramo/Seats. A possible exception is the user specified out-
lier list which is cleared unless Tramo/Seats is called on the previously used series.
For the practitioner, the main difference between the two methods is that X12 does not
allow missing values while Tramo/Seats will interpolate the missing values (based on the
362—Chapter 11. Series
estimated ARIMA model). While both handle quarterly and monthly data, Tramo/Seats also
handles annual and semi-annual data. See the sample programs in the Example Files direc-
tory for a few results that compare X12 and Tramo/Seats.
Trouble Shooting
Error handling
As mentioned elsewhere, EViews writes an input file which is passed to Tramo/Seats via a
call to a .DLL. Currently the Tramo/Seats .DLL does not return error codes. Therefore, the
only way to tell that something went wrong is to examine the output file. If you get an error
message indicating that the output file was not found, the first thing you should do is to
check for errors in the input file.
When you call Tramo/Seats, EViews creates two subdirectories called Tramo and Seats in a
temporary directory. This temporary directory is taken from the global option Options/File
Locations.../Temp File Path (note that long directory names with spaces may appear in
shortened DOS form). The Temp File Path can be retrieved in a program by a call to @temp-
path (see @temppath (p. 530) in the Command and Programming Reference).
The Tramo input file written by EViews will be placed in the subdirectory TRAMO and is
named SERIE. A Seats input file written by Tramo is also placed in subdirectory TRAMO
and is named SEATS.ITR.
The input file used by Seats is located in the SEATS subdirectory and is named SERIE2. If
Seats is run alone, then EViews will create the SERIE2 file. When Tramo and Seats are called
together, the Tramo file SEATS.ITR is copied into SERIE2.
If you encounter the error message containing the expression “output file not found”, it
probably means that Tramo/Seats encountered an error in one of the input files. You should
look for the input files SERIE and SERIE2 in your temp directories and check for any errors
in these files.
Warning: if you wish to examine these files, make sure to read these data files before you
run the next Tramo/Seats procedure. EViews will clear these subdirectories before running
the next Tramo/Seats command (this clearing is performed as a precautionary measure so
that Tramo/Seats does not read results from a previous run).
Seasonal Adjustment—363
Ï
Ô ( 0.5y t + 6 + º + yt + º0.5y t – 6 ) § 12 if monthly
xt = Ì (11.35)
Ô ( 0.5y t + 2 + y t + 1 + y t + y t – 1 + 0.5yt – 1 ) § 4 if quarterly
Ó
2. Take the ratio t t = y t § x t .
3. Compute the seasonal indices. For monthly series, the seasonal index i m for month
m is the average of t t using observations only for month m . For quarterly series,
the seasonal index i q for quarter q is the average of t t using observations only for
quarter q .
4. We then adjust the seasonal indices so that they multiply to one. This is done by com-
puting the seasonal factors as the ratio of the seasonal index to the geometric mean of
the indices:
Ï
Ô i § ( 12 i 1 i 2 ºi 12 ) if monthly
s = Ì m (11.36)
Ô i § (4 i i i i ) if quarterly
Ó q 1 2 3 4
5. These s are the reported scaling factors in the series window and are saved as series
if you provide a name in the field box. The interpretation is that the series y is s j
percent higher in period j relative to the adjusted series.
6. The seasonally adjusted series is obtained by dividing y t by the seasonal factors s j .
5. The seasonally adjusted series is obtained by subtracting the seasonal factors s j from
yt .
The main difference between X11 and the moving average methods is that the seasonal fac-
tors may change from year to year in X11. The seasonal factors are assumed to be constant
for the moving average method.
Exponential Smoothing
Exponential smoothing is a simple method of adaptive forecasting. It is an effective way of
forecasting when you have only a few observations on which to base your forecast. Unlike
forecasts from regression models which use fixed coefficients, forecasts from exponential
smoothing methods adjust based upon past forecast errors. For additional discussion, see
Bowerman and O’Connell (1979).
To specify a number, type the number in the field corresponding to the parameter. All
parameters are constrained to be between 0 and 1; if you specify a number outside the unit
interval, EViews will estimate the parameter.
• Smoothed Series Name. You should provide a name for the smoothed series. By
default, EViews will generate a name by appending SM to the original series name,
but you can enter any valid EViews name.
Exponential Smoothing—365
• Estimation Sample. You must specify the sample period upon which to base your
forecasts (whether or not you choose to estimate the parameters). The default is the
current workfile sample. EViews will calculate forecasts starting from the first obser-
vation after the end of the estimation sample.
• Cycle for Seasonal. You can change the number of seasons per year from the default
of 12 for monthly or 4 for quarterly series. This option allows you to forecast from
unusual data such as an undated workfile. Enter a number for the cycle in this field.
where 0 < a £ 1 is the damping (or smoothing) factor. The smaller is the a , the smoother
is the ŷt series. By repeated substitution, we can rewrite the recursion as
t–1
s
ŷ t = a  ( 1 – a ) yt – s (11.38)
s =0
The forecasts from single smoothing are constant for all future observations. This constant
is given by:
ŷ T + k = ŷ T for all k > 0 (11.39)
To start the recursion, we need an initial value for ŷt and a value for a . EViews uses the
mean of the initial ( T + 1 ) § 2 observations of y t to start the recursion (where T is the
number of observations in the sample). Bowerman and O’Connell (1979) suggest that val-
ues of a around 0.01 to 0.30 work quite well. You can also let EViews estimate a to mini-
mize the sum of squares of one-step forecast errors.
S t = ay t + ( 1 – a )S t – 1
(11.40)
D t = aS t + ( 1 – a )D t – 1
where S is the single smoothed series and D is the double smoothed series. Note that dou-
ble smoothing is a single parameter smoothing method with damping factor 0 < a £ 1 .
ŷ T + k = Ê 2 + -------------ˆ S T – Ê 1 + -------------ˆ D T
ak ak
Ë 1–a ¯ Ë 1 – a¯
(11.41)
= Ê 2S T – D T + ------------- ( S T – D T )kˆ
a
Ë 1–a ¯
The last expression shows that forecasts from double smoothing lie on a linear trend with
intercept 2S T – D T and slope a ( S T – D T ) § ( 1 – a ) .
where
where the seasonal factors are used from the last s estimates.
Exponential Smoothing—367
where a and b are the permanent component and trend as defined above in
Equation (11.43) and c are the additive seasonal factors. The three coefficients are defined
by the following recursions:
a ( t ) = a ( yt – ct( t – s) ) + ( 1 – a ) ( a ( t – 1 ) + b ( t – 1 ) )
b ( t ) = b ( a ( t ) – a ( t – 1 ) ) + 1 – b b( t – 1) (11.47)
c t ( t ) = g ( y t – a ( t + 1 ) ) –g c t ( t – s )
where 0 < a, b, g < 1 are the damping factors and s is the seasonal frequency specified in
the Cycle for Seasonal field box.
where the seasonal factors are used from the last s estimates.
where a and b are the permanent component and trend as defined above in
Equation (11.43).
a ( t ) = ay t + ( 1 – a ) ( a ( t – 1 ) + b ( t – 1 ) )
(11.50)
b ( t ) = b ( a ( t ) – a ( t – 1 ) ) + 1 – b b( t – 1)
where 0 < a, b, g < 1 are the damping factors. This is an exponential smoothing method
with two parameters.
It is worth noting that Holt-Winters—No Seasonal, is not the same as additive or multiplica-
tive with g = 0 . The condition g = 0 only restricts the seasonal factors from changing
over time so there are still (fixed) nonzero seasonal factors in the forecasts.
Illustration
As an illustration of forecasting using exponential smoothing we forecast data on monthly
housing starts (HS) for the period 1985M01–1988M12 using the DRI Basics data for the
period 1959M01–1984M12. These data are provided in the workfile “Hs.WF1”. Load the
workfile, highlight the HS series, double click, select Proc/Exponential Smoothing…. We
use the Holt-Winters - Multiplicative method to account for seasonality, name the
smoothed forecasts as HS_SM, and estimate all parameters over the period 1959M1–
1984M12. Leave the remaining settings at their default values.
When you click OK, EViews displays the results of the smoothing procedure. The first part
displays the estimated (or specified) parameter values, the sum of squared residuals, the
root mean squared error of the forecast. The zero values for Beta and Gamma in this exam-
ple mean that the trend and seasonal components are estimated as fixed and not changing.
The second part of the table displays the mean ( a ) , and trend ( b ) at the end of the estima-
tion sample that are used for post-sample smoothed forecasts.
Hodrick-Prescott Filter—369
For seasonal methods, the seasonal factors ( g ) used in the forecasts are also displayed. The
smoothed series in the workfile contains data from the beginning of the estimation sample
to the end of the workfile range; all values after the estimation period are forecasts.
When we plot the actual values (HS) and the smoothed forecasts (HS_SM) on a single
graph, we get:
200
actual
180
Holt-Winters
160
140
AR
120
100
80
60
I II III IV I II III IV I II III IV I II III IV
1985 1986 1987 1988
We have included the forecasted values HS_F from estimation of an AR model with an
AR(1) and a SAR(12) term for comparison purposes. The forecasts from the multiplicative
exponential smoothing method do a better job of tracking the seasonal movements in the
actual series.
Hodrick-Prescott Filter
The Hodrick-Prescott Filter is a smoothing method that is widely used among macroecono-
mists to obtain a smooth estimate of the long-term trend component of a series. The method
370—Chapter 11. Series
was first used in a working paper (circulated in the early 1980’s and published in 1997) by
Hodrick and Prescott to analyze postwar U.S. business cycles.
Technically, the Hodrick-Prescott (HP) filter is a two-sided linear filter that computes the
smoothed series s of y by minimizing the variance of y around s , subject to a penalty that
constrains the second difference of s . That is, the HP filter chooses s to minimize:
T T–1
2 2
 ( yt – s t ) + l  ( ( st + 1 – st ) – ( st – st – 1 ) ) . (11.52)
t= 1 t=2
The penalty parameter l controls the smoothness of the series j . The larger the l , the
smoother the j . As l = • , s approaches a linear trend.
To smooth the series using the Hodrick-Prescott filter, choose Proc/Hodrick-Prescott Fil-
ter…:
First, provide a name for the smoothed series. EViews will suggest a name, but you can
always enter a name of your choosing. Next, specify an integer value for the smoothing
parameter, l . You may specify the parameter using the frequency power rule of Ravn and
Uhlig (2002) (the number of periods per year divided by 4, raised to a power, and multiplied
by 1600), or you may specify l directly. The default is to use a power rule of 2, yielding the
original Hodrick and Prescott values for l :
Ê
Á 100 for annual data
l = Á 1,600 for quarterly data (11.53)
Á
Ë 14,400 for monthly data
Ravan and Uhlig recommend using a power value of 4. EViews will round any non-integer
values that you enter. When you click OK, EViews displays a graph of the filtered series
Frequency (Band-Pass) Filter—371
together with the original series. Note that only data in the current workfile sample are fil-
tered. Data for the smoothed series outside the current sample are filled with NAs.
To employ a band-pass filter, the user must first choose the range of durations (periodicities)
to pass through. The range is described by a pair of numbers ( P L, P U ) , specified in units of
the workfile frequency. Suppose, for example, that you believe that the business cycle lasts
somewhere from 1.5 to 8 years so that you wish to extract the cycles in this range. If you are
working with quarterly data, this range corresponds to a low duration of 6, and an upper
duration of 32 quarters. Thus, you should set P L = 6 and P U = 32 .
In some contexts, it will be useful to think in terms of frequencies which describe the num-
ber of cycles in a given period (obviously, periodicities and frequencies are inversely
related). By convention, we will say that periodicities in the range ( P L, P U ) correspond to
frequencies in the range ( 2p § P U, 2p § P L ) .
Note that since saying that we have a cycle with a period of 1 is meaningless, we require
that 2 £ P L < P U . Setting P L to the lower-bound value of 2 yields a high-pass filter in
which all frequencies above 2p § P U are passed through.
The various band-pass filters differ in the way that they compute the moving average:
• The fixed length symmetric filters employ a fixed lead/lag length. Here, the user must
specify the fixed number of lead and lag terms to be used when computing the
weighted moving average. The symmetric filters are time-invariant since the moving
average weights depend only on the specified frequency band, and do not use the
data. EViews computes two variants of this filter, the first due to Baxter-King (1999)
(BK), and the second to Christiano-Fitzgerald (2003) (CF). The two forms differ in the
choice of objective function used to select the moving average weights.
• Full sample asymmetric – this is the most general filter, where the weights on the
leads and lags are allowed to differ. The asymmetric filter is time-varying with the
weights both depending on the data and changing for each observation. EViews com-
putes the Christiano-Fitzgerald (CF) form of this filter.
In choosing between the two methods, bear in mind that the fixed length filters require that
we use same number of lead and lag terms for every weighted moving average. Thus, a fil-
tered series computed using q leads and lags observations will lose q observations from
372—Chapter 11. Series
both the beginning and end of the original sample. In contrast, the asymmetric filtered
series do not have this requirement and can be computed to the ends of the original sample.
The first thing you will do is to select a filter type. There are three types: Fixed length sym-
metric (Baxter-King), Fixed length symmetric (Christiano-Fitzgerald), or Full length
asymmetric (Christiano-Fitzgerald). By default, the EViews will compute the Baxter-King
fixed length symmetric filter.
Lastly, you will select a Detrending method using the combo. For a covariance stationary
series, you may choose to demean or detrend the data prior to applying the filters. Alterna-
tively, for a unit root process, you may choose to demean, detrend, or remove drift using
the adjustment suggested by Christiano and Fitzgerald (2003).
Note that, as the name suggests, the full sample filter uses all of the observations in the
sample, so that the Lead/Lags option is not relevant. Similarly, detrending the data is not an
option when using the BK fixed length symmetric filter. The BK filter removes up to two
unit roots (a quadratic deterministic trend) in the data so that detrending has no effect on
the filtered series.
8.5 1.0
8.0 0.8
7.5 0.6
.04
7.0
.02 0.4
.00
0.2
-.02
0.0
-.04
-.06 -0.2
1950 1960 1970 1980 1990 .0 .1 .2 .3 .4 .5
cycles/period
LOG(GDP) Non-cyclical Cycle Actual Ideal
For the BK and CF fixed length symmetric filters, EViews plots the frequency response func-
tion a ( q ) representing the extent to which the filtered series “responds” to the original
2
series at frequency q . At a given frequency q , a ( q ) indicates the extent to which a
moving average raises or lowers the variance of the filtered series relative to that of the orig-
inal series. The right panel of the graph depicts the function. Note that the horizontal axis of
a frequency response function is always in the range 0 to 0.5, in units of cycles per duration.
Thus, as depicted in the graph, the frequency response function of the ideal band-pass filter
for periodicities ( P L, P U ) will be one in the range ( 1 § P U, 1 § P L ) .
The frequency response function is not drawn for the CF time-varying filter since these fil-
ters vary with the data and observation number. If you wish to plot the frequency response
374—Chapter 11. Series
function for a particular observation, you will have to save the weight matrix and then eval-
uate the frequency response in a separate step. The example program BFP02.PRG and sub-
routine FREQRESP.PRG illustrate the steps in computing of gain functions for time-varying
filters at particular observations.
For time-varying filters, the weight matrix is of dimension n ¥ n where n is the number of
non-missing observations in the current sample. Row r of the matrix contains the weight-
ing vector used to generate the r -th observation of the filtered series where column c con-
tains the weight on the c -th observation of the original series:
n
zt = Â w ( t, c )y c t = 1, º, n (11.54)
c = 1
where z t is the filtered series, y t is the original series and w ( r, c ) is the ( r, c ) element of
the weighting matrix. By construction, the first and last rows of the weight matrix will be
filled with missing values for the symmetric filter.
Whiten Data
EViews offers easy-to-use tools for whitening the data in a series. To access these tools, sim-
ply select Make Whitened.... from the series toolbar or the main EViews menu. See “Make
Whitened,” on page 431 for a discussion of the use of these tools in a group object setting.
Typically, you will access the distribution graph tools by selecting Graph from the series
window and then making the appropriate choice (see “Graphing a Series” on page 439).
These graph tools allow you to display the constructed data graphically, but not to examine
them directly.
In some cases, you may wish to save the data depicted in the graph, possibly for further
analysis. To do so, simply select Proc/Make Distribution Plot Data... to bring up a dialog
that is quite similar to the main graph dialog:
On the left-hand side of the dialog is a list box showing the types of distribution graph data
that may be saved, along with the name of a matrix in which to save the results. As you
select entries on the left, the right-hand side of the dialog will change to reflect the different
options that are available for your selection. Specify your options as desired and click on OK
to save your results.
References
Anderson, T. W. and D. A. Darling (1952). “Asymptotic Theory of Certain Goodness of Fit Criteria Based
on Stochastic Processes,” Annals of Mathematical Statistics, 23, 193-212.
Anderson, T. W. and D. A. Darling (1954), “A Test of Goodness of Fit,” Journal of the American Statistical
Association, 49, 765-769.
Baxter, Marianne and Robert G. King (1999). “Measuring Business Cycles: Approximate Band-Pass Filters
For Economic Time Series,” Review of Economics and Statistics, 81, 575–593.
Bergmann, Reinhard, John Ludbrook, and Will P. J. M. Spooren (2000). “Different Outcomes of the Wil-
coxon-Mann-Whitney Test From Different Statistical Packages,” The American Statistician, 45(1),
72–77.
Bowerman, Bruce L. and Richard T. O’Connell (1979). Time Series and Forecasting: An Applied Approach,
New York: Duxbury Press.
376—Chapter 11. Series
Box, George E. P. and Gwilym M. Jenkins (1976). Time Series Analysis: Forecasting and Control, Revised
Edition, Oakland, CA: Holden-Day.
Brown, M. B. and A. B. Forsythe (1974a). “Robust Tests for the Equality of Variances,” Journal of the
American Statistical Association, 69, 364–367.
Brown, M. B. and A. B. Forsythe (1974b). “The Small Sample Behavior of Some Test Statistics which Test
the Equality of Several Means,” Technometrics, 16, 129–132.
Christiano, Lawrence J. and Terry J. Fitzgerald (2003). “The Band Pass Filter,” International Economic
Review, 44(2), 435-465.
Cochran, W. G. (1937). “Problems Arising in the Analysis of a Series of Similar Experiments,” Supplement
to the Journal of the Royal Statistical Society, 4(1), 102-118.
Conover, W. J., M. E. Johnson and M. M. Johnson (1981). “A Comparative Study of Tests for Homogene-
ity of Variance with Applications to the Outer Continental Shelf Bidding Data,” Technometrics, 23,
351–361.
Csörgö, Sandor and Julian Faraway (1996). “The Exact and Asymptotic Distributions of Cramer-von
Mises Statistics,” Journal of the Royal Statistical Society, Series B, 58, 221-234.
D’Agostino and Michael A. Stephens, (eds.) (1986). Goodness-of-Fit Techniques. New York: Marcel A.
Deckker.
Dallal, Gerard E. and Leland Wilkinson (1986). “An Analytic Approximation to the Distribution of Lillie-
for’s Test Statistic For Normality,” The American Statistician, 40(4), 294-296.
Davis, Charles S., and Michael A. Stephens (1989). “Empirical Distribution Function Goodness-of-Fit
Tests,” Applied Statistics, 38(3), 535-582.
Dezhbaksh, Hashem (1990). “The Inappropriate Use of Serial Correlation Tests in Dynamic Linear Mod-
els,” Review of Economics and Statistics, 72, 126–132.
Durbin, J. (1970). Distribution Theory for Tests Based on the Sample Distribution Function. SIAM: Phila-
delphia.
Findley, David F., Brian C. Monsell, William R. Bell, Mark C. Otto, Bor-Chung Chen (1998). “New Capa-
bilities and Methods of the X-12-ARIMA Seasonal-Adjustment Program,” Journal of Business & Eco-
nomic Statistics, 16(2), 127-152.
Harvey, Andrew C. (1990). The Econometric Analysis of Time Series, 2nd edition, Cambridge, MA: MIT
Press.
Harvey, Andrew C. (1993). Time Series Models, 2nd edition, Cambridge, MA: MIT Press.
Hodrick, R. J. and E. C. Prescott (1997). “Postwar U.S. Business Cycles: An Empirical Investigation,” Jour-
nal of Money, Credit, and Banking, 29, 1–16.
Judge, George G., W. E. Griffiths, R. Carter Hill, Helmut Lütkepohl, and Tsoung-Chao Lee (1985). The
Theory and Practice of Econometrics, 2nd edition, New York: John Wiley & Sons.
Levene, H. (1960). “Robust Tests for the Equality of Variances,” in I. Olkin, S. G. Ghurye, W. Hoeffding,
W. G. Madow, and H. B. Mann (eds.), Contribution to Probability and Statistics, Palo Alto, CA: Stan-
ford University Press.
Lewis, Peter A. W. (1961). “Distribution of the Anderson-Darling Statistic,” Annals of Mathematical Sta-
tistics, 32, 1118-1124.
Ljung, G. and G. Box (1979). “On a Measure of Lack of Fit in Time Series Models,” Biometrika, 66, 265–
270.
Neter, John, Michael H. Kutner, Christopher J. Nachtsheim, and William Wasserman (1996). Applied Lin-
ear Statistical Models, 4th Edition. Chicago: Times Mirror Higher Education Group, Inc. and Richard
D. Irwin, Inc.
References—377
Ravn, Morten O. and Harald Uhlig (2002). “On Adjusting the Hodrick-Prescott Filter for the Frequency of
Observations,” Review of Economics and Statistics, 84, 371-375.
Satterthwaite, F. E. (1946). “An Approximate Distribution of Estimates of Variance Components,” Biomet-
rics Bulletin, 2(6), 110-114.
Sheskin, David J. (1997). Parametric and Nonparametric Statistical Procedures, Boca Raton: CRC Press.
Sokal, Robert R. and F. James Rohlf (1995). Biometry. New York: W. H. Freeman and Company.
Stephens, Michael A. (1986). “Tests Based on EDF Statistics,” in Goodness-of-Fit Techniques, Ralph B.
D’Agostino and Michael A. Stephens, (eds.). New York: Marcel A. Deckker, 97-193.
Welch, B. L. (1951). “On the Comparison of Several Mean Values: An Alternative Approach,”
Biometrika, 38, 330-336.
378—Chapter 11. Series
Chapter 12. Groups
This chapter describes the views and procedures of a group object. A group object is a col-
lection of series which you wish to treat as a single unit. With a group, you can compute
various statistics that describe the relationship between the series and display them in vari-
ous forms such as spreadsheets, tables, and graphs.
To create a group object, you may select the desired series in the workfile, then right-mouse
click and select Open/as Group. Alternately, you may enter the keyword group on the com-
mand line, followed by the name to be given the group object, then the list of series and
series expressions to be placed in the group.
The remainder of this chapter assumes that you are already familiar with the basics of work-
ing with a group. See the documentation of EViews features beginning with Chapter 4.
“Object Basics,” on page 67 for relevant details on the basic operations.
Group Members
This view displays the member series in the group and allows you
to alter the group. To change the group, simply edit the group win-
dow. You can add other series from the workfile, include expres-
sions involving series, or you can delete series from the group.
380—Chapter 12. Groups
Change you make to the members view are not finalized until you click on the Update-
Group button in the group toolbar. If you attempt to switch away from this group before
updating the altered group members list, you will be prompted to save or discard your
changes.
Alternately, you may use the right-button menu in the spreadsheet view as described below
(“Additional Customization” on page 381) to change the group members, or you may drag-
and-drop series into the Group Members or Spreadsheet views of the group as described in
“Adding to or Modifying a Group” on page 90).
Spreadsheet
This view displays the data, in spreadsheet form, for each series in the group. If you wish,
you can flip the rows and columns of the spreadsheet by pressing the Transpose button. In
transpose format, each row contains a series, and each column an observation or date.
Pressing the Transpose button toggles between the two spreadsheet views.
You may change the display mode of your spreadsheet view to show various
common transformations of your data using the dropdown menu in the
group toolbar. By default, EViews displays the original or mapped values in
the series using the formatting specified in the series (Default). If you wish,
you can change the spreadsheet display to show any transformations defined
in the individual series (Series Spec), the underlying series data (Raw Data),
or various differences of the series (in levels or percent changes), with or
without log transformations.
Spreadsheet—381
Additional Customization
EViews provides you with additional tools for altering the display of
your spreadsheet. To change the display properties, select one or
more series by clicking on the series names in the headers, then right-
click to bring up a menu.
Open selected will open a new group object containing the selected
series in a new, untitled group.
You may use the Insert Series and Remove Series entries to change
the contents of the current group.
If the current ordering of the series is not desired, you may change the order by dragging a
series to the desired position. Dragging is achieved by first selecting one or more series.
Once the selection has been made, move the mouse to either the left edge of the first
selected series or to the right edge of the last selected series. Once over the edge, the cursor
382—Chapter 12. Groups
should change to the cursor shown in the following image. From here, press the left mouse
button and drag the series to the desired location.
A quicker alternative, assuming you only want to sort by only one series, is to use the right-
mouse button menus. Selecting Sort/Ascending or Sort/Descending sorts the observations
using the first selected column of data.
Note that the underlying data in the workfile is not sorted, only the display of observations
and observation identifiers in the group spreadsheet. This method of changing the spread-
sheet display may prove useful if you wish to determine the identities of observations with
high or low values for some series in the group.
Selecting Clear Contents sets the selected observations and variables to NA.
Dated Data Table—383
For example, suppose you wish to show your quarterly data for the GDP and PR series, with
data for each year, along with an annual average, on a separate line:
1994 1994
GDP 1698.6 1727.9 1746.7 1774.0 1736.8
PR 1.04 1.05 1.05 1.06 1.05
1995 1995
GDP 1792.3 1802.4 1825.3 1845.5 1816.4
PR 1.07 1.07 1.08 1.09 1.08
1996 1996
GDP 1866.9 1902.0 1919.1 1948.2 1909.0
PR 1.09 1.10 1.11 1.11 1.10
The dated data table handles all of the work of setting up this table, and computing the
summary values.
Alternatively, you may wish to display annual averages for each year up to the last, fol-
lowed by the last four quarterly observations in your sample:
Again, the dated data table may be used to perform the required calculations and to set up
the table automatically.
The dated data table is capable of creating more complex tables and performing a variety of
other calculations. Note, however, that the dated data table view is currently available only
for annual, semi-annual, quarterly, or monthly workfiles.
You can, however, set options to control the display of your data through the Table and
Row Options dialogs. Note the presence of two new buttons on the group window toolbar,
labeled TabOptions (for Table Options) and RowOptions. TabOptions sets the global
options for the dated data table. These options will apply to all series in the group object.
The RowOptions button allows you to override the global options for a particular series.
Once you specify table and row options for your group, EViews will remember these options
the next time you open the dated data table view for the group.
Table Setup
When you click on the TabOptions button, the Table Options dialog appears. The top half
of the dialog provides options to control the general style of the table.
The two combo boxes on the top right of the dialog supplement your dated display choice
by allowing you to display your data at multiple frequencies in each row. The First Col-
umns selection describes the display frequency for the first group of columns, while the
Dated Data Table—385
Second Columns selection controls the display for the second group of columns. If you
select the same frequency, only one set of results will be displayed.
If necessary, EViews will perform any frequency conversion (to a lower frequency) required
to construct the table.
The effects of these choices on the table display are best described by the following exam-
ple. For purposes of illustration, note that the current workfile is quarterly, with a current
sample of 1993Q1–1996Q4.
Now suppose that you choose to display the first style (two years per row), with the first
columns set to the native frequency, and the second columns set to annual frequency. Each
row will contain eight quarters of data (the native frequency data) followed by the corre-
sponding two annual observations (the annual frequency data):
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Year
1993 1994 1993 1994
GDP 1611.1 1627.3 1643.6 1676.0 1698.6 1727.9 1746.7 1774.0 1639.5 1736.8
PR 1.02 1.02 1.03 1.04 1.04 1.05 1.05 1.06 1.03 1.05
EViews automatically performs the frequency conversion to annual data using the specified
method (see “Transformation Methods” on page 386).
If you reverse the ordering of data types in the first and second columns so that the first col-
umns display the annual data, and the second columns display the native frequency, the
dated data table will contain:
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
1993 1994 1993 1994
GDP 1639.5 1736.8 1611.1 1627.3 1643.6 1676.0 1698.6 1727.9 1746.7 1774.0
PR 1.03 1.05 1.02 1.02 1.03 1.04 1.04 1.05 1.05 1.06
Now, click on TabOptions, choose the second display style, and enter 4 in the edit box.
Then specify Annual frequency for the first columns and Native frequency for the second
columns. EViews will display the annual data for the current sample, followed by the last
four quarterly observations:
Transformation Methods
The following transformations are available:
We emphasize that the above transformation methods represent only the most commonly
employed transformations. If you wish to construct your table with other transformations,
you should add an appropriate auto-series to the group.
Frequency Conversion
The following frequency conversion methods are provided:
Average then Trans- First convert by taking the average, then trans-
form form the average, as specified.
Transform then Aver- First transform the series, then take the average
age of the transformed series.
Sum then Transform First convert by taking the sum, then transform
the sum, as specified.
First Period Convert by taking the first quarter of each year or
first month of each quarter/year.
Last Period Convert by taking the last quarter of each year or
last month of each quarter/year.
The choice between Average then Transform and Transform then Average changes the
ordering of the transformation and frequency conversion operations. The methods differ
only for nonlinear transformations (such as the % change methods).
EViews will display a table with data formatted in the following fashion:
388—Chapter 12. Groups
Q1 Q2 Q3 Q4 Year
1993 1993
GDP 1611.1 1627.3 1643.6 1676.0 6558.1
PR 1.02 1.02 1.03 1.04 4.11
1994 1994
GDP 1698.6 1727.9 1746.7 1774.0 6947.1
PR 1.04 1.05 1.05 1.06 4.20
1995 1995
GDP 1792.3 1802.4 1825.3 1845.5 7265.4
PR 1.07 1.07 1.08 1.09 4.31
1996 1996
GDP 1866.9 1902.0 1919.1 1948.2 7636.1
PR 1.09 1.10 1.11 1.11 4.41
If, instead, you change the Frequency Conversion to First Period, EViews will display a
table of the form:
Q1 Q2 Q3 Q4 Year
1993 1993
GDP 1611.1 1627.3 1643.6 1676.0 1611.1
PR 1.02 1.02 1.03 1.04 1.02
1994 1994
GDP 1698.6 1727.9 1746.7 1774.0 1698.6
PR 1.04 1.05 1.05 1.06 1.04
1995 1995
GDP 1792.3 1802.4 1825.3 1845.5 1792.3
PR 1.07 1.07 1.08 1.09 1.07
1996 1996
GDP 1866.9 1902.0 1919.1 1948.2 1866.9
PR 1.09 1.10 1.11 1.11 1.09
In “Illustration,” beginning on page 389, we provide an example which illustrates the com-
putation of the percentage change measures.
Formatting Options
EViews lets you choose between fixed decimal, fixed digit, and auto formatting of the
numeric data. Generally, auto formatting will produce appropriate output formatting, but if
not, simply select the desired method and enter an integer in the edit field. The options are:
Dated Data Table—389
EViews will round your data prior to display in order to fit the specified format. This round-
ing is for display purposes only and does not alter the original data.
Row Options
These options allow you to override the row defaults specified by the Table Options dialog.
You can specify a different transformation, frequency conversion method, and number for-
mat, for each series.
Other Options
Label for NA: allows you to define
the symbol used to identify missing
values in the table. Bear in mind
that if you choose to display your data in transformed form, the transformation may gener-
ate missing values even if none of the raw data are missing. Dated data table transforma-
tions are explained above.
If your series has display names, you can use the display name as the label for the series in
the table by selecting the Use display names as default labels option. See Chapter 3 for a
discussion of display names and the label view.
Illustration
As an example, consider the following dated data table which displays both quarterly and
annual data for GDP and PR in 1995 and 1996:
390—Chapter 12. Groups
1995 1995
GDP 1792.3 1802.4 1825.3 1845.5 1816.4
(% ch.) 1.03 0.56 1.27 1.11 4.58
PR 1.07 1.07 1.08 1.09 1.08
(% ch.) 0.80 0.49 0.52 0.55 2.55
1996 1996
GDP 1866.9 1902.0 1919.1 1948.2 1909.0
(% ch.) 1.16 1.88 0.90 1.52 5.10
PR 1.09 1.10 1.11 1.11 1.10
(% ch.) 0.72 0.41 0.64 0.46 2.27
At the table level, the first row of output for each of the series is set to be untransformed,
while the second row will show the 1-period percentage change in the series. The table
defaults have both rows set to perform frequency conversion using the Average then
Transformed setting. In addition, we use Series Table Row Options dialog to override the
second row transformation for PR, setting it to Transform then Average option.
The first four columns show the data in native frequency so the choice between Average
then Transform and Transform then Average is irrelevant—each entry in the second row
measures the 1-period (1-quarter) percentage change in the variable.
The 1-period percentage change in the last column is computed differently under the two
methods. The Average then Transformed percentage change in GDP for 1996 measures the
percentage change between the average value in 1995 and the average value in 1996. It is
computed as:
100 ( ( 1909.0 – 1816.3 ) § 1816.4 ) @ 5.10 (12.1)
EViews computes this transformation using full precision for intermediate results, then dis-
plays the result using the specified number format.
The computation of the Transform then Average one-period change in PR for 1996 is a bit
more subtle. Since we wish to compute measure of the annual change, we first evaluate the
one-year percentage change at each of the quarters in the year, and then average the results.
For example, the one-year percentage change in 1996Q1 is given by 100(1.09-1.03)/
1.03=2.29 and the one-year percentage change in 1996Q2 is 100(1.10-1.07)/1.07=2.22.
Averaging these percentage changes yields:
1.09 – 1.07 1.10 – 1.07 1.11 – 1.08 1.11 – 1.09
100 Ê --------------------------- + --------------------------- + --------------------------- + ---------------------------ˆ § 4 @ 2.27 (12.2)
Ë 1.07 1.07 1.08 1.09 ¯
Note also that this computation differs from evaluating the average of the one-quarter per-
centage changes for each of the quarters of the year.
Descriptive Statistics—391
1995 1995
Gross Domestic Product 1792.3 1802.4 1825.3 1845.5 1816.4
One-period % change 1.03 0.56 1.27 1.11 4.58
Price Level 1.07 1.07 1.08 1.09 1.08
One-period % change 0.80 0.49 0.52 0.55 2.55
1996 1996
Gross Domestic Product 1866.9 1902.0 1919.1 1948.2 1909.0
One-period % change 1.16 1.88 0.90 1.52 5.10
Price Level 1.09 1.10 1.11 1.11 1.10
One-period % change 0.72 0.41 0.64 0.46 2.27
Graph
The Graph... menu item brings up the Graph Options dialog, which allows you to select
various types of graphical display of the group. You can create graph objects by freezing
these views. See Chapter 13. “Graphing Data,” beginning on page 435 for a discussion of
techniques for creating and customizing the graphical display.
Descriptive Statistics
Covariance Analysis
The covariance analysis view may be used to obtain different measures of association (cova-
riances and correlations) and associated test statistics for the series in a group. You may
compute measures of association from the following general classes:
• ordinary (Pearson product moment)
• ordinary uncentered
• Spearman rank-order
• Kendall’s tau-a and tau-b
EViews allows you to calculate partial covariances and correlations for each of these general
classes, to compute using balanced or pairwise designs, and to weight individual observa-
tions. In addition, you may display your results in a variety of formats and save results to
the workfile for further analysis.
To proceed, simply open the group object and select View/Covariance Analysis... to dis-
play the covariance dialog:
Covariance Analysis—393
Statistics
Let us now consider some of the options in the dialog in greater detail. The first section of
the dialog, labeled Statistics, controls the statistics to be calculated, and the method of dis-
playing our results.
First you may use the Method combo to specify the type
of calculations you wish to perform. You may choose
between computing ordinary Pearson covariances (Ordi-
nary), uncentered covariances (Ordinary (uncentered)),
Spearman rank-order covariances (Spearman rank-
order), and Kendall’s tau measures of association (Ken-
dall’s tau).
394—Chapter 12. Groups
The checkboxes below the combo box identify the statistics to be computed. Most of the sta-
tistics are self-explanatory, but a few deserve a quick mention
The statistic labeled SSCP refers to the “sum-of-squared cross-products.” The Number of
cases is the number of rows of data used in computing the statistics, while the Number of
obs is the obviously the number of observations employed. These two values will differ only
if frequency weights are employed. The Sum of weights will differ from the number of
cases only if weighting is employed, and it will differ from the number of observations only
if weights are non-frequency weights.
In this example, we perform ordinary covariance analysis and display multiple statistics in a
single table. We see that all of the correlations are positive, and significantly different from
zero at conventional levels. Displaying the Correlation instead of Covariance makes it eas-
Covariance Analysis—395
ier to see that the two chemical companies, Allied and DuPont are more highly correlated
with each other than they are with the oil company Exxon.
Note that the multiple table results make it easier to compare correlations across variables,
but more difficult to relate a given correlation to the corresponding probability and number
of cases.
396—Chapter 12. Groups
A third major class of measures of association is based on Kendall’s tau (see “Kendall’s
Tau” on page 400). Briefly, Kendall’s tau for two variables is based on the number of con-
cordances and discordances between the orderings of the variables for all possible compari-
sons of observations. If the number of concordances and discordances are roughly the
same, there is no association between the variables, relatively large numbers of concor-
dances suggest a positive relationship between the variables, and conversely for relatively
large numbers of discordances.
Here, we display output in list format, showing Kendall’s tau-b, Kendall’s D & C, and
Probability:
The results are similar to those obtained from ordinary and Spearman correlations, though
the tau-b measures of association are somewhat lower than their counterparts.
Sample
EViews will initialize the edit field with the current workfile sample, but you may modify
the entry as desired.
By default, EViews will perform listwise deletion when it encounters missing values so that
all statistics are calculated using the same observations. To perform pairwise deletion of
missing values, simply uncheck the Balanced sample (listwise deletion) checkbox. Pair-
wise calculations will use the maximum number of observations for each calculation.
Note that this option will be ignored when performing partial analysis since the latter is only
performed on balanced samples
Partial Analysis
A partial covariance is the covariance between two variables while controlling for a set of
conditioning variables.
Covariance Analysis—397
While some stork lovers may wish to view this correlation as indicative of a real relation-
ship, others might argue that the positive correlation is spurious. One possible explanation
lies in the existence of confounding variables or factors which are related to both the stork
population and the number of births. Two possible factors are the population and area of
the country.
Options
EViews provides a variety of other options for calculating
your measures of association and for saving results.
Weighting
When you specify weighting, you will be prompted to
enter a different weighting method and the name of a
weight series. There are five different weight choices: fre-
quency, variance, standard deviation, scaled variance,
and scaled standard deviation.
EViews will compute weighted means and variances using the specified series and weight
method. In each case, observations are weighted using the weight series; the different
weight choices correspond to different functions of the series and different numbers of
observations.
Degrees-of-freedom Correction
You may choose to compute covariances using the maximum likelihood estimator or using
the unbiased (degree-of-freedom corrected) formula. By default, EViews computes the ML
estimates of the covariances.
When you check d.f. corrected covariances, EViews will compute the covariances by divid-
ing the sums-of-squared cross-products by the number of observations n less the number of
conditioning elements k , where k equals the number of conditioning variables, including
the mean adjustment term, if present. For example, if you compute ordinary covariances
conditional on Z 1, Z 2, Z 3 , the divisor will be n – 4 .
where a is the specified (overall) size of the tests, and m is the number of tests performed.
For the Dunn-Sidak adjustment, we set the elementwise size to
1§m
a¢ = 1 – ( 1 – a ) (12.4)
Covariance Analysis—399
Saved Results
You may place the results of the covariance analysis into symmetric matrices in the workfile
by specifying a Saved results basename. For each requested statistic, EViews will save the
results in a sym matrix named by appending an identifier (“cov,” “corr,” “sscp,” “tstat,”
“prob,” “taua,” “taub,” “score” (Kendall’s score), “conc” (Kendall’s concurrences), “disc”
(Kendall’s discordances), “cases,” “obs,” “wgts”) to the basename.
For example, if you request ordinary correlations, probability values, and number of obser-
vations, and enter “MY” in the Saved results basename edit field, EViews will output three
sym matrices MYCORR, MYPROB, MYOBS containing the results. If objects with the speci-
fied names already exist, you will be prompted to replace them.
Details
The following is a brief discussion of computational details. For additional discussion, see
Johnson and Wichern (1992), Sheskin (1997), Conover (1980), and Kendall and Gibbons
(1990).
The covariances are computed by dividing the SSCP by the number of observations with or
without a degrees-of-freedom correction:
 ( Xi – m̂X ) ( Y i – m̂ Y )
ĵ ( X, Y ) = -------------------------------------------------------
i - (12.6)
n–k
where n is the number of observations associated with the observed X , Y pairs, and k is
a degree-of-freedom adjustment term. By default EViews uses the ML estimator so that
k = 0 , but you may perform a degrees-of-freedom correction that sets k equal to the num-
ber of conditioning variables (including of the mean adjustment term, if present).
The correlation between the variables X and Y is computed from the following expres-
sion:
ĵ ( X, Y )
r̂ ( X, Y ) = ----------------------------------------------------------
1§2
- (12.7)
( ĵ ( X, X ) ⋅ ĵ ( Y, Y ) )
400—Chapter 12. Groups
It is worth reminding you that in unbalanced designs, the numbers of observations used in
estimating each of the moments may not be the same.
Textbooks often provide simplified expressions for the rank correlation in to the case where
there are no ties. In this case, Equation (12.7) simplifies to:
2
6 Â ( R ( Xi ) – R ( Yi ) )
r ( X, Y ) = 1 – -------------------------------------------------------
i (12.8)
2
n( n – 1)
where R returns the rank of the observation.
Kendall’s Tau
Kendall’s tau is a nonparametric statistic that, like Spearman’s rank-order statistic, is based
on the ranked data. Unlike Spearman’s statistic, Kendall’s tau uses only the relative order-
ings of ranks and not the numeric values of the ranks.
Consider the ranked data for any two observations i and j . We say that there is a concor-
dance in the rankings if the relative orderings of the ranks for the two variables across
observations are the same: R ( X i ) > R ( X j ) and R ( Y i ) > R ( Y j ) or R ( X i ) < R ( X j ) and
R ( Y i ) < R ( Y j ) . Conversely, we say that there is a discordance if the ordering of the X
ranks differs from the ordering of the Y ranks: R ( X i ) > R ( X j ) and R ( Y i ) < R ( Y j ) or
R ( X i ) < R ( X j ) and R ( Y i ) > R ( Y j ) . If there are ties in the ranks of either the X or the
Y pairs, we say the observation is neither concordant or discordant.
Intuitively, if X and Y are positively correlated, the number of concordances should out-
number the number of discordances. The converse should hold if X and Y are negatively
related.
We may form a simple measure of the relationship between the variables by considering
Kendall’s score S , defined as the excess of the concordant pairs, C , over the discordant
pairs, D . S which may be expressed as:
S ( X, Y ) = Â sgn ( R ( X i ) – R ( X j ) ) ⋅ sgn ( R ( Y i ) – R ( Y j ) ) (12.9)
i<j
where the sign function takes the values -1, 0, and 1 depending on whether its argument is
negative, zero, or positive. Kendall’s tau-a is defined as the average of the excess of the con-
Covariance Analysis—401
cordant over the discordant pairs. There are n ( n – 1 ) § 2 unique comparisons of pairs of
observations that are possible so that:
t a ( X, Y ) = S ( X, Y ) § q (12.10)
In the absence of tied ranks, – 1 £ t a £ 1 , with t a = 1 when all pairs are concordant and
t a = – 1 when all pairs are discordant.
One disadvantage of t a is that the endpoint values -1 and 1 are not reached in the presence
of tied ranks. Kendall’s tau-b t b rescales t a by adjusting the denominator of t a to account
for the ties:
S ( X, Y )
t b ( X, Y ) = ---------------------------------------------------------------------------------------------------------------------------------------- (12.11)
n(n – 1) t ( t – 1) n(n – 1) u v ( uv – 1 )
--------------------- – Â ----------------------
s s
- --------------------- – Â -------------------------
2 s
2 2 v
2
where t s are the number of observations tied at each unique rank of X , and u v are the
number of observations tied at each rank of Y . This rescaling ensures that t b ( X, X ) = 1 .
Note that in the absence of ties, the summation terms involving t and u equal zero so that
ta = tb .
It is worth noting that computation of these measures requires n ( n – 1 ) § 2 comparisons, a
number which increases rapidly with n . As a result, textbooks sometimes warn users about
computing Kendall’s tau for moderate to large samples. EViews uses very efficient algo-
rithms for this computation, so for practical purposes, the warning may safely be ignored. If
you find that the computation is taking too long, pressing the ESC break key may be used to
stop the computation.
Weighting
Suppose that our weight series Z has m individual cases denoted by z i . Then the weights
and number of observations associated with each of the possible weighting methods are
given by:
Frequency weighting is the only weighting allowed for Spearman’s rank-order and Kendall’s
tau measures of association.
where the X i and Y i are the original data or ranks (respectively), the m̃ are weighted
means (or zeros if computing uncentered covariances), and the w i are weights that are
functions of the specified weight series.
m̃ X = Ê Â w i X iˆ § n, m̃ Y = Ê Â w i Y iˆ § n (12.13)
Ë ¯ Ë ¯
i i
 w i ( X i – m̃ X ) ( Yi – m̃ Y )
j̃ ( X, Y ) = -------------------------------------------------------------
i - (12.14)
n–k
and the weighted correlations by
j̃ ( X, Y )
r̃ X Y = ----------------------------------------------------------- (12.15)
1§2
( j̃ ( X, X ) ⋅ j̃ ( Y, Y ) )
The weighted Kendall’s tau measures are derived by implicitly expanding the data to accom-
modate the repeated observations, and then evaluating the number of concordances and
discordances in the usual fashion.
Testing
The test statistics and associated p-values reported by EViews are for testing the hypothesis
that a single correlation coefficient is equal to zero. If specified, the p-values will be
adjusted using Bonferroni or Dunn-Sidak methods (see “Multiple Comparison Adjust-
ments,” on page 398).
The test of significance for Kendall’s tau is based on a normal approximation using the con-
tinuity corrected z -statistic (Kendall and Gibbons, 1990, p. 65–66):
S – sgn ( S )
z = ---------------------------- (12.17)
var (S )
where the variance is given by:
var(S) = S1 + S2 + S3 (12.18)
for
1
S1 = ------ ÊË n ( n – 1 ) ( 2n + 5 ) –  ts ( t s – 1 ) ( 2ts + 5 ) –  u v ( u v – 1 ) ( 2u v + 5 )ˆ¯
18 s v
1
S2 = ------------------------------------------- ÊË Â t s ( t s – 1 ) ( t s – 2 )ˆ¯ ÊË Â u v ( u v – 1 ) ( u v – 2 )ˆ¯ (12.19)
9n ( n – 1 ) ( n – 2 ) s v
1
S3 = ------------------------- Ê Â t s ( t s – 1 )ˆ Ê Â u v ( u v – 1 )ˆ
2n ( n – 1 ) Ë s ¯Ë
v
¯
where t s are the number of observations tied at each unique rank of X and u v are the
number of observations tied at each rank of Y . In the absence of ties, Equation (12.18)
reduces to the expression:
1
var ( S ) = ------ n ( n – 1 ) ( 2n + 5 ) (12.20)
18
usually provided in textbooks (e.g., Sheskin, 1997, p. 633).
Probability values are approximated by evaluating the two-tailed probability of z using the
standard normal distribution. Note that this approximation may not be appropriate for small
sample sizes; Kendall and Gibbons (1990) suggest that the approximation is not generally
recommended for n < 30 (in the untied case).
Significance level values are currently not provided for partial Kendall’s tau.
Partial Analysis
Let W = ( X, Y ) be the set of analysis variables, and let Z be the set of conditioning vari-
ables.
For the ordinary and Spearman rank-order calculations, the joint sums of squares and cross-
products for the two sets of variables are given by:
404—Chapter 12. Groups
S Z Z S ZW
S = (12.21)
SW Z SW W
EViews conditions on the Z variables by calculating the partial SSCP using the partitioned
inverse formula:
–1
SW W Z = SW W – SW Z SZ ZSZ W (12.22)
Partial covariances are derived by dividing the partial SSCP by n – k ; partial correlations
are derived by applying the usual correlation formula (scaling the partial covariance to unit
diagonals).
For Kendall’s tau computations, the partitioned inverse is applied to the corresponding
matrix of joint Kendall’s tau values. The partial Kendall’s tau values are obtained by apply-
ing the correlation formula to the partitioned inverse.
N-Way Tabulation
This view classifies the observations in the current sample into cells defined by the series in
the group. You can display the cell counts in various forms and examine statistics for inde-
pendence among the series in the group. Select View/N-Way Tabulation… which opens
the tabulation dialog.
• Average count option bins the series if the average count for each distinct value of
the series is less than the specified number.
• Maximum number of bins specifies the approximate maximum number of sub-
groups to bin the series. The number of bins may be chosen to be smaller than this
number in order to make the bins approximately the same size.
The default setting is to bin a series into approximately 5 subgroups if the series takes more
than 100 distinct values or if the average count is less than 2. If you do not want to bin the
series, unmark both options.
NA Handling
By default, EViews drops observations from the contingency table where any of the series in
the group has a missing value. Treat NA as category option includes all observations and
counts NAs in the contingency table as an explicit category.
Layout
This option controls the display style of the tabulation. The Table mode displays the catego-
ries of the first two series in r ¥ c tables for each category of the remaining series in the
group.
The List mode displays the table in a more compact, hierarchical form. The Sparse Labels
option omits repeated category labels to make the list less cluttered. Note that some of the
2
conditional x statistics are not displayed in list mode.
Output
To understand the options for output, consider a group with three series. Let (i, j, k) index
the bin of the first, second, and third series, respectively. The number of observations in the
(i, j, k)-th cell is denoted as n i jk with a total of N = Â Â Â n i jk observations.
i j k
• Overall% is the percentage of the total number of observations accounted for by the
cell count.
• Table% is the percentage of the total number of observations in the conditional table
accounted for by the cell count.
• Row% is the percentage of the number of observations in the row accounted for by
the cell count.
• Column% is the percentage of the number of observations in the column accounted
for by the cell count.
The overall expected count in the (i, j, k)-th cell is the number expected if all series in the
group were independent of each other. This expectation is estimated by:
406—Chapter 12. Groups
n̂ i jk = Ê Â n * § Nˆ Ê Â n * § Nˆ Ê Â n * § Nˆ N . (12.23)
Ë ijk ¯Ë i jk ¯Ë ij k ¯
i j k
The table expected count ñ i jk is estimated by computing the expected count for the condi-
tional table. For a given table, this expected value is estimated by:
ñ = Ê Â n * § N *ˆ Ê Â n * § N *ˆ N * (12.24)
Ë
i jk
*
i jk k¯Ë i jk k¯ k
i j
where N k∗ is the total number of observations in the k∗ table.
Chi-square Tests
2
If you select the Chi-square tests option, EViews reports x statistics for testing the inde-
pendence of the series in the group. The test statistics are based on the distance between the
actual cell count and the count expected under independence.
• Overall (unconditional) independence among all series in the group. EViews
reports the following two test statistics for overall independence among all series in
the group:
2
2 ( n̂ i, j, k – n i, j, k )
Pearson x = Â ---------------------------------------
n̂ i, j, k
-
i, j, k (12.25)
n i, j, kˆ
Likelihood ratio = 2 Â n i, j, k log Ê ------------
-
Ë n̂ i, j, k¯
i, j, k
where n i jk and n̂ i jk are the actual and overall expected count in each cell. Under the
2
null hypothesis of independence, the two statistics are asymptotically distributed x
with IJK – ( I – 1 ) – ( J – 1 ) – ( K – 1 ) – 1 degrees of freedom where I, J, K are the
number of categories for each series.
These test statistics are reported at the top of the contingency table. For example, the top
portion of the tabulation output for the group containing LWAGE, UNION, and MARRIED in
the workfile “Cps88.WF1” shows:
N-Way Tabulation—407
Tabulation Summar y
where min ( r, c ) is the smaller of the number of row categories r or column categories c
of the table, and Ñ is the number of observations in the table. Note that all three measures
are bounded between 0 and 1, a higher number indicating a stronger relation between the
two series in the table. While the correlation coefficient only measures the linear association
between two series, these nonparametric measures are robust to departures from linearity.
408—Chapter 12. Groups
UNION
Count 0 1 Total
[0, 1) 0 0 0
[1, 2) 167 8 175
LWAGE [2, 3) 121 44 165
[3, 4) 17 2 19
[4, 5) 0 0 0
Total 305 54 359
Bear in mind that these measures of association are computed for each two-way table.
The conditional tables are presented at the top, and the unconditional tables are
reported at the bottom of the view.
Tests of Equality
This view tests the null hypothesis that all series in the group have the same mean, median
(distribution), or variance. All of these tests are described in detail in “Equality Tests by
Classification” on page 324.
First, save the residuals from the pooled OLS regression and make a group of the residuals
corresponding to each country. This is most easily done by estimating the pooled OLS
regression using a pool object and saving the residuals by selecting Proc/Make Residuals in
the pool object menu or toolbar.
Principal Components—409
Next, open a group containing the residual series. One method is to highlight each residual
series with the right mouse button, double click in the highlighted area and select Open
Group. Alternatively, you can type show, followed by the names of the residual series, in
the command window.
Select View/Tests of Equality…, and choose the Variance option in the Test Between
Series dialog box.
Here we see results for testing the equality of variances for investment by various firms
using data in the workfile “Grunfeld_baltagi_pool.WF1”. The test statistics providing strong
evidence of the presence of firmwise heteroskedasticity, decisively rejecting the null hypoth-
esis of equal variances.
Principal Components
Principal components analysis models the variance structure of a set of observed variables
using linear combinations of the variables. These linear combinations, or components, may
be used in subsequent analysis, and the combination coefficients, or loadings, may be used
in interpreting the components. While we generally require as many components as vari-
410—Chapter 12. Groups
ables to reproduce the original variance structure, we usually hope to account for most of
the original variability using a relatively small number of components.
We may, for example, have a very large number of variables describing individual health
status that we wish to reduce to a manageable set. By forming linear combinations of the
observed variables we may achieve data reduction by creating a handful of measures that
describe overall health (e.g., “strength,” “fitness,” “disabilities”). The coefficients in these
linear combinations may be used to provide interpretation to the newly constructed health
measures.
The principal components of a set of variables are obtained by computing the eigenvalue
decomposition of the observed variance matrix. The first principal component is the unit-
length linear combination of the original variables with maximum variance. Subsequent
principal components maximize variance among unit-length linear combinations that are
orthogonal to the previous components.
As an illustration, we again consider the stock price example from Johnson and Wichtern
(1992) in which 100 observations on weekly rates of return for Allied Chemical, DuPont,
Union Carbide, Exxon, and Texaco were examined over the period from January 1975 to
December 1976 (“Stock.WF1”).
To perform principal components on these data, we open the group G1 containing the series
and select View/Principal Components... to open the dialog:
Principal Components—411
Table
In the figure above, the Table display setting is chosen. There are two sets of fields that you
may wish to modify.
meets or exceeds the target proportion of the total variance. By default, the settings are cho-
sen so that all components will be retained.
The Output fields allow you to save the eigenvalues and eigenvectors to the workfile. Sim-
ply enter a valid name in the corresponding field if you wish EViews to save your results.
If we leave the default settings as is and click OK, EViews will display a table of results.
Eigenvectors (loadings):
Variable PC 1 PC 2 PC 3 PC 4 PC 5
Here we show the top two sections of the table. The header describes the sample of obser-
vations, the method used to compute the dispersion matrix, and information about the num-
ber of components retained (in this case, all five).
The next section summarizes the eigenvalues, showing the values, the forward difference in
the eigenvalues, the proportion of total variance explained, etc. Since we are performing
principal components on a correlation matrix, the sum of the scaled variances for the five
variables is equal to 5. The first principal component accounts for 57% of the total variance
(2.856/5.00 = 0.5713), while the second accounts for 16% (0.809/5.00 = 0.1618) of the
total. The first two components account for over 73% of the total variation.
The second section describes the linear combination coefficients. We see that the first prin-
cipal component (labeled “PC1”) is a roughly-equal linear combination of all five of the
stock returns; it might reasonably be interpreted as a general stock return index. The second
principal component (labeled “PC2”) has negative loadings for the three chemical firms
Principal Components—413
(Allied, du Pont and Union Carbide), and positive loadings for the oil firms (Exxon and Tex-
aco). This loading appears to represent an industry specific component.
The third section of the output displays the calculated correlation matrix:
Ordinary correlations:
Eigenvalues Plots
You may elect to display line
graphs of the ordered eigenvalues
by selecting Eigenvalues plots in
the Display portion of the main
dialog. The dialog will change to
offer you the choice of displaying
plots of any of: the eigenvalues
(scree plot), the eigenvalues dif-
ference, the cumulative propor-
tion of variance explained. By
default, EViews will only display
the scree plot of ordered eigenval-
ues.
The lower portion of the graph shows the cumulative proportion of the total variance. As we
saw in the table, the first two components account for about 73% of the total variation. The
diagonal reference line offers an alternative method of evaluating the size of the eigenval-
ues. The slope of the reference line may be compared with the slope of the cumulative pro-
414—Chapter 12. Groups
portion; segments of the latter that are steeper than the reference line have eigenvalues that
exceed the mean.
We continue our example by displaying the biplot graph since it includes the options for
both the loadings and scores plots. If we select the Biplots (scores and loadings) entry, the
right side of the dialog changes to provide additional plot options.
Components to Plot
The top right portion of the
dialog, labeled Compo-
nents to plot, is where you
will provide the basic speci-
fication for the graphs that
you want to display.
You may add indices for additional components. When more than two indices are provided,
the Multiple graphs setting provides choices for how you wish to process the indices. You
may elect to plot the first listed component against the remaining components (First vs.
All), to use successive pairs of indices to form plots (XY pairs), or to plot each component
against the others (Lower triangular matrix).
The Scaling options determine the weights to be applied to eigenvalues in the scores and
the loadings (see “Technical Discussion,” beginning on page 418 for details). By default, the
Principal Components—415
loadings are normalized so the observation scores have norms proportional to the eigenval-
ues (Normalize loadings). You may instead choose to normalize the scores instead of the
loadings (Normalize scores) so that the observation score norms are proportional to unity,
to apply symmetric weighting (Symmetric weights), or to specify a user-supplied loading
weight (User loading weight).
In the latter three cases, you will be prompted to indicate whether you wish to adjust the
results account for the sample size (Adjust scores & loadings for sample size). By default,
EViews uses this setting and scales the loadings and scores so that the variances of the
scores (instead of the norms) have the desired structure (see “Observation Scaling” on
page 421). Setting this option may improve the interpretability of the plot. For example,
when normalizing scores, the weight adjustment scales the results so that the Euclidean dis-
tances between observations are the Mahalanobis distances and the cosines of the angles
between variables are the covariances.
Using the default settings and clicking on OK, EViews produces the view:
The scores labels show us that observation 3 is an outlier, with a high value for the general
stock market index, and a relatively neutral value for the sector index. Observation 37
shows a poor return for the general market but is relatively sector neutral. In contrast,
observation 20 is a period in which the overall market return was positive, with high returns
to the energy sector relative to the chemical sector.
416—Chapter 12. Groups
Graph Options
There are three additional options provided under
Graph options. The first option is to Center graphs
around zero. Unchecking this box will generally
enlarge the graph within the frame at the expense of
making it somewhat more difficult to quickly discern
the signs of scores and loadings in a given dimension.
The Obs. labels combo allows you to choose the style of text labeling for observations. By
default, EViews will Label outliers, but you may instead choose to Label all obs. or to dis-
play Symbols only. If you choose to label outliers, EViews will use a cutoff based on the
specified probability value for the Mahalanobis distance of the observation from 0. The
default is 0.1 so that labeled observations differ from the 0 with probability less than 0.1.
The last option, Loadings axis scaling, is available only for biplot graphs. Note that the
observations and variables in a biplot will generally have very different data scales. Instead
of displaying biplots with dual scales, EViews applies a constant scaling factor to the load-
ings axes to make the graph easier-to-read. Loadings axis scaling allows you to override
the EViews default scale for the loadings in two distinct ways.
First, you may instruct EViews to apply a scale factor to the automatically chosen factor.
This method is useful if you would like to stretch or shrink the EViews default axes. With
the Loadings axis scaling set to Automatic, simply enter your desired adjustment factor.
The automatically determined loadings will be scaled by this factor.
Alternatively, if you wish to assign an absolute scaling factor, select User-specified for the
axis scaling, and enter your scale factor. The original loadings will be scaled by this factor.
For the latter three selections, you are also given the option of adjusting the scores and load-
ings for the sample size. If Adjust scores & loadings for sample size is selected, the scores
are scaled so that their variance rather than the sums-of-squares (norms) match the desired
value. In this example, the sample variances of the component scores will equal 1.
Next, you should enter names for the score series, one name per component score you wish
to save. Here we enter two component names, “Market” and “Industry,” corresponding to
the interpretation of our components given above. You may optionally save the loadings
corresponding to the saved scores, eigenvalues, and eigenvectors to the workfile.
Covariance Calculation
The EViews routines for principal components allow you to compute the dispersion matrix
for the series in a group in a number of ways. Simply click on the Calculation tab to display
the preliminary calculation settings.
418—Chapter 12. Groups
Note that component scores may not be computed for dispersion matrices estimated using
Kendall’s tau-a and tau-b.
Technical Discussion
From the singular value decomposition, we may represent a ( n ¥ p ) data matrix Y of rank
r as:
Y = UDV¢ (12.29)
where U and V are orthonormal matrices of the left and right singular vectors, and D is a
diagonal matrix containing the singular values.
B involve the choice of (loading) weight parameter a and (observation) scaling parameter
b.
In the principal components context, let S be the cross-product moment (dispersion) matrix
of Y , and perform the eigenvalue decomposition:
S = LLL¢ (12.32)
where L is the p ¥ p matrix of eigenvectors and L is the diagonal matrix with eigenvalues
on the diagonal. The eigenvectors, which are given by the columns of L , are identified up
to the choice of sign. Note that since the eigenvectors are by construction orthogonal,
L¢L = LL¢ = Im .
–1 1§2
We may set U = YLD , V = L , and D = ( nL ) , so that:
b§2 –a
A = n YLD
(12.33)
–b § 2 a
B = n LD
A may be interpreted as the weighted principal components scores, and B as the weighted
principal components loadings. Then the scores and loadings have the following properties:
b –a –a b –a § 2 –a § 2 b 1–a
A¢A = n D L¢Y¢YLD = n ( nL ) ( nL ) ( nL ) = n ( nL )
–b a a –b a
B¢B = n D L¢LD = n ( nL ) (12.34)
–b 2a –b a
BB¢ = n LD L¢ = n L ( nL ) L¢
Through appropriate choice of the weight parameter a and the scaling parameter b , you
may construct scores and loadings with various properties (see “Loading Weights” on
page 419 and “Observation Scaling” on page 421). EViews provides you with the opportu-
nity to choose appropriate values for these parameters when displaying graphs of principal
component scores and loadings and when saving scores and loadings to the workfile.
Note that when computing scores using Equation (12.33), EViews will transform the Y to
match the data used in the original computation. For example, the data will be scaled for
analysis of correlation matrices, and partialing will remove means and any conditioning
variables. Similarly, if the preliminary analysis involves Spearman rank-order correlations,
the data are transformed to ranks prior to partialing. Scores may not be computed for dis-
persion matrices estimated using Kendall’s tau.
Loading Weights
At one extreme, we define the normalized loadings (also termed the form, or JK) decompo-
sition where a = b = 0 . The scores formed from the normalized loadings decomposition
will have variances equal to the corresponding eigenvalues. To see this, substituting into
Equation (12.33), and using Equation (12.30) we have Y = JK¢ , where:
420—Chapter 12. Groups
J = YL
(12.35)
K = L
From Equation (12.34), the scores J and loadings K have the norms:
J¢J = nL
(12.36)
K¢K = I p
The rows of J are said to be in principal coordinates, since the norm of J is the diagonal
matrix with the eigenvalues on the diagonal. The columns of K are in standard coordinates
since K is orthonormal (Aitchison and Greenwood, 2002, p. 378). The JK specification has
a row preserving metric (RPM) since the observations in J retain their original scale.
At the other extreme, we define the normalized scores (also referred to as the covariance or
GH) decomposition where a = 1 . Then we may write Y = GH¢ where:
b§2 –1
G = n YLD
(12.37)
–b § 2
H = n LD
Evaluating the norms using Equation (12.34), we have:
b
G¢G = n Ip
–b
H¢H = n ( nL ) (12.38)
–b 1–b
HH¢ = n L ( nL )L¢ = n S
For this factorization, G is orthonormal (up to a scale factor) and the norm of H is propor-
tional to the diagonal matrix with the n times the eigenvalues on the diagonal. Thus, the
specification is said to favor display of the variables since the H loadings are in principal
coordinates and the scores G are in standard coordinates (so that their variances are identi-
cal). The GH specification is sometimes referred to as the column metric preserving (CMP)
specification.
In interpreting results for the GH decomposition, bear in mind that the Euclidean distances
between observations are proportional to Mahalanobis distances. Furthermore, the norms of
the columns of H are proportional to the factor covariances, and the cosines of the angles
between the vectors approximate the correlations between variables.
Obviously, there are an infinite number of alternative scalings lying between the extremes.
One popular alternative is to weight the scores and the loadings equally by setting
a = 0.5 : This specification is the SQ or symmetric biplot, where Y = SQ¢ :
b§2 –1 § 2
S = n YLD
(12.39)
–b § 2 1§2
Q = n LD
Evaluating the norms of the scores S and loadings Q , we have:
Principal Components—421
b 1§2
S¢S = n ( nL )
(12.40)
–b 1§2
Q¢Q = n ( nL )
so that the norms of both the observations and the variables are proportional to the square
roots of the eigenvalues.
Observation Scaling
In the decompositions above, we allow for observation scaling of the scores and loadings
parameterized by b . There are two obvious choices for the scaling parameter b .
when EViews performs this adjustment, it employs the denominator from the original dis-
persion calculation which will differ from n if any degrees-of-freedom adjustment has been
applied.
Correlograms
Correlogram displays the autocorrelations and partial autocorrelations of the first series in
the group. See “Correlogram” on page 333, for a description of the correlogram view.
and,
Ï
Ô T–l
Ô
Ô
 ( ( x t – x ) ( y t + l –y ) ) § T l = 0, 1, 2, º
c xy ( l ) = Ì t= 1 (12.45)
Ô T+l
Ô
Ô
 ( ( yt – y ) ( x t – l – x ) ) § T l = 0, –1 , – 2, º
t= 1
Ó
Long-run Covariance
You may compute estimates
of the long-run covariance
matrix of a group of series.
Long-run Covariance—423
The discussion that follows assumes that you are familiar with the various issues and
choices involved in computing a long-run covariance matrix. The technical description of
the tools are given in Appendix E. “Long-run Covariance Estimation,” on page 1413 of
User’s Guide II.
By default, EViews will estimate the symmetric long-run covariance matrix using a non-
parametric kernel estimator with a Bartlett kernel and a real-valued bandwidth determined
solely using the number of observations. The data will be centered (by subtracting off
means) prior to computing the kernel covariance estimator, but no other pre-whitening will
be performed. The results will only be displayed in the series or group window.
Basic Options
You may instruct EViews to compute a one-sided covariance
by changing the Window combo from the Symmetric
default to one of Lower (lags), Strict lower (lags), Upper
(leads), Strict upper (leads). The “lower” methods only use
covariances in which the rows correspond to contemporane-
ous values and the columns correspond to current and
lagged data; the “upper” methods employ covariances where
the columns correspond to current values and leads of the
data. The “strict” long-run covariances exclude the contemporaneous covariance from the
computation.
424—Chapter 12. Groups
In addition, you may provide weights by entering a series expression in the Row weights
edit field. Row weights are a convenient way of instructing EViews to compute the long-run
covariance on data where the series in the group are weighted by a common element. A
leading application occurs in the computation of White or Newey-West regression coeffi-
cient covariances, where the group contains the regressor data and the weights are the
residuals. For example, if you have the regressors series X1, X2, and X3 in your group, and
the residuals are in the series RES, entering “RES” in the Row weights edit field instructs
EViews to compute the long-run covariance of “X1*RES”, “X2*RES”, “X3*RES”.
Lastly, you may elect to save your results in an EViews object. Simply enter a valid EViews
object name in the Output matrix edit field. EViews will save symmetric long-run covari-
ances in a sym object and one-sided covariances in a matrix object.
Whitening Options
The Whitening options section is used to define options for computing the VAR used in
computing VARHAC or pre-whitened kernel estimation.
Kernel Options
The Kernel options section is used to define settings for
estimation of the long-run covariance of the original or pre-whitened data.
Kernel Shape
The Kernel combo is used to define the method for com-
puting the long-run covariance. Choosing None tells
EViews to compute the long-run covariance using only
the contemporaneous covariance. (The VARHAC meth-
odology, for example, uses a combination of pre-whiten-
ing and the None setting.) The remaining choices specify
the shape of the kernel function. There are a large num-
ber of pre-defined kernel shapes from which you may
choose, as well as the option to provide the name of a
User-specified custom kernel shape vector.
Bandwidth Specification
If you elect to use one of the pre-defined kernel shapes,
EViews will prompt you to provide bandwidth informa-
tion. By default, the kernel bandwidth is determined by
the arbitrary observation-based Newey-West Fixed
bandwidth rule. You may override the default choice
by selecting either the Andrews Automatic, Newey-
West Automatic settings for automatic optimal band-
width selection, or the User-specified setting if you wish to provide a bandwidth value.
426—Chapter 12. Groups
Examples
To illustrate the use of the long-run covariance view of a group, we employ the HAC covari-
ance matrix example taken from Stock and Watson (2007, p. 620, Column 1). In this exam-
ple Stock and Watson estimate the dynamic effect of cold weather on the price of orange
juice by regressing the percent change in prices on a distributed lag of the number of freez-
ing degree days and a constant, and obtain a HAC estimator for the coefficient covariance
matrix using a Bartlett kernel estimator with lag truncation of 7. While the HAC covariances
may be obtained directly from the EViews equation object (see “HAC Consistent Covari-
ances (Newey-West)” on page 654 of User’s Guide II), here we will estimate the long-run
covariance estimate of X t ê t manually using the group long-run covariance view, and will
use this estimate to derive the HAC coefficient covariance matrix.
First, open the workfile “Stockwat_620.WF1”, and notice that we have the equation object
EQ_OLS which contains an estimated OLS equation (with conventional coefficient covari-
ance and standard errors), and the group object XVARS which contains the regressors for
the equation. We wish to compute the HAC coefficient covariance associated with the coef-
ficient estimates in EQ_OLS using the group XVARS.
First, we need to obtain the residuals. Open EQ_OLS and click on Proc/Make Residual
Series to display the Make Residuals dialog. Enter “RES” for the name of the residuals,
then click on OK to save the regression residuals in the workfile.
Long-run Covariance—427
Next, we will compute the symmetric long-run covariance of X t ê t . Double click on XVARS
to open the group containing the regressors, then select View/Long-run Covariance... to
display the dialog.
The Stock-Watson example uses a Bartlett kernel with no pre-whitening, so we leave the
Lag spec at the default None setting and the Kernel shape choice at the default Bartlett. We
should, however, change the Bandwidth method to User-specified and enter “8” in the edit
field to match the 7 lags employed by Stock and Watson. Click on OK to compute and save
the results.
The long-run covariance estimates are displayed in the group window and saved in the
LRCOV matrix in the workfile. To obtain the d.f. corrected HAC coefficient covariances (see,
for example, Hamilton (1994, p. 282)), we issue the commands:
sym xxinv = @inverse(@inner(xvars))
scalar obs = eq_ols.@regobs
scalar df = eq_ols.@regobs - eq_ols.@ncoef
sym hac_direct = (obs / df) * obs * xxinv * lrcov * xxinv
–1
The first line computes ( X¢X ) . The next two lines get the number of observations and
the number of degrees-of-freedom. The last line computes the d.f. corrected sandwich esti-
mator using the long-run covariance in LRCOV as the estimator of E ( X¢êê¢X § T ) .
You may wish to verify that the estimate HAC_DIRECT matches the coefficient covariance
matrix obtained using equation EQ_HAC (also provided in the workfile) estimated using the
same HAC settings:
equation eq_hac.ls(cov=hac, covbw=8) 100*dlog(poj) xvars
sym hac_eq = eq_hac.@coefcov
428—Chapter 12. Groups
See “Panel Unit Root Test” on page 1011 of User’s Guide II for additional discussion.
Cointegration Test
This view carries out the Johansen, Engle-Granger, or Phillips-Ouliaris test for whether the
series in the group are cointegrated or not. See Chapter 38. “Cointegration Testing,” on
page 1305 of User’s Guide II.
Granger Causality
Correlation does not necessarily imply causation in any meaningful sense of that word. The
econometric graveyard is full of magnificent correlations, which are simply spurious or
meaningless. Interesting examples include a positive correlation between teachers’ salaries
and the consumption of alcohol and a superb positive correlation between the death rate in
the UK and the proportion of marriages solemnized in the Church of England. Economists
debate correlations which are less obviously meaningless.
The Granger (1969) approach to the question of whether x causes y is to see how much of
the current y can be explained by past values of y and then to see whether adding lagged
values of x can improve the explanation. y is said to be Granger-caused by x if x helps in
the prediction of y , or equivalently if the coefficients on the lagged x ’s are statistically sig-
nificant. Note that two-way causation is frequently the case; x Granger causes y and y
Granger causes x .
It is important to note that the statement “ x Granger causes y ” does not imply that y is the
effect or the result of x . Granger causality measures precedence and information content
but does not by itself indicate causality in the more common use of the term.
When you select the Granger Causality view, you will first see
a dialog box asking for the number of lags to use in the test
regressions. In general, it is better to use more rather than fewer
lags, since the theory is couched in terms of the relevance of all
past information. You should pick a lag length, l , that corre-
sponds to reasonable beliefs about the longest time over which
one of the variables could help predict the other.
y t = a 0 + a 1 y t – 1 + º + a l y t – l + b 1 x t – 1 + º + b l x – l + et
(12.46)
x t = a 0 + a 1 x t – 1 + º + a l x t – l + b1 y t – 1 + º + b l y –l + u t
for all possible pairs of ( x, y ) series in the group. The reported F-statistics are the Wald sta-
tistics for the joint hypothesis:
b1 = b 2 = º = bl = 0 (12.47)
for each equation. The null hypothesis is that x does not Granger-cause y in the first
regression and that y does not Granger-cause x in the second regression.
We illustrate using data on consumption and GDP using the data in the workfile
“Chow_var.WF1”. The test results are given by:
For this example, we cannot reject the hypothesis that GDP does not Granger cause CS but
we do reject the hypothesis that CS does not Granger cause GDP. Therefore it appears that
Granger causality runs one-way from CS to GDP and not the other way.
If you want to run Granger causality tests with other exogenous variables (e.g. seasonal
dummy variables or linear trends) or if you want to carry out likelihood ratio (LR) tests, run
the test regressions directly using equation objects.
Label
This view displays the label information of the group. You can edit any of the field cells in
the label view, except the Last Update cell which shows the date/time the group was last
modified.
Name is the group object name as it appears in the workfile; you can rename your group by
editing this cell. If you fill in the Display Name cell, EViews will use this name in some of
the tables and graphs of the group view. Unlike object names, display names preserve case
(allow upper and lower case letters) and may contain spaces.
See Chapter 10. “EViews Databases,” on page 267 for a discussion of the label fields and
their use in database searches.
430—Chapter 12. Groups
Make Equation
The Make Equation... proc opens an Equation Specifica-
tion dialog box with the first series in the group listed as the
dependent variable and the remaining series as the regres-
sors, including a constant term “C”. You can modify the
specification as desired. See Chapter 18. “Basic Regression
Analysis,” on page 625 of User’s Guide II for details.
Make Factor
Make Factor… opens the factor analysis dialog with the correlation specification filled out
with the series in the group. See Chapter 39. “Factor Analysis,” on page 1325 of User’s
Guide II for details.
Make System
You may use the Make System… proc to make a system object. Simply select Make Sys-
tem... to open a system specification dialog. The dialog will be filled with the series in the
group as dependent variables, and has edit fields that allow you to list common and equa-
tion specific regressors, instruments, and dependent variable transformations, if desired.
Group Procedures Overview—431
Resample
Resample... performs resampling on all of the series in the group. A description of the
resampling procedure is provided in “Resample” on page 344.
Make Whitened
You may use the Make Whitened... procedure from a group (or series) to use the results
from a parametric VAR (or AR) model to filter the data. EViews offers whitening based on
either a fixed lag specification, or an information criterion based auto-selected lag.
You may use the Lag specification combo to choose between a Fixed, user-specified num-
ber of lags on the VAR, or you may choose automatic lag-selection by choosing Auto - AIC,
Auto - Schwarz, or Auto - Hannan-Quinn. In the Fixed case, EViews will prompt you for
the number of lags to use; in the automatic selection case, you will be prompted for the
maximum number of lags to use in selection. The default setting of “*” indicates use of an
1§3
observation based maximum lag of T as suggested by Den Haan and Levin (1997).
You may use the Include constant checkbox to indicate whether or not to include a con-
stant in the VAR, and you may specify Row weights in the corresponding edit field.
By default, EViews will save the results in series with the names given by those in the group
with “_W” appended to the end. Information on the whitening procedure will be included
432—Chapter 12. Groups
in the series label. If you would like to change the names, you can provide a list of series
names or an alternate wildcard expression in the Output series edit field.
Lastly, you can instruct EViews to save a matrix containing the estimated coefficients from
the VAR by entering a valid object name in the Output coef matrix edit field. The results
will be saved in a matrix where each column represents the coefficients for the correspond-
ing series in the group. The coefficients are ordered in the column by: constant (if present)
followed by the lag 1 coefficient for each of the series in the group, in order, followed by the
lag 2 coefficients, etc.
To illustrate the use of this tool, we use the data for industrial production (IP), money sup-
ply (M1), and the Treasury bill rate (TB3) in the workfile “Var1.WF1” used in Chapter 32.
“Vector Autoregression and Error Correction Models,” beginning on page 1079. First set the
sample to the entire workfile by entering the command
smpl @all
Next, create a group containing IP, M1, and TB3, name the group GROUP01, then click on
Proc/Make Whitened... to display the whitening dialog. Set the Lag specification combo to
Auto - AIC, and enter “ABC” in the Output coef matrix edit field. Click on OK.
EViews displays a new untitled group containing the three whitened series IP_W, M1_W
and TB3_W. In addition, the 22 ¥ 3 matrix object ABC contains the coefficients for the 7
lag VAR used to filter the data.
Note that the handling of lags differs slightly between the whitening procedure and VAR
estimation. The whitening procedure does not use lagged values prior to the beginning of
the computation sample, while the VAR estimator will use any available lags, even if they
precede the estimation sample. In this case, the results for the whitening procedure will
exactly match those of a VAR estimated for the sample from 1959M01 to 1995M04 since
References—433
there are no valid presample values, but this correspondence may not hold for samples
starting after the beginning of the workfile.
Simply select the desired graph type on the upper-left hand side of the dialog, set the rele-
vant options on the right, choose a base name for the output, and if necessary, specify how
to handle multiple sets of series in the group.
References
Aitchison, J. and Greenacre, M. J. (2002). Biplots of compositional data. Applied Statistics, 51, 375–392.
den Haan, Wouter J. and Andrew Levin (1997). “A Practitioner’s Guide to Robust Covariance Matrix Esti-
mation,” Chapter 12 in Maddala, G. S. and C. R. Rao (eds.), Handbook of Statistics Vol. 15, Robust
Inference, North-Holland: Amsterdam, 291-341.
Gabriel, K. R. (1971). The biplot-graphic display of matrices with application to principal component
analysis. Biometrika, 58, 453-467.
Granger, C. W. J. (1969). “Investigating Causal Relations by Econometric Models and Cross-Spectral
Methods,” Econometrica, 37, 424–438.
Hamilton, James D. (1994). Time Series Analysis, Princeton University Press.
Johnson, Richard A., and Dean W. Wichern (1992). Applied Multivariate Statistical Analysis, Third Edi-
tion, Upper Saddle River, New Jersey: Prentice-Hall, Inc.
Kendall, Maurice, and Jean Dickinson Gibbons (1990). Rank Correlation Methods, Fifth Edition, New
York: Oxford University Press.
Matthews, Robert (2000). “Storks Deliver Babies (p=0.008)”, Teaching Statistics, 22(2), 36–38.
434—Chapter 12. Groups
Sheskin, David J. (1997). Parametric and Nonparametric Statistical Procedures, Boca Raton: CRC Press.
Sokal, Robert R. and F. James Rohlf (1995). Biometry. New York: W. H. Freeman and Company.
Chapter 13. Graphing Data
Constructing graphs from data is an important part of the process of data analysis and
presentation. Results displayed in graphs are generally more concise and often more
illuminating; one may be able to detect patterns and relationships in data that are not
readily apparent from examining tables of summary statistics.
Accordingly, EViews provides an easy-to-use, full-featured set of tools for the graphical
display of information. With EViews, you can quickly and easily display graphs of
data, customize those graphs, and output the results so that they may be incorporated
into your presentations.
There are many aspects of the graphing of data in EViews. This chapter describes the
basics of graphing data in series and groups of series using the View/Graph... menu
item. (Most of the graphs in this chapter may also be generated from vectors and
matrices, but for brevity, we will speak mostly of series and groups).
We do not consider here the specialized series and group routines that produce graph-
ical output. For example, views of an equation produce graphs of the equation fore-
casts and residuals. Similarly, views of a model object that show graphs of simulation
results, and the views of a state space object that show estimated states or signals.
These graphs are described in the context of the specific views and procedures.
436—Chapter 13. Graphing Data
The remainder of this chapter is structured as follows. The first section offers a quick over-
view of the process of constructing a series or group graph view. The next two sections
describe the process of constructing graphs from series and groups in somewhat greater
depth. Next, we describe a handful of the most commonly performed graph view customiza-
tions. The final section provides detail on individual graph types.
Quick Start
All of the graph features described in this chapter may be accessed by selecting View/
Graph... from a series or graph (or vector or matrix) object menu, or by double clicking on
a series or group graph view.
For example, let us consider the example workfile “Housedebt.WF1”, which contains quar-
terly data on household debt and financial obligations from 1980 to 2006. The series DSR is
an estimate of the debt service ratio representing the ratio of the total of mortgage and con-
sumer debt payments to personal income.
Similarly you may display graphs for a group of series by opening the group, selecting
View/Graph... and choosing an appropriate type.
The group view will change to show histograms of the data in the two series. Note that by
default, the histograms are displayed in separate frames (we have rearranged the graphs
horizontally for presentation by right-clicking on the graph and selecting Position and align
graphs...; see “Working with Multiple Graphs” on page 583). Note also that each of the
frames has its own vertical and horizontal axis scale.
Displaying other graph views is generally just as easy. Most graphs can be displayed with a
few mouse clicks and a couple of keystrokes. In general, you can simply open the series or
group object, display the graph dialog, select the graph type, set a few options if necessary,
and click OK to produce acceptable results.
Graphing a Series
Up to this point we have examined graph views for series and groups constructed using
default settings. We now consider the process of displaying graph views of a single series in
a bit more depth.
Our discussion focuses on the selection of a graph type and setting of associated options.
We consider the general features of selecting a graph type for the series, not on the particu-
lars associated with each graph type. Details on the individual graph types are provided in
“Graph Types,” beginning on page 479.
To display the graph view of a single series, you should first select View/Graph... from the
series menu to display the Graph Options dialog.
440—Chapter 13. Graphing Data
The Graph Options dialog has multiple pages that specify various settings for the graph
view. The Basic type page depicted here is of central importance since it controls the graph
you wish to display. The other dialog pages, which control various display characteristics of
the graph, will be discussed below (“Basic Customization,” beginning on page 459).
Choosing a Type
On the left-hand side of the Basic type page, you will see the Graph type section where you
will specify the type of graph you wish to display.
First, the General combo box allows you to switch between display-
ing a Basic graph of the data in the series, and displaying a Cate-
gorical graph constructed using the data divided into categories
defined by factor variables. For now, we will stick to basic graphs;
we defer the discussion of categorical graphs until Chapter 14. “Cat-
egorical Graphs,” beginning on page 523.
Second, the Specific list box offers a list of the graph types that are
available for use. You may select a graph type by clicking on its
name. The default graph type is a Line & Symbol plot.
Graphing a Series—441
Similarly, if you select either Quantile - Quantile or Seasonal Graph as your specific type,
the dialog will change to provide you with additional options. For theoretical quantile-quan-
tile plots, you may use the Options button to specify a distribution or to add plots using dif-
ferent distributions. For seasonal graphs, there will be a combo box controlling whether to
panel or overlay the seasons in the graph.
Details
The right-hand side of the dialog offers various options that EViews collectively labels
Details. The options that are available will change with different choices for the Specific
graph type. We have, for example, already mentioned the sub-type settings that are avail-
able when you select Distribution, Quantile-Quantile, or Seasonal Graph. We now con-
sider the remaining settings.
Graph Data
The Graph Data combo specifies the data to be used in obser-
vation graphs. By default, EViews displays observation graphs
that use Raw data, meaning that every observation will be
plotted. The combo allows you to compute summary statistics
(Means, Medians, etc.) for your data prior to displaying an
observation graph. (Note: if we display an observation graph
type using summary statistics for the data, the graph is no
longer an observation graph since it no longer plots observa-
tions in the workfile. Such a graph is, strictly speaking, a sum-
mary graph that uses an observation graph type.)
442—Chapter 13. Graphing Data
Orientation
The Orientation combo allows you to choose whether to dis-
play observation graphs with the observations along the hori-
zontal or the vertical axis. By default, EViews displays the
graph with the observations along the horizontal axis (Normal - obs/time across bottom),
but you may elect to display them on the vertical axis (Rotated - obs/time down left axis).
Frequency
When plotting a line graph for a link series (see
Chapter 8. “Series Links,” beginning on
page 183), the graph dialog changes to offer you
the option of choosing to plot the data at the
native frequency (the frequency of the source
page), or at the frequency of the current workfile
page (the frequency of the destination page).
By default, EViews will plot the data at the native frequency of the series. To plot the fre-
quency converted data, you should select Plot links at workfile frequency.
Related discussion and examples may be found in “Mixed Frequency Graphs” on page 452.
Note that when plotting links, the Frequency combo replaces the Orientation combo. To
rotate the graph, you will need to manually assign the series to the bottom axes using the
Axes & Scaling/Data scaling page of the dialog (“Axis Assignment” on page 463).
Axis Borders
You may use the Axis borders combo to select a distribution
graph to display along the axes of your graphs. For example,
you may display a line graph with boxplots or kernel densities
along the data (vertical) axis. By default, no axis graphs are
displayed (None).
444—Chapter 13. Graphing Data
If there are missing values in your data, the Basic type page will change to offer you a
choice for how to handle the missing values. You may close the gaps in your graph by
checking the box labeled Connect adjacent non-missing observations or Connect adja-
cent.
In this latter setting, Connect adjacent may be used to connect observations across both the
seams and across missing values.
Graphing a Series—445
Panel Options
When plotting observation graphs in workfiles
with a panel data structure, the Basic type page
offers additional options for how to use the panel
structure. A Panel options section will be dis-
played containing a combo box that controls the
panel portion of the display.
By default, EViews uses the Stack cross sections options, which simply stacks the data for
each cross- section and plots the data without regard for panel structure. The resulting
graph is a observation plot of the entire workfile. For example, a line graph for the series F
in the Grunfeld-Baltagi data (“Grunfeld_Baltagi_Panel.WF1”), shows that there is consider-
able variation across cross-sections, with cross-section 3 in particular having high values:
446—Chapter 13. Graphing Data
Alternately, you may choose to display a line graph of the data for each cross-section in its
own frame (Individual cross sections), or in a single frame (Combined cross sections).
The combined panel graph for the example panel is given by:
EViews also allows you to plot means plus standard deviation bounds (Mean plus SD
bounds) or medians plus quantiles (Median plus quantiles) computed across cross-sec-
tions for every “period”. In the latter two cases, EViews will also prompt you for the num-
ber of SDs to use in computing the bounds, and the quantiles to compute, respectively.
The means plus/minus two standard deviations graph for the example data is given by:
Graphing a Series—447
Each observation in the time series for the mean represents the mean value of F taken
across all cross-sections in the given period. The standard deviation lines are the means plus
and minus two standard deviations, where the latter are computed analogously, across
cross-sections for the period.
For our example, we press the Add button again to add a Kernel Density graph to two exist-
ing elements.
As with the single series dialog, the Graph Options dialog has multiple pages that specify
various settings for the graph view. We again focus exclusively on the Basic type page. The
other pages, which control various display characteristics of the graph, are described below
(“Basic Customization,” beginning on page 459).
Choosing a Type
To select a graph type simply click on its name in the Specific type listbox. The options that
you will see on this page will depend on the selected graph type. Some of the options (Ori-
entation, Axis borders) have already been considered (see “Details,” on page 441), so we
focus here on the remaining settings. To aid in our discussion we divide entries in the list-
box into three classes:
• The first class consists of all of the graphs available in the series graph dialog (Line,
Bar, Spike, Distribution, etc.). For this class, EViews will produce a graph of the spec-
ified type for each series in the group. Options will control whether to display the
graphs in a single frame or in individual (multiple) frames.
• The second class of graphs use the multiple series to produce specialized observation
plots of series data (Area Band, Mixed with Lines, Error Bar, High-Low (Open-Close),
Pie).
• The final class produce pairwise plots of series data against other series data (Scatter,
XY Line, XY Area, XY Bar). Options will be used to control how to use the different
series in the group, and if relevant, whether to display the graph in a single or multi-
ple frames. Note that these graphs are observation plots in the sense that data for
450—Chapter 13. Graphing Data
each observation are displayed, but unlike other observation graphs we have seen
(e.g., line graphs), data are not plotted against workfile observation indicators.
Multiple Series
When you select any of the individual series graph
types in a group with more than one series, the
right-hand side of the dialog changes to reflect your
choice. In addition to the Graph data, Orientation,
and Axis borders settings considered previously
there will be a combo box, labeled Multiple series
which controls whether to display: the individual
series in a single frame (Single graph), the stacked
individual series in a single frame (Stack in single
graph), or the series in individual frames (Multiple graphs).
The final combo setting, Stack in single graph, allows you to plot data that are sums of the
series in the group. This method is available for most, but not all, individual graph types.
The first graph element will be the first series plotted in the usual way; the second element
will be the sum, for every observation, of the first series and the second. The third element
will contain the sum of the first three series, and so forth.
452—Chapter 13. Graphing Data
Graph Data
Earlier we saw that the Graph data
combo allows you to display sum-
mary statistic graphs (Means, Medi-
ans, etc.) for your data (“Graph
Data” on page 441). For graphs of a
single series, displaying summary
data may be of limited value since
the graph will show a single sum-
mary value. For multiple series, the
combo allows us to display graphs
that compare values of the statistics
for each of the series in the group.
allows you to display line graphs of data from both pages in a single graph, with each series
plotted at its native frequency.
The other series in the group are link series. (See Chapter 8. “Series Links,” beginning on
page 183 for a discussion of links). AAA, which is linked from the Monthly workfile page,
contains data on Moody's Seasoned Aaa Corporate Bond Yield. GDPCHG, which is linked
from the Quarterly workfile page, measures the (annualized) quarterly percent change in
GDP (in chained 2000 dollars). Both links convert the low frequency data to high using the
constant-match average frequency conversion method.
Note that since the two link series are tied to data
in other workfile pages, EViews has access to
both the native (monthly and quarterly) and the
converted (daily 5) frequencies for the AAA and
GDPCHG. Accordingly, the main graph dialog for
GROUP02, prompts you for whether you wish to
plot your links using the native frequency data, or
whether you wish to plot links using the workfile frequency (frequency converted) data.
Note that the GDPCHG line connects the four quarterly values of the series measured at its
native frequency. The four points are each centered on the corresponding range of daily-5
454—Chapter 13. Graphing Data
dates. Similarly, the 12 monthly values of AAA are connected using line segments, with the
individual points centered on the appropriate range of daily-5 values.
Specialized Graphs
The Area Band, Mixed with Lines, Error Bar, High-Low (Open-Close), and Pie graph types
use multiple series in the group to form a specialized graph. Each specific type has its own
set of options. For additional detail and discussion, see the description of the individual
graph type in “Observation Graphs,” beginning on page 480.
Pairwise Graphs
The final class of graphs use data for a given observation in pairs, plotting the data for one
series against data for another series (Scatter, XY Line, XY Area, XY Bar).
Scatterplot matrix
The Scatterplot matrix setting forms pairs using all possible pairwise combinations for
series in the group and constructs a plot using the pair. If there are k series in the group,
2
there will be a total of k plots, each in its own frame.
Graphing Multiple Series (Groups)—457
Note that the frames of the graphs in the scatterplot matrix are locked together so that the
individual graphs may not be repositioned within the multiple graph frame.
Note that the frames of the graphs in the lower triangular matrix are locked together so that
the individual graphs may not be repositioned within the multiple graph frame.
Fit Lines
EViews provides convenient tools for superimposing auxiliary graphs on top of your Scatter
or XY line plot, making it easy to put regression lines, kernel fits, and other types of auxil-
iary graphs on top of your XY plots.
When you select Scatter or XY Line from the Specific type listbox, the right-hand side of
the page changes to offer a Fit lines option, where you may add various types of fit lines to
the graph as outlined in “Auxiliary Graph Types,” beginning on page 512. You may also use
the Options button to add additional auxiliary graphs. To illustrate, we use the familiar “Old
Faithful Geyser” eruption time data considered by Simonoff (1996) and others (“Gey-
ser.WF1”), and add both a regression line and a nearest neighbor fit relating eruption time
intervals to previous eruption durations.
First, we open the group GROUP01 and select Scatter as our Specific type, then select
Regression Line in the Fit lines combo to add a linear regression line. Next, click on the
Options button to display the Scatterplot Customize page.
Basic Customization—459
You may elect to add additional elements by clicking on the Add button, or to remove an
element by selecting it in the listbox and clicking on the Remove button.
Basic Customization
EViews allows you to perform extensive customization of your graph views at creation time
or after the view is displayed. You may, for example, select your graph type, then click on
the other option groups to change the graph aspect ratio, the graph line colors and symbols,
and the fill colors, then click on OK to display the graph. Alternately, you may double-click
on an existing graph view to display the Graph Options dialog, change settings, then dis-
play the modified graph. And once a graph view is frozen, there are additional features for
adding text, lines, and shading.
You should be aware that some of the options that we describe are transitory and will be
lost if you change the graph type. For example, if you set the symbol colors in a scatterplot
and then change the graph to a line graph, the color changes will be lost. If you wish to
make permanent changes to your graph, you should freeze the modified graph view or
freeze the graph view and then make your change to the resulting graph object.
Frame
The Frame option group controls characteristics of the basic graph view window, including
the frame appearance, colors in the graph not related to data, and the position of the data
within the frame.
Color
The Color group allows you to choose both the color inside the
graph frame (Frame fill) and the background color for the entire
graph (Background). You may also apply a fade effect to the
frame color or background color using the corresponding combo
boxes.
The final two settings are related to the behavior of graphs when
they are printed or saved to file. The first option, Make back-
ground transparent for printing and file saving, should be
used to ignore the background color when printing or saving the
graph (typically, when printing to a black-and-white printer).
Unchecking the last option, Use grayscale-no color, changes the display of the graph to
grayscale, allowing you to see how your graph will look when output to a black-and-white
device.
Basic Customization—461
Frame Border
The Frame border group controls the drawing of the graph frame.
The Axes combo describes the basic frame type. The first entry in the
combo, Labeled Axes, instructs EViews to draw a frame line for each
axis that is used to display data in the graph. The last entry, none,
instructs EViews not to draw a frame. The remaining combo entries
are pictographs showing the positions of the frame lines. In this
example, we will display a box frame.
Frame Size
The Frame size group is used to control the aspect ratio of your
graph and the relative size of the text in the graph. (Note that
you can also change the aspect ratio of the graph by click-and-
dragging the bottom or right edges of the graph.)
Note that all text in graphs is sized in terms of absolute points (1/72 of a virtual inch), while
other elements in the graph are sized relative to the frame size. Thus, reducing the size of
the graph frame increases the relative size of text in the graph. Conversely, increasing the
size of the graph frame will reduce the relative size of the text.
This group is divided into sections based on the type of scale being modified. There are two
different scale types: data scales, and workfile (observation) scales. When series data are
assigned to a given axis, the axis is said to have a data scale, since the data for the series are
plotted using that axis. Alternately, if observation identifiers are plotted along an axis, we
say that the axis has a workfile or observation scale.
Basic Customization—463
Some observation graphs (Line graphs, Bar graphs, etc.) have both data and observation
scales, since we plot data against observation indicators from the workfile. Other observa-
tion graphs (Scatter, XY Line, etc.) have only data scales, since data for multiple series are
plotted against each other. Similarly, analytic graphs (Histogram, Empirical CDF, etc.) have
only data scales since the derived data are not plotted against observations in the workfile.
The first two sections in this group, Data scaling and Data axis labels, relate to settings for
the data scales. The third section, Obs/Date axis, sets options for the workfile (observation)
scales. The fourth section, Grid Lines, can be used to add or modify grid lines on any axis.
Data scaling
The Data scaling section allows you to arrange data among axes and set data scaling
parameters for each axis.
Axis Assignment
The right-hand side of the dialog contains a section labeled Series
axis assignment, which you may use to assign each series in the
graph to an axis. The listbox shows each data element along with
the current axis assignment. Here we see the assignment for a
scatterplot where the first series is assigned to the bottom axis
and the second series is assigned to the left axis.
Note that the rules of graph construction imply that there are restrictions on the assign-
ments that are permitted. For example, when plotting series or group data against workfile
identifiers (as in a line graph), you may assign your data series to any combination of the
the left and right axes, or any combination of the top and bottom axes, but you may not
assign data to both vertical and horizontal axes. Similarly, when plotting pairwise series
data, you may not assign all of your series to a single axis, nor may you assign data to all
four axes.
We have already seen one example of changing axis assignment. The Orientation combo on
the Type page is essentially a shorthand method of changing the axis assignments to display
the graph vertically or horizontally (see “Orientation,” on page 442).
Axis Scale
The Axis scaling method describes the method used in form-
ing the selected axis scale. By default, EViews displays a Lin-
ear scale, but you may instead choose: a linear scale that
always includes the origin (Linear – force zero), a logarith-
mic scale (Logarithmic scaling), or a linear scale using the
data standardized to have mean 0 and variance 1 (Normalized data). If you select the
Invert scale option, EViews will reverse the scale so that it ranges from high values to low.
You may use the Axis scale endpoints to control the range of data
employed by the scale. If you select User specified, you will be
prompted to enter a minimum and maximum value for the scale.
Note that if either of these are within the actual data range, the graph will be clipped.
Similar to the Edit axis combo box on the Data scaling page, you may use the combo box at
the top of the Data axis labels page to select an axis to edit.
Axis Labels
You may suppress all labels for the selected axis by checking the
Hide labels box.
If you do choose to display labels for the specified axis, you may use
the Label angle combo to rotate your labels. Note that the values in
the combo describe counterclockwise rotation of the labels, hence
selecting 45 in the combo box rotates the axis labels 45 degrees counter-clockwise while
selecting –30 rotates the labels 30 degrees clockwise.
Clicking on Axis Font brings up a font dialog allowing you to change the size and typeface
of your labels.
For example, suppose that we have data that are expressed as proportions (“0.153”). To dis-
play your axis as percentages (“15.3%”), you may select Percent: .01 as the Units, and add
“%” as the suffix.
468—Chapter 13. Graphing Data
For graphs which do not have a date axis, such as XY graphs, the Axis assignment combo
box in the top left-hand corner of the page will read Graph has no Obs/Date axis, and any
changes to the settings on this page will be irrelevant for the current graph type.
tings are not available for workfiles with low frequencies (e.g., Custom (Step = Quarter) is
not available in annual workfiles).
Alternately, you may decide that you always want your labels to
be formed using both the month and year of the observation. If
you select Month Year from the combo, EViews will display an
additional drop-down specifying how the month/year string is to
be formatted. For date formats that include a year, click the Use 4
digit year checkbox to update all formats in the drop-down to a 4 digit display.
If you would like complete control over the display of your date
strings, you should select Custom. The dialog will change to pro-
vide an edit field in which you should specify a date format using
a standard EViews date format specifications in the Format edit
field (see “Date Formats,” on page 85 of the Command and Pro-
gramming Reference).
Basic Customization—471
Observation scales without a date structure are always labeled using the Automatic setting.
Label start of period - tick on obs instructs EViews to place the label at the beginning of the
period, and the tick on the observation. If you select Center label on period - tick between
obs, EViews places the ticks between observations and centers the label over the period.
The last option, Center label on period - trim space at axis ends, is essentially the same as
the previous option, Center label on period - tick between obs, except that the empty
space on either end of the date axis will be removed. The beginning of the first period and
end of the last period will fall at the edges of the graph frame, taking into account any
indent set in the Size & Indents page in the Frame option group.
Depending on the frequency of your graph, date labeling can be made clearer if we include
a second row of labels. Checking the Allow two row date labels box allows EViews to uti-
lize a second row of labels where appropriate. For example, daily data can be labeled first
by month, with a second row of labels indicating the year.
472—Chapter 13. Graphing Data
Axis Labels
The Axis labels group on the Obs/Date axis page allows you to
modify label characteristics such as angle and font for the time axis.
These options are similar to those discussed above for data axis
labels. However, on the time axis, you can also customize the text
of the labels.
The top half of the group mimics the behavior of the controls found
in the Axis labels group on the Data axis labels page.
The bottom half of the group allows you to specify custom observa-
tion axis labels. See “Adding Custom Labels,” beginning on page 572 for further discussion.
Tick Marks
The combo box in the Tick marks section determines the place-
ment of tickmarks: you may choose between Ticks outside axis,
Ticks inside axis, Ticks outside & inside, and No ticks. The Allow
minor ticks checkbox determines whether smaller ticks are placed
between the major ticks.
Grid Lines
The final section of the Axes & Scaling group, Grid Lines, controls grid lines for all axes.
Basic Customization—473
Notice that the Bottom axis scale checkbox is disabled in the image to the right. This indi-
cates that the date scale for our current graph is assigned to the bottom axis, so the Obs &
Date axis grid lines group should be used to control grid lines for this axis.
Note that if an axis associated with a specified grid line is not in use, the corresponding grid
line option will be ignored.
The remaining Custom options in the combo box allow you to add grid lines at specified
intervals, based on the frequency of your workfile. After specifying a step length in the
combo, enter a value for the number of steps between grid lines in the Steps edit field.
Legend
The next main category in the graph options dialog is Legend. This section provides control
over the text, placement, and appearance of the legend.
Basic Customization—475
Legend Characteristics
You may elect to show or hide the legend and modify its appearance in the Characteristics
group.
The first checkbox, Display legend, provides the most important option: to show or hide
the legend. Click the checkbox to override EViews’ default setting. Note that for single series
graphs, the default is to hide the legend.
EViews attempts to display the legend entries in a visually appealing layout. To modify the
number of columns, change the Legend Columns combo box from the default Auto setting.
Select an integer between 1 and 5, and EViews will rearrange the legend entries with the
corresponding number of columns and rows.
By default, EViews draws a box around legends. You may elect not to enclose the legend in
a box by unchecking the Legend in Box checkbox. If a box is to be drawn, you may select
the Box fill color and a box Frame color using the two color selectors.
Legend Placement
The legend may be positioned anywhere on the graph using the options
presented in the Placement section. EViews provides a few common posi-
tions in the drop-down menu: Bottom Center, Bottom Left, Bottom Right,
Left, Right, in addition to the User option. All locations are relative to the
graph frame.
If User is selected, edit fields for the X and Y location are enabled. Note that the origin (0, 0)
is the top left corner of the graph frame, and the coordinates are in units of virtual inches.
476—Chapter 13. Graphing Data
Individual graphs are always 4 x 3 virtual inches (scatter diagrams are 3 x 3 virtual inches)
or a user-specified size, regardless if their current display size. It is often much easier to
position the legend by dragging it to the desired location on the graph and not being con-
cerned with its coordinates.
Note that if you place the legend using the User option, the relative position of the legend
may change if you change the graph frame size. This does not include changing its size on
the screen, but may occur if its size in virtual inches is changed via the Size & Indents sec-
tion of the Frame options.
Legend Font
Click the Legend Font button to open the Font dialog and modify the text font and color.
Legend Text
To modify text shown in the legend,
use the Edit legend entries section of
the Legend page. Simply click on the
text you wish to edit in the second col-
umn of the listbox, and alter the legend
text in the edit field.
The Line/Symbol use combo determines the combination of lines and symbols used to dis-
play the selected element. You should change the Line/Symbol use combo to Line & Sym-
bol to display both lines and symbols, or Symbol only to suppress the lines. The
corresponding Color, Line pattern, Line width, Symbol, and Symbol size combos control
the characteristics of the selected element. Note that the settings will sometimes have no
Basic Customization—477
effect on the graph (e.g., symbol choice if you are only displaying lines; line pattern if you
are only displaying solid lines).
For the most part, the settings are self-explanatory; simply change the sym-
bol and line use, size, and color of a graph element and the preview region
will change to reflect your choices. Click on Apply or OK to apply your
selections.
There are two Symbol choices that deserve explicit mention. The last two
entries in the combo specify that the symbol should be the observation
label from the workfile (the first entry uses the observation label itself; the
second choice also includes a small circle with an attached text label). In
some cases, these labels will be the dates, in other cases they will be inte-
ger values (1, 2, 3, ...), and in others, they will be text labels corresponding
to the observations in the workfile. You may use this setting to display identifiers for each
point in the observation graph.
Once you have selected observation labels from the Symbol combo, you can modify their
font attributes by clicking on the Font button in the Observation Label section on the left-
hand side of the dialog. This button brings up a Font dialog, where you can set the font
style, font size, and color of the observation labels.
on a black-and-white printer. You may instead select Solid always or Pattern always so
that the pattern of lines in the two types of devices always match.
The effect of different choices for this setting are shown in the Attributes section of the dia-
log, which shows what your graph elements will look when output to both types of devices.
Our line graph example above uses the Pattern always setting so that the second and third
lines are dashed when displayed on both color and black-and-white devices (for related pre-
view tools, see “Color & Border” on page 460).
At times, you may notice that the data line in your line graph does not look
perfectly smooth. To allow EViews to use a smoothing algorithm when
drawing the line, make sure anti-aliasing is enabled. In the Anti-aliasing
groupbox, selecting Auto will allow EViews to use anti-aliasing when it determines that
doing so will make a visible difference. This choice is dependent primarily on the number of
data points. To force anti-aliasing on or off when drawing lines, select On or Off, respec-
tively.
If you wish to perform curve fitting on your data, you may use the Interpo-
lation options at the bottom of the page. Select from Linear interpolation
or a cardinal spline of varying degrees: Mild, Medium, or Full.
Fill Areas
You may use the Fill Areas section under the Graph Elements group to specify a fill color,
gray shade (black-and-white representation of the fill color), or to add hatching to the fill
region. The fill colors are used in graphs involving bars, areas, and area bands.
Graph Types—479
In the Brush edit section, simply click on one of the entries on the right to select the fill
whose characteristics you wish to change (there are two in this example and the first is
selected), then use the combo boxes to alter the color, gray shade, and hatching as desired.
Note that the Color settings are used for fills that are displayed on a color device; the Gray
shade combo controls the fill display when displayed on black-and-white devices. The pre-
view and selection area on the right shows the characteristics of the fill element in both set-
tings (for related preview tools, see “Color & Border” on page 460).
The Bar graphs section allows you to add value labels to bars, in addition to shading and a
3D appearance. These options are described in “Bar” on page 481.
You may choose to outline or not outline the fill regions for various fill types using the Out-
line fill areas in checkboxes. Here we see that Bars and Areas will be outlined but Area
Bands will not.
Clicking Label pies in the Pie graphs group adds or removes observation labels from each
pie in a pie graph.
Graph Types
The following is a description of the basic EViews graph types. We divide these graph types
into three classes: observation graphs that display the values of the data for each observa-
480—Chapter 13. Graphing Data
tion; analytical graphs that first summarize the data, then display a graphical view of the
summary results; auxiliary graphs, which are not conventional graph types, per se, but
which summarize the raw data and display the results along with an observation graph of
the original data.
The discussion for each type is limited to a basic overview of each graph type and does not
discuss many of the ways in which the graphs may be customized (e.g., adding histograms
to the axes of line graphs or scatterplots;), nor does it describe the many ways in which the
graphs are displayed when using multiple series or categorizations (e.g., stacking; see “Basic
Customization,” beginning on page 459).
Observation Graphs
Observation graphs display the values of the data for each observation in the series or
group. Some observation graphs are used for displaying the data in a single series (Line &
Symbol, Area, Bar, Spike, Dot Plot, Seasonal Graphs), while others combine data from mul-
tiple series into a graph (Area Band, Mixed with Lines, Error Bar, High-Low(-Open-Close),
Scatter, XY Line, XY Bar, XY Area, Pie).
You may display your graph symbols alone, or using lines and symbols by clicking the
Lines & Symbols section in the Graph Elements option group, and changing the desired
Graph Types—481
attributes (“Lines and Symbols” on page 476). There are other settings for controlling color,
line pattern, line width, symbol type, and symbol size that you may modify.
Area
Area graphs are observation graphs
of a single series in which the data
for each observation in the series is
plotted against the workfile indica-
tors. Successive observations are
connected by a line, with the area
between the origin and the line filled
in.
Our illustration depicts the area graph of the deviations of the 3-month Treasury bill series
TB03MTH (“Treasury2005c.WF1”) around the mean. Note that positive and negative
regions use the same fill color, and that we have connected adjacent non-missing observa-
tions by checking the box labeled Connect adjacent non-missing observations.
Bar
The bar graph uses a bar to repre-
sent the value of each observation
in a single series.
Bar graphs are effective for displaying information for relatively small numbers of observa-
tions; for large numbers of observations, bar graphs are indistinguishable from area graphs
since there is no space between the bars for successive observations.
You may add numeric value labels to your bars by double clicking
on the bar to display the graph dialog, selecting the Bar-Area-Pie
section in the Graph Elements option group, and select either Label
above bar, or Label in bar in the Bar graphs section of the dialog
page. EViews will add a label showing the height of the bar, pro-
vided that there is enough space to display the label.
You may use the drop-down menu to apply fade effects to your bars.
By default, EViews displays the Solid color bars, but you may
instead choose to display 3D rounded bars, Fade: dark at zero,
Fade: light at zero. The latter two entries fade the bars from light to dark, with the fade fin-
ishing at the zero axis. Note that at press time, fades are not supported when exporting
graphs to PostScript.
Moreover, while we discourage you from doing so, you may also use the Fill Areas page to
remove the spacing and/or the outlines from the bars.
Area Band
The area band graph is used to dis-
play the band formed by pairs of
series, filling in the area between
the two. While they may be used in
a number of settings, band graphs
are most often used to display fore-
cast bands or error bands around
forecasts.
EViews will construct bands from successive pairs of series in the group. If there is an odd
number of series in the group, the final series will, by default, be plotted as a line.
Our example of the area band graph uses data from the Federal Reserve Bank of Philadel-
phia’s Survey of Professional Forecasters (“Forecast_unemp.WF1”). UNEMP_MAX and
UNEMP_MIN contain the high and low one-quarter ahead forecasts of the unemployment
rate for each period in the workfile; UNEMP_MEAN contains the mean values over the indi-
vidual forecasts. To construct this graph, we create a group GROUP01 containing (in order),
the series UNEMP_MAX, UNEMP_MIN, and UNEMP_MEAN. Note that reversing the order
of the first two series does not change the appearance of the graph.
484—Chapter 13. Graphing Data
Spike
The spike plot uses a bar to repre-
sent the value of each observation
in a single series. Spike plots are
essentially bar plots with very thin
bars. They are useful for displaying
data with moderate numbers of
observations; settings where a bar
graph is indistinguishable from an
area graph.
Our illustration shows a spike graph for the annual total newspaper advertising expenditure
data in the series TOTAL in “Newspapers.WF1”. It may be directly compared with the bar
graph depiction of the same data (see “Bar” on page 481).
Note that for large numbers of observations, the spike graph is also indistinguishable from
an area graph.
Our illustration uses data from our newspaper advertising example (“Newspapers.WF1”).
The data in GROUP01 are displayed as a Mixed with Lines graph, with the First series
combo on the right-side of the dialog set to Bar.
Dot Plot
The dot plot is a symbol only version of the line and symbol graph (“Line & Symbol” on
page 480) that uses circles to represent the value of each observation. It is equivalent to the
Line & Symbol plot with the lines replaced by circles, and with a small amount of indenting
to approve appearance.
Dot plots are sometimes rotated so that the observations are on the vertical axis, often with
horizontal gridlines. EViews provides easy to use tools for performing these and other mod-
ifications to improve the appearance of this graph (“Orientation,” on page 442 and “Grid
Lines,” on page 472).
486—Chapter 13. Graphing Data
Error Bar
The error bar graph is an observa-
tion graph designed for displaying
data with standard error bands. As
with the related area band graph,
error bars are most often used to
display forecast intervals or error
bands.
You may display an error bar graph for any group object containing two or more series; the
error bar will use data for, at most, the first three series. To display an error bar graph,
View/Graph... from the group menu, and then choose Error Bar in the Specific listbox.
Our illustration shows an error graph for the forecasting data in the group GROUP01 in
“Forecast_unemp.WF1”. It may be directly compared with the area band graph of the same
data (“Area Band” on page 483).
High-Low (Open-Close)
The High-Low (Open-Close) is an
observation graph type commonly
used to display daily financial data.
As the name suggests, this chart is
commonly used to plot the daily
high, low, opening and closing val-
ues of asset prices.
You may display a high-low graph for any group object containing two or more series. To
display an high-low graph, View/Graph... from the group menu, and then choose High-
Low (Open-Close) in the Specific listbox. Data for up to four series will be used in forming
the graph.
We illustrate this graph type using daily stock price data for Hewlett-Packard (ticker HPQ)
for the month of August, 2006 (“HPQ.WF1”). We display the graph for data in the group
GROUP01 containing the series HIGH, LOW, OPEN, and CLOSE.
Scatter
A scatterplot is an observation graph
of two series in which the values of
the second series are plotted against
the values of the first series using
symbols. Scatterplots allow you to
examine visually the relationship
between the two variables.
We focus on the variables NOX, representing the average annual average nitrogen oxide
concentration in parts per hundred million, and MV, representing the log of the median
value of owner occupied houses (MV). We form the group SCATTER containing NOX and
MV, with NOX the first series in the group since we wish to plot it on the horizontal axis.
The scatter shows some evidence of a negative relationship between air pollution and house
values.
Note that EViews provides tools for placing a variety of common graphs on top of your scat-
ter (see “Auxiliary Graph Types,” beginning on page 512).
488—Chapter 13. Graphing Data
XY Line
An XY line graph is an
observation graph of two
series in which the values
of the second series are
plotted against the values
of the first series, with
successive points con-
nected by a line.
As with the scatterplot, EViews provides tools for placing a variety of common graphs on
top of your XY line graph (see “Auxiliary Graph Types,” beginning on page 512).
Our illustration uses data on unemployment rates and inflation for the U.S. from 1996
through 2000. Following the discussion in Stock and Watson (2007), we plot the change in
the inflation rate against the previous period’s unemployment rate; to make it easier to see
the ordering of the observations, we have turned on observation labeling (“Lines and Sym-
bols” on page 476).
Graph Types—489
XY Area
The XY area graph is an observation
graph of two series in which the val-
ues of the second series are plotted
against the values of the first series.
In contrast with the scatterplot, suc-
cessive points are connected by a
line, and the region between the line
and the zero horizontal axis is filled.
Alternately, one may view the XY
area graph as a filled XY line graph
(see“XY Line”).
We may customize the graph by changing display characteristics using the Lines & Sym-
bols and Fill Areas dialogs under the Graph Elements dialog group.
Our illustration of the XY area graph uses data on U.S. unemployment as discussed in “XY
Line,” on page 488. Note that the example graph is not particularly informative as XY area
graphs are generally employed when the values of the data in the X series are monotonically
increasing. For example, XY area graphs are the underlying graph type that EViews uses to
display filled distribution graphs.
Our illustration uses the XY bar graph to create a variable width histogram for the 3-month
Treasury security data from“Treasury2005c.WF1”. We first use Proc/Generate by Classifi-
cation... to divide the series into categories defined by the intervals [2.25, 2.5), [2.5, 3), [3,
3.9), [3.9, 4.5). The classified series is given by TB03MTH_CT. The frequency view of this
series is given by:
Tabulation of TB03MTH_CT
Date: 10/05/06 Time: 12:54
Sample: 1/03/2005 12/30/2005
Included observations: 250
Number of categories: 4
Cumulative Cumulative
Value Count Percent Count Percent
[2.25, 2.5) 22 8.80 22 8.80
[2.5, 3) 86 34.40 108 43.20
[3, 3.9) 97 38.80 205 82.00
[3.9, 4.5) 45 18.00 250 100.00
Total 250 100.00 250 100.00
Next, we use the data in this table to create a matrix. We want to use a matrix instead of a
series in the workfile since we want each row to correspond to a bin in the classification.
Accordingly, we create a 4 ¥ 3 matrix VARWIDTH where the first column contains the low
limit points, the second column contains the high limit points, and the last column contains
the number of observations that fall into the interval.
To display the XY bar graph shown in the example illustration, select View/Graph... from
the matrix main menu, and then choose XY Bar (X-X-Y triplets) in the Specific listbox.
Graph Types—491
Pie
This graph is an observation graph
where each observation is pictured
as a pie chart, with the wedges of
the pie representing the series value
as a percentage of the group total. (If
a series has a negative or missing
value, the series value will be
dropped from the calculation for
that observation.)
You may choose to label each pie with an observation number. To change the setting from
the default value, select the Bar-Area-Pie dialog from the Graph Elements group, and select
or unselect the Label pies option in the Pie graphs section of the page.
Our illustration uses the newspaper advertising revenue data (“Newspapers.WF1”). The
three series in GROUP01, CLASSIFIED, RETAIL, and NATIONAL, are the three components
of TOTAL advertising revenue. Each pie in the graph shows the relative proportions; retail is
the dominant component, but its share has been falling relative to classified.
Seasonal Graphs
Seasonal graphs are a special form of line graph in which you plot separate line graphs for
each season in a regular frequency monthly or quarterly workfile.
To display a seasonal graph for a single series or for each series in a group, select View/
Graph... from the series or group menu, and then choose Seasonal Graph in the Specific
listbox. Note that if your workfile does not follow a monthly or quarterly regular frequency,
Seasonal Graph will not appear as a specific graph type.
file, the graph will be divided into 12 panels, the first containing a time series of observa-
tions for January, the second containing a time series for February, etc. The second option,
Multiple overlayed lines, overlays the time series for each season in a single graph, using a
common date axis.
To see the effects of these choices, we consider two examples of seasonal graphs. The
EViews workfile “Starts_cust.WF1” contains Census Bureau data on monthly new residen-
tial construction in the U.S. (not seasonally adjusted) from January 1959 through August
2006. We will consider the series TOTAL containing data on the total of new privately
owned housing starts (in thousands) for the subsample from January 1990 through August
2006.
The following is a brief summary of the characteristics of each of these graph types. Unless
otherwise specified, the examples use data on three month CD rate data for 69 Long Island
banks and thrifts (“CDrate.WF1”). These data are used as an example in Simonoff (1996).
Histogram
The histogram graph view displays
the distribution of your series in bar
graph form. The histogram divides
the horizontal axis into equal length
intervals or bins, and displays a
count or fraction of the number of
observations that fall into each bin,
or an estimate of the probability den-
sity function for the bin.
(Note that specialized tools also allow you to place histograms along the axes of various
graph types.)
When you select Histogram, EViews displays an Options button that opens the Distribu-
tion Plot Customize dialog. This dialog allows you to customize your histogram estimate or
to add additional distribution graphs. You may, for example, add a fitted theoretical distri-
bution plot or kernel density to the histogram.
494—Chapter 13. Graphing Data
First, the Scaling combo box lets you choose between showing the count of the number of
observations in a bin (Frequency), an estimate of the density in the bin (Density), and the
fraction of observations in each bin (Relative frequency). The density estimates are com-
puted by scaling the relative frequency by the bin width so that the area in the bin is equal
to the fraction of observations.
Next, Bin Width and Anchor specify the construction of the bin intervals. By default,
EViews tries to create bins that are defined on “nice” numbers (whole numbers and simple
fractions). These estimates do not have any particular statistical justification.
Simple data based methods for determining bin size have been proposed
by a number of authors (Scott 1979, 1985a; Silverman 1986; Freedman-
Diaconis 1981). The supported methods all choose a bin width h that
minimizes the integrated mean square error of the approximation
–1 § 3
(IMSE) using the formula, h = aĵN :
• Normal (Sigma): a = 3.49 , ĵ = s
• Normal (IQR): a = 3.49 , ĵ = IQR § 1.34
• Silverman: a = 3.49 , ĵ = min ( s, IQR § 1.34 )
• Freedman-Diaconis: a = 2.0 , ĵ = IQR
where s is the sample standard deviation, IQR is the interquartile range, and N is the
number of observations.
Graph Types—495
The Right-closed bin intervals checkbox controls how observations that equal a bin end-
point are handled. If you select this option, observations equal to the right-endpoint of a bin
will be classified as being in the bin, while observations equal to the left-endpoint will be
placed in the previous bin.
By default, EViews provides the minimum legend information sufficient to identify the
graph elements. In some instances, this means that no legend is provided; in other cases,
the legends may be rather terse. The Legend labels combo box allows you to override this
setting; you may elect to display a short legend (Short), to display detailed information
(Detailed), or to suppress all legend information (None).
496—Chapter 13. Graphing Data
Histogram Polygon
Scott (1985a) shows that the histo-
gram polygon (frequency polygon),
which is constructed by connecting
the mid-bin values of a histogram
with straight lines, is superior to the
histogram for estimating the
unknown probability density func-
tion.
We use the default settings to display the frequency polygon for the three-month CD rate
data. The EViews defaults, which were designed to generate easy to interpret histogram
intervals, undersmooth the data.
You may control the computation of the histogram polygon by clicking on the Options but-
ton, and filling out the resulting dialog. In addition to all of the options described in “Histo-
gram” on page 493, you may instruct EViews to display the fill the area under the polygon
by clicking on the Fill area checkbox.
Note that the data based methods for determining bin size differ from those for the fre-
quency polygon. The bandwidth is chosen as in the frequency polygon with a = 2.15 for
the Normal (Sigma), Normal (IQR), and Normal (Silverman) methods, and a = 1.23 for
Freedman-Diaconis. The constant factor in the Freedman-Diaconis is a crude adjustment
that takes the histogram value for a and scales it by the ratio of the normal scaling factors
for the frequency polygon and the histogram ( 2.15 § 3.49 ).
Graph Types—497
The default edge frequency graph for the CD rate data is displayed here. The EViews
defaults, which were designed to generate easy to interpret histogram intervals, appear to
undersmooth the data.
You may control the computation of the histogram polygon by clicking on the Options but-
ton, and filling out the resulting dialog. All of the options are described in “Histogram Poly-
gon” on page 496.
Note that the data based methods for determining bin size generate different bin widths
than those for the frequency polygon. The bandwidth is chosen as in the histogram and fre-
quency polygon with a = 1.50 for the Normal (Sigma), Normal (IQR), and Normal (Sil-
verman) methods, and a = 0.86 for Freedman-Diaconis.
498—Chapter 13. Graphing Data
To compute an ASH, select View/Graph... from the series or group menu, then select Dis-
tribution from the Specific listbox. Then choose Average Shifted Histogram from the Dis-
tribution drop-down to the right.
The default ASH for the Long Island CD rate data is displayed above. The EViews defaults,
which were designed to generate easy to interpret histogram intervals, undersmooth the
data.
The only new setting is the edit box for the Number of shift evaluations. This setting con-
trols the number of histograms over which we average. By default, EViews will compute 25
shifted histograms.
Kernel Density
The kernel density graph displays a kernel density estimate of the distribution of a single
series. Heuristically, the kernel density estimator is an adjusted histogram in which the
“boxes’ the histogram are replaced by “bumps” that are smooth (Silverman, 1986). Smooth-
ing is done by putting less weight on observations that are further from the point being eval-
uated. Specifically, the kernel density estimate of a series X at a point x is estimated by:
N
1 x – Xi
f ( x ) = -------
Nh  K ÊË --------------
h ¯
-ˆ , (13.1)
i =1
where N is the number of observations, h is the bandwidth (or smoothing parameter) and
K is a kernel weighting function that integrates to one.
To compute and display a kernel
density estimate for a single series
or for each series in a group, select
View/Graph... from the series or
group menu, then choose Distribu-
tion in the Specific listbox. The
right-hand side of the dialog page
will change to provide a Distribu-
tion combo box prompting you to
choose a distribution graph. You
should select Kernel Density.
The default kernel density estimate for the CD rate data (see “Histogram” on page 493) is
depicted above.
500—Chapter 13. Graphing Data
Adding additional graph elements may be done using the Add button in the Added Ele-
ments section of the dialog.
The Specification section of the dialog allows you to specify your kernel function and band-
width selection:
• Kernel. The kernel function is a weighting function that determines the shape of the
bumps. EViews provides the following options for the kernel function K :
Epanechnikov (default) 3 2
--- ( 1 – u )I ( u £ 1 )
4
Triangular (1 – u )(I( u £ 1))
Uniform (Rectangular) 1
--- ( I ( u £ 1 ) )
2
Normal (Gaussian) 1 1 2
----------- exp Ê – --- u ˆ
2p Ë 2 ¯
Biweight (Quartic) 15 2 2
------ ( 1 – u ) I ( u £ 1 )
16
Triweight 35 2 3
------ ( 1 – u ) I ( u £ 1 )
32
Cosinus
--- cos Ê ---uˆ I ( u £ 1 )
p p
4 Ë2 ¯
Graph Types—501
where u is the argument of the kernel function and I is the indicator function that
takes a value of one if its argument is true, and zero otherwise.
• Bandwidth. The bandwidth h controls the smoothness of the density estimate; the
larger the bandwidth, the smoother the estimate. Bandwidth selection is of crucial
importance in density estimation (Silverman, 1986), and various methods have been
suggested in the literature. The Silverman option (default) uses a data-based auto-
matic bandwidth:
–1 § 5
h = 0.9kN min ( s, ( IQR ) § 1.34 ) (13.2)
where N is the number of observations, s is the standard deviation, and IQR is the
interquartile range of the series (Silverman 1986, equation 3.31). The factor k is a
canonical bandwidth-transformation that differs across kernel functions (Marron and
Nolan 1989; Härdle 1991). The canonical bandwidth-transformation adjusts the band-
width so that the automatic density estimates have roughly the same amount of
smoothness across various kernel functions.
To specify a bandwidth of your choice, click on the User Specified option and type a
nonnegative number for the bandwidth in the corresponding edit box. Although there
is no general rule for the appropriate choice of the bandwidth, Silverman (1986, sec-
tion 3.4) makes a case for undersmoothing by choosing a somewhat small bandwidth,
since it is easier for the eye to smooth than it is to unsmooth.
The Bracket Bandwidth option allows you to investigate the sensitivity of your esti-
mates to variations in the bandwidth. If you choose to bracket the bandwidth, EViews
plots three density estimates using bandwidths 0.5h , h , and 1.5h .
The remaining options control the method used to compute the kernel estimates, the legend
settings, and whether or not to fill the area under the estimate:
• Number of Points. You must specify the number of points M at which you will eval-
uate the density function. The default is M = 100 points. Suppose the minimum
and maximum value to be considered are given by X L and X U , respectively. Then
f ( x ) is evaluated at M equi-spaced points given by:
X U – X Lˆ
x i = X L + i ⋅ ÊË --------------------- , for i = 0, 1, ºM – 1 . (13.3)
M ¯
EViews selects the lower and upper evaluation points by extending the minimum and
maximum values of the data by two (for the normal kernel) or one (for all other ker-
nels) bandwidth units.
• Method. By default, EViews utilizes the Linear Binning approximation algorithm of
Fan and Marron (1994) to limit the number of evaluations required in computing the
density estimates. For large samples, the computational savings are substantial.
502—Chapter 13. Graphing Data
The Exact option evaluates the density function using all of the data points for each
X j , j = 1, 2 , º, N for each x i . The number of kernel evaluations is therefore of
order O ( NM ) , which, for large samples, may be quite time-consuming.
Unless there is a strong reason to compute the exact density estimate or unless your
sample is very small, we recommend that you use the binning algorithm.
• Legend labels. This combo box controls the information placed in the legend for the
graph. By default, EViews uses a minimalist approach to legend labeling; information
sufficient to identify the estimate is provided. In some cases, as with the kernel den-
sity of a single series, this implies that no legend is provided. You may elect instead to
always display a short legend (Short), to display detailed kernel choice and band-
width information (Full), or you may elect to suppress all legend information (None).
• Fill area. Select this option if you wish to draw the kernel density as a filled line
graph.
Theoretical Distribution
You may plot the density function of
a theoretical distribution by selecting
View/Graph... from the series or
group menu, and choosing Distribu-
tion in the Specific listbox. The
right-hand side of the dialog page
will change to provide a Distribu-
tion combo box prompting you to
choose a distribution graph. You
should select Theoretical Distribu-
tion.
You can specify the values of any known parameters in the edit field or fields. If you leave
any field blank, EViews will estimate the corresponding parameter using the data contained
in the series.
The Estimation Options provides control over iterative estimation, if relevant. You should
not need to use these settings unless the graph indicates failure in the estimation process.
504—Chapter 13. Graphing Data
Most of the options are self-explanatory. If you select User-specified starting values,
EViews will take the starting values from the C coefficient vector.
Empirical CDF
The empirical CDF graph displays a
plot of the empirical cumulative dis-
tribution function (CDF) of the
series. The CDF is the probability of
observing a value from the series
not exceeding a specified value r :
F x ( r ) = Pr ( x £ r )
By default, EViews displays the empirical CDF for the data in the series along with approxi-
mate 95% confidence intervals. The confidence intervals are based on the Wilson interval
methodology (Wilson, 1927; Brown, Cai and Dasgupta, 2001).
Rankit (default) (r – 1 § 2) § N
Ordinary r§N
Van der Waerden r § ( N + 1)
Blom (r – 3 § 8) § (N + 1 § 4 )
Tukey (r – 1 § 3) § (N + 1 § 3 )
Gumbel (r – 1) § (N – 1)
Graph Types—505
See Cleveland (1994) and Hyndman and Fan (1996). By default, EViews uses the Rankit
method, but you may use the combo to select a different method.
Empirical Survivor
The empirical survivor graph of a
series displays an estimate of the
probability of observing a value at
least as large as some specified
value r :
S x ( r ) = Pr ( x > r ) = 1 – F x ( r )
See “Empirical CDF” on page 504 for additional discussion and a description of the dialog
brought up by the Options button.
See “Empirical Survivor” on page 505 for additional discussion and a description of the dia-
log brought up by the Options button.
Empirical Quantile
This graph type plots the empirical
quantiles of the series against the
associated probabilities. The quan-
tile is the inverse function of the
CDF; graphically, the quantile can
be obtained by flipping the horizon-
tal and vertical axis of the CDF.
To display the empirical quantile plot, select View/Graph... from the series or group menu,
choose Distribution in the Specific listbox, and Empirical Quantile in the Distribution
combo.
By default, EViews displays the empirical quantiles along with approximate 95% confidence
intervals obtained by inverting the Wilson confidence intervals for the CDF (Wilson, 1927;
Brown, Cai and Dasgupta, 2001).
See “Empirical Survivor” on page 505 for a description of the dialog brought up by clicking
the Options button.
Graph Types—507
Quantile-Quantile (Theoretical)
Theoretical quantile-quantile plots
are used to assess whether the data
in a single series follow a specified
theoretical distribution; e.g. whether
the data are normally distributed
(Cleveland, 1994; Chambers, et al.
1983). If the two distributions are
the same, the QQ-plot should lie on
a straight line. If the QQ-plot does
not lie on a straight line, the two dis-
tributions differ along some dimen-
sion. The pattern of deviation from
linearity provides an indication of
the nature of the mismatch.
To display the theoretical quantile-quantile plot, select View/Graph... from the series or
group menu, choose Quantile - Quantile in the Specific listbox, and select Theoretical in
the Q-Q graph combo to the right.
By default, EViews displays the QQ-plot comparing the quantiles of the data with the quan-
tiles of a fitted normal distribution.
In addition, the customize page offers you several methods for computing the empirical
quantiles. The options are explained in the section “Empirical CDF” on page 504; the choice
should not make much difference unless the sample is very small.
Lastly, the Display fit line checkbox provides you with the option of plotting a regression
line through the quantile values.
Quantile-Quantile (Symmetry)
An alternative form of the quantile-
quantile (QQ)-plot examines the
symmetry of the data directly by
comparing each quantile value with
the corresponding upper-tail quantile
value. You may think of this proce-
dure as plotting the distance to
points above the median against the
distance to the corresponding point
below the median (Cleveland, et al.
1983, p. 17). The resulting QQ-sym-
metry plot has the property that the
more symmetric are the data, the
closer are the points to the 45 degree
line.
To display the quantile-quantile symmetry plot, select View/Graph... from the series or
group menu, choose Quantile - Quantile in the Specific listbox, and select Symmetry in the
Q-Q graph combo to the right.
Our example uses the workfile “CDrate.WF1”, for which we have plotted the symmetry of
the series CDRATE. The default QQ-symmetry plot shows that the data is highly asymmet-
ric.
Quantile-Quantile (Empirical)
The empirical quantile-quantile
(QQ)-plot plots the quantiles of one
series against the quantiles of a sec-
ond series (Cleveland, 1994; Cham-
bers, et al. 1983). If the distributions
of the two series are the same, the
QQ-plot should lie on a straight line.
Our illustration uses the example workfile “Housedebt.WF1”, containing quarterly data on
household debt and financial obligations from 1980 to 2006. We show here the default QQ-
plot for the debt service ratio series DSR against the financial obligation ratio series
FOR_TOTAL.
Note that unlike other distribution graphs, EViews does not allow you to add additional QQ-
plots for a given pair of series; rarely will the choice of Quantile Method generate enough of
a difference to make such a plot useful.
Boxplot
A boxplot, also known as a box and whisker diagram, summarizes the distribution of a set
of data by displaying the centering and spread of the data using a few primary elements
(McGill, Tukey, and Larsen, 1978).
510—Chapter 13. Graphing Data
The box portion of a boxplot represents the first and third Far outlier
quartiles (middle 50 percent of the data). These two quar- Outer fence
tiles are collectively termed the hinges, and the difference
Near outliers
between them represents the interquartile range, or IQR.
The median is depicted using a line through the center of Inner fence
the box, while the mean is drawn using a symbol. Staple
Whisker
The inner fences are defined as the first quartile minus
1.5*IQR and the third quartile plus 1.5*IQR. The inner Third quartile
fences are typically not drawn in boxplots, but graphic ele- Mean
Median
ments known as whiskers and staples show the values that
First quartile
are outside the first and third quartiles, but within the
inner fences. The staple is a line drawn at the last data
point within (or equal to) each of the inner fences. Whis-
kers are lines drawn from each hinge to the corresponding staple.
Data points outside the inner fence are known as outliers. To further characterize outliers,
we define the outer fences as the first quartile minus 3.0*IQR and the third quartile plus
3.0*IQR. As with inner fences, outer fences are not typically drawn in boxplots. Data
between the inner and outer fences are termed near outliers, and those outside the outer
fence are referred to as far outliers. A data point lying on an outer fence is considered a near
outlier.
Boxplots are often drawn so that the widths of the boxes are uniform. Alternatively, the box
widths can be varied as a measure of the sample size for each box, with widths drawn pro-
portional to N , or proportional to the square root of N .
Graph Types—511
In addition to the Orientation option on the main page which allows you to rotate your box-
plots, you may specify a number of display options in the BoxPlots dialog under the Graph
Elements group.
The left-hand
side of the
BoxPlot dia-
log allows
you to show
or hide spe-
cific elements
of the box-
plot, to con-
trol the box
widths, and to
modify the
appearance of
the notching
and shading.
In the right-
hand portion
of the dialog, you may customize individual elements of your graph. Simply select an ele-
ment to customize in the Element listbox or click on the depiction of a boxplot element in
the Preview window, and then modify the Color, Line pattern, Line/Symbol width, and
Symbol type as desired. Note that each boxplot element is represented by either a line or a
symbol; the dialog will show the appropriate choice for the element that you have selected.
512—Chapter 13. Graphing Data
The Preview window will change to display the current settings for your graph. You may
also click on elements within the Preview window to select them in the Element listbox, if
you find this easier. To revert to the original graph settings, click on Undo Page Edits.
The following is a brief summary of the characteristics of each of these graph types. For
illustration purposes, the examples generally use the familiar “Old Faithful Geyser” eruption
time data considered by Simonoff (1996) and many others (“Geyser.WF1”). These data pro-
vide information on 222 eruption time intervals and previous eruption durations for the Old
Faithful Geyser in Yellowstone National Park.
Regression Line
This graph uses data from two
series, displaying the fit of a bivari-
ate regression of the second series y
on the first series x , and a constant.
If desired, you may automatically
perform various transformations of
your data prior to performing the
regression.
resents the duration of the previous eruption, and the second series, INTERVAL, measures
the interval between eruptions.
In our illustration, the regression line is drawn on top of the scatterplot of points for the gey-
ser data. Clearly there is a positive relationship between length of eruption and the time
until the next eruption.
None y x
Logarithmic log ( y ) log ( x )
Inverse 1§y 1§x
Power a b
y x
Box-Cox a b
(y – 1) § a (x – 1) § b
Polynomial — 2 b
1, x, x , º, x
where you specify the parameters a and b in the edit field. Note that the Box-Cox transfor-
mation with parameter zero is the same as the log transformation.
• If any of the transformed values are not available, EViews returns an error message.
For example, if you take logs of negative values, non-integer powers of nonpositive
values, or inverses of zeros, EViews will stop processing and issue an error message.
514—Chapter 13. Graphing Data
• If you specify a high-order polynomial, EViews may be forced to drop some of the
high order terms to avoid collinearity.
Next, you may instruct EViews to perform robustness iterations (Cleveland, 1993). The least
squares method is very sensitive to the presence of even a few outlying observations. The
Robustness Iterations option carries out a form of weighted least squares where outlying
observations are given relatively less weight in estimating the coefficients of the regression.
For any given transformation of the series, the Robustness Iteration option carries out
robust fitting with bisquare weights. Robust fitting estimates the parameters a , b to mini-
mize the weighted sum of squared residuals,
N
2
 ri ( yi – a – xi b ) (13.4)
i= 1
where yi and x i are the transformed series and the bisquare robustness weights r are
given by:
Ï
Ô 2 2 2
r = Ì ( 1 – e i § ( 36m ) ) for e i § 6m < 1 (13.5)
Ô 0 otherwise
Ó
where e i = y i – a – x i b is the residual from the previous iteration (the first iteration
weights are determined by the OLS residuals), and m is the median of e i . Observations
with large residuals (outliers) are given small weights when forming the weighted sum of
squared residuals.
To choose the number robustness iterations, click on the check box for Robustness Itera-
tions and specify an integer for the number of iterations.
Lastly there is an option controlling the amount of information provided in legends. The
EViews default displays a minimum of legend information; this default may be overridden
using the Legend labels combo box. In particular, if you wish to see the coefficients of your
fitted line you should select Full. (Note that coefficient information is not available for some
transformations).
Graph Types—515
Kernel Fit
Using data from two series, this ker-
nel fit displays the local polynomial
kernel regression fit of the second
series y on the first series x . Exten-
sive discussion may be found in
Simonoff (1996), Hardle (1991), Fan
and Gijbels (1996).
Local polynomial kernel regressions fit Y at each value x , by choosing the parameters b to
minimize the weighted sum-of-squared residuals:
N
x–X
) K ÊË ---------------iˆ¯
k 2
m(x) = Â ( Y i – b 0 – b 1 ( x – X i ) + – º –b k ( x – X i ) h
(13.6)
i =1
where N is the number of observations, h is the bandwidth (or smoothing parameter), and
K is a kernel function that integrates to one. Note that the minimizing estimates of b will
differ for each x .
The default settings compute the local linear fit using the Epanechnikov kernel and an arbi-
trary, rule of thumb bandwidth rule. For efficient purposes, the kernel fit is evaluated using
the linear binning method proposed by Fan and Marron (1994).
Our example shows the default kernel fit line drawn on top of the geyser scatterplot data. As
with the regression line there is a positive relationship between the length of eruption and
the time until the next eruption. There does appear to be some flattening of the slope of the
relationship for long durations, suggesting that there may be a different model for short and
long duration times.
516—Chapter 13. Graphing Data
Regression
Here, you will specify the order of the polynomial k to fit at each data
point. The Nadaraya-Watson option sets k = 0 and locally fits a con-
stant at each x . Local Linear sets k = 1 at each x . For higher order
polynomials, mark the Local Polynomial option and type in an integer in the field box to
specify the order of the polynomial.
Kernel
The kernel is the function used to weight the observations in each local
regression. Definitions are provided in the discussion of “Kernel Den-
sity,” beginning on page 499.
Bandwidth
The bandwidth h determines the weights to be applied to observations in each local regres-
sion. The larger the h , the smoother the fit. By default, EViews arbitrarily sets the band-
width to:
h = 0.15 ( X U – X L ) (13.7)
To specify your own bandwidth, mark User Specified and enter a nonnegative number for
the bandwidth in the edit box.
Graph Types—517
The Bracket Bandwidth option fits three kernel regressions using bandwidths 0.5h , h ,
and 1.5h .
For nearest neighbor (variable) bandwidths, see “Nearest Neighbor Fit,” on page 517.
Method
Given a number of evaluation points, EViews provides you with two additional computa-
tional options: exact computation and linear binning.
The Linear Binning method (Fan and Marron, 1994) approximates the kernel regression by
binning the raw data X j fractionally to the two nearest evaluation points, prior to evaluat-
ing the kernel estimate. For large data sets, the computational savings may be substantial,
with virtually no loss of precision.
The Exact method performs a regression at each x i , using all of the data points ( X j, Y j ) ,
for j = 1, 2, º, N . Since the exact method computes a regression at every grid point, it
may be quite time consuming when applied to large samples. In these settings, you may
wish to consider the linear binning method.
This class of regressions includes the popular Loess (also known as Lowess) techniques
described by Cleveland (1993, 1994). Additional discussion of these techniques may be
found in Fan and Gijbels (1996), and in Chambers, Cleveland, Kleiner, Tukey (1983).
The default settings estimate a local linear regression using a bandwidth of 30% of the sam-
ple. The estimates use Tricube weighting, and Cleveland subsampling of the data.
Our illustration shows results that are broadly similar to the results for the kernel fit. There
is a positive relationship between the length of eruption and the time until the next erup-
tion, with evidence of flattening of the slope of the relationship for long durations.
Specification
For each point in the sample selected by the Evaluation Method option, we compute the fit-
ted value by running a local regression using data around that point. The Specification
option determines the rules employed in identifying the observations to be included in each
local regression, and the functional form used for the regression.
Polynomial degree specifies the degree of polynomial to fit in each local regression.
Bandwidth span determines which observations should be included in the local regres-
sions. You should specify a number a between 0 and 1. The span controls the smoothness
of the local fit; a larger fraction a gives a smoother fit. The fraction a instructs EViews to
include the aN observations nearest to the given point, where aN is 100a % of the
total sample size, truncated to an integer.
If you mark the Bracket bandwidth span option, EViews displays three nearest neighbor
fits with spans of 0.5a , a , and 1.5a .
Graph Types—519
Note that this standard definition of nearest neighbors implies that the number of points
need not be symmetric around the point being evaluated. If desired, you can force symme-
try by selecting the Symmetric neighbors option. Symmetric Neighbors forces the local
regression to include the same number of observations to the left and to the right of the
point being evaluated. This approach violates the definition, but arguably not the spirit, of
nearest neighbor regression. Differences between the two approaches will show up where
the data are thin (there are relatively few observations in the region).
Weighting
Local Weighting (Tricube) weights the observations of each local regression. The weighted
regression minimizes the weighted sum of squared residuals:
N
2 k
 wi ( yi – a – xi b1 – xi b2 – º – xi bk ) . (13.9)
i =1
ÏÊ di 3 3
ˆ di
Ô Ë 1 – -----------------------
- ¯ - <1
for -----------------------
wi = Ì d ( aN ) d ( aN ) (13.10)
Ô
Ó 0 otherwise
Note that LOESS/LOWESS is a special case of nearest neighbor fit, with a polynomial of
degree 1, and local tricube weighting. The default EViews options are set to produce LOW-
ESS fits.
Options
You should choose between computing the local regression at each data point in the sam-
ple, or using a subsample of data points.
• Exact (full sample) fits a local regression at every data point in the sample.
520—Chapter 13. Graphing Data
• Cleveland subsampling performs the local regression at only a subset of points. You
should provide the size of the subsample M in the edit box.
The number of points at which the local regressions are computed is approximately
equal to M . The actual number of points will depend on the distribution of the
explanatory variable.
Since the exact method computes a regression at every data point in the sample, it may be
quite time consuming when applied to large samples. For samples with over 100 observa-
tions, you may wish to consider subsampling.
The idea behind subsampling is that the local regression computed at two adjacent points
should differ by only a small amount. Cleveland subsampling provides an adaptive algo-
rithm for skipping nearby points in such a way that the subsample includes all of the repre-
sentative values of the regressor.
It is worth emphasizing that at each point in the subsample, EViews uses the entire sample
in determining the neighborhood of points. Thus, each regression in the Cleveland subsam-
ple corresponds to an equivalent regression in the exact computation. For large data sets,
the computational savings are substantial, with very little loss of information.
Orthogonal Regression
The orthogonal regression fit dis-
plays the line that minimizes the
orthogonal (perpendicular) dis-
tances from the y data to the fit
line. This graph may be contrasted
with the regression fit (“Regression
Line,” beginning on page 512)
which displays the line that mini-
mizes the sum of squared vertical
distances from the data to the corre-
sponding fitted y values on the
regression line.
Confidence Ellipse
The confidence ellipse for a pair of
series displays the confidence region
around the means (Johnson and
Wichern 1992, p. 189).
Lastly, you may use the Legend labels combo box to change the amount of information pro-
vided. If you select Full, EViews will always display both the probability associated with
each ellipse as well as the distribution used to compute values.
522—Chapter 13. Graphing Data
References
Brown, Lawrence D., T. Tony Cai, and Anirban DasGupta (2001). “Interval Estimation for a Binomial Pro-
portion,” Statistical Science, 16(2), 101-117.
Chambers, John M., William S. Cleveland, Beat Kleiner, and Paul A. Tukey (1983). Graphical Methods for
Data Analysis, Murray Hill, NJ: Wadsworth & Brooks/Cole Publishing Company.
Cleveland, William S. (1993). Visualizing Data, Summit, NJ: Hobart Press.
Cleveland, William S. (1994). The Elements of Graphing Data, Summit, NJ: Hobart Press.
Conover, W. J. (1980). Practical Nonparametric Statistics, 2nd edition, New York: John Wiley & Sons.
Fan, J. and I. Gijbels (1996). Local Polynomial Modelling and its Applications, London: Chapman & Hall.
Fan, J. and J. S. Marron (1994). “Fast Implementations of Nonparametric Curve Estimators,” Journal of
Computational and Graphical Statistics, 3, 35–56.
Freedman, David and Persi Diaconis (1981). “On the Histogram as a Density Estimator: L 2 Theory,”
Zeitschrift für Wahrscheinlichkeitstheorie und verwandte Gebiete,” 57, 453-476.
Hyndman, R. J. and Fan, Y. (1996). “Sample Quantiles in Statistical Packages,” American Statistician,
50(4), 361–365.
Härdle, Wolfgang (1991). Smoothing Techniques with Implementation in S, New York: Springer Verlag.
Johnson, R. A., and D. W. Wichern (1992). Applied Multivariate Statistical Analysis, Third Edition, Upper
Saddle River, New Jersey: Prentice-Hall, Inc.
Jones, M. C., M. Samiuddin, A. H. Al-Harbey, and T. A. H. Maatouk (1998). “The Edge Frequency Poly-
gon,” Biometrika, 85(1), 235-239.
Marron, J. S. and D. Nolan (1989). “Canonical Kernels for Density Estimation,” Statistics and Probability
Letters, 7, 191–195.
McGill, R., J.W. Tukey, and W. Larsen (1978). “Variations of Boxplots,” The American Statistician, 32(1),
12-16.
Scott, David W. (1979). “On Optimal and Data-Based Histograms,” Biometrika, 66(3), 605-610.
Scott, David W. (1985a). “Frequency Polygons: Theory and Application,” Journal of the American Statisti-
cal Association, 80(390), 348-354.
Scott, David W. (1985b). “Average Shifted Histograms: Effective Nonparametric Density Estimators in
Several Dimensions,” The Annals of Statistics, 13(3), 1024-1040.
Silverman, B. W. (1986). Density Estimation for Statistics and Data Analysis, London: Chapman & Hall.
Simonoff, Jeffrey S. (1996). Smoothing Methods in Statistics, New York: Springer-Verlag.
Simonoff, Jeffrey S. and Frederic Udina (1997). “Measuring the Stability of Histogram Appearance When
the Anchor Position is Changed,” Computational Statistics & Data Analysis, 23, 335-353.
Stock, James H. and Mark W. Watson (2007). Introduction to Econometrics, Boston: Pearson Education,
Inc.
Wilson, Edwin B. (1972). “Probably Inference, the Law of Succession, and Statistical Inference,” Journal
of the American Statistical Association, 22(158), 209-212.
Chapter 14. Categorical Graphs
Suppose that you have a sample of individuals in the United States, with information on
employment, earnings, and various demographic variables. Among other things, you may
wish to:
• Display a bar plot comparing the mean incomes of individuals living in each state.
• Produce a scatterplot of wages and hours worked, where the subset of males is drawn
using one plotting symbol, and the subset of females uses a different symbol.
• Show wage–education profiles for both male and female workers.
• Draw histograms and boxplots of wages for union and non-union workers in different
industries.
These graphs are all examples of categorical graphs. Categorical graphs are observation or
analytical graphs formed using subsets of the data, where the subsets are defined using the
values of one or more categorical conditioning variables (which we refer to as factors). In
the examples above, state of residence, gender, years of education, and union status are fac-
tors that are used to form subsets of the data, which we then use to construct the graph.
Constructing these graphs by hand can be a difficult and time consuming-process. Fortu-
nately, EViews provides powerful tools for constructing categorical graphs directly from
your data. With these tools, you may quickly and easily define your categorization, specify
the graph you wish to construct, and describe the basic graph layout; additional options
provide detailed control over layout and labeling of the graph, if necessary.
The remainder of this chapter describes the construction of categorical graphs of data from a
series or group object using the View/Graph... menu item.
Illustrative Examples
Starting from the premise that the most useful method of documenting categorical graphs is
to work through examples, we begin by describing the construction of a few representative
cases. We divide these examples into two broad categories: graphs which display categori-
cal summaries of the data, and graphs which display the raw data with category identifying
information.
Since there is considerable detail in many of the example graphs, we have saved the graphs
and then imported them directly into the manual, rather than using the usual screen capture
approach.
524—Chapter 14. Categorical Graphs
Category Summaries
Perhaps the most common form of categorical graph involves the display of summary infor-
mation computed for subsets of observations. For this type of categorical graph, we plot
summaries based on the classification, not the original data.
We consider three examples of summary graphs: the first example involves simple plots of
descriptive statistics computed for each group; the second example produces line plots from
categorical descriptive statistics; the third example constructs analytical graphs for each fac-
tor level (category).
Descriptive Statistics
The simplest categorical graph compares values for descriptive statistics for observations in
each category.
For our first set of examples, we employ the workfile “Gulfcoast.WF1” which contains
demographic information for counties located in the Gulf Coast region of the United States.
The workfile consists of 234 observations; 117 counties measured at two different periods
(July 2005 and January 2006). The latter measurement is from a special assessment taken
by the Census Bureau to measure the impact of hurricanes Rita and Katrina on population in
the region.
The series POP contains data on the population in each county (in thousands). The series
YEAR identifies the period associated with each observation, while STATE_NAME and
COUNTY_NAME are categorical series that identify the observation at the state and county
level, respectively.
We begin by con-
structing a summary
graph comparing
total population in
the two periods.
There are three
parts to specifying
this graph.
group. Select Categorical graph from the General dropdown and Bar from the Specific type
in the middle of the dialog to identify the main graph type.
Next, select Sums in the Graph data combo on the right-hand side of the dialog. This setting
instructs EViews to plot the sum of POP computed for each subset of the data.
6
00
00
of POP categorized using both YEAR and STATE_NAME. Double
=2
=2
AR
AR
click on the graph window to display the dialog, edit the Within
YE
YE
graph edit field to read “YEAR STATE_NAME”, and click on OK
to display the updated graph.
i
s
s
a
a
a
ipp
na
ipp
xa
xa
am
am
n
ia
sia
i ss
i ss
Te
Te
uis
ab
ab
ui
i ss
ss
Al
Al
Lo
Lo
Mi
M
tion to the rule, see “Line Graphs” on page 528). Since YEAR is the first factor in the list, it
varies more slowly, i.e., the values for STATE_NAME are grouped within a given year.
6
00
00
00
00
00
00
00
00
tions. Not surprisingly, we see that
=2
=2
=2
=2
=2
=2
=2
=2
AR
AR
AR
AR
AR
AR
AR
AR
YE
YE
YE
YE
YE
YE
YE
YE
the bulk of the population decrease
Alabama Louisiana Mississippi Texas
occurs in Louisiana, and to a lesser
extent Mississippi. Texas experi-
ences population growth over the period, in part due to relocations from neighboring states.
Up to this point we have displayed our categorical graphs within a single graph frame. To
display graphs for each category in a separate frame, you should enter the factor name in
the Across graphs edit field. For example, to display a graph comparing state population
across years with each state in its own frame, we enter YEAR in the Within graphs and
STATE_NAME in the Across graphs edit fields. Click on OK to display the graph. (We have
rearranged the graph so that all four frames appear on a single line by right-clicking on the
graph and selecting Position and align graphs...; see “Working with Multiple Graphs” on
page 583.)
Illustrative Examples—527
0 0 0 0
5
6
00
00
00
00
00
00
00
00
=2
=2
=2
=2
=2
=2
=2
=2
AR
AR
AR
AR
AR
AR
AR
AR
YE
YE
YE
YE
YE
YE
YE
YE
Note that by default, the multiple graph frames employ common vertical axes scales. This
feature facilitates comparison of the series sums across states in different frames.
The Categorical
options dialog per-
mits control of set-
tings for category
definitions and labels, as well as axis scaling. We will have much more to say about the cat-
egory and label settings later (“Factor Display Settings,” on page 543). For now, we focus on
the Axis scales section.
You will use the Selected factor list box to select the factor whose properties you wish to
modify. In this case, we want each state to have its own scale, so we click on
STATE_NAME, and select Individual axes scales. Click on OK to accept the changes and
display the modified graph.
528—Chapter 14. Categorical Graphs
1,880
855.85 3,300
5,960
1,870
855.80 3,200
1,860 5,920
855.75 3,100
1,850
5,880
855.70 3,000
1,840
6
00
00
00
00
00
00
00
00
=2
=2
=2
=2
=2
2
R=
R=
R=
R
R
A
A
YE
YE
YE
YE
YE
YE
YE
YE
Each graph frame now has its own axis scale, making it easier to see the year-to-year
changes, but more difficult to compare the changes across states. While the common scaling
made it difficult to determine whether Alabama experienced an increase or decrease in pop-
ulation, the individually scaled graphs clearly show a small reduction in population in that
state over the two years.
Line Graphs
One special case of categorical summary plots involves examining line graphs constructed
from the summary statistics. While there is a general correspondence to the graphs
described in “Category Summaries” on page 524, there are some important differences in
the specification of these graphs which require some discussion.
We illustrate these techniques using data from the Panel Study of Income Dynamics (Corn-
well and Rupert 1988), as discussed by Baltagi (2001). The data (provided in “Wages.WF1”)
consist of wage and demographic information for 595 individuals taken over 7 years from
1976–1982. For our purposes, we focus on three binary factors: FEM, a (0, 1) indicator for
whether the individual is male (FEM=0) or female (FEM=1), UNION, a (0, 1) indicator for
whether the wage is set by union contract, and EXPER, a measure of the number of years of
full-time work experience.
Suppose, for example that we wish to examine the earnings-experience profiles for all of the
individuals in our sample. Our approach will be to compute the average earnings at each
experience level and then to display a line graph connecting the mean values. Note that a
key feature of EXPER is that is numeric (cardinal), so that it does make sense to draw a line
between summary values computed at different experience levels.
Illustrative Examples—529
E X PE R =1
E X PE R =3
E X PE R =5
E X PE R =7
E X PE R =9
E X P ER =1 1
E X P ER =1 3
E X P ER =1 5
E X P ER =1 7
E X P ER =1 9
E X P ER =2 1
E X P ER =2 3
E X P ER =2 5
E X P ER =2 7
E X P ER =2 9
E X P ER =3 1
E X P ER =3 3
E X P ER =3 5
E X P ER =3 7
E X P ER =3 9
E X P ER =4 1
E X P ER =4 3
E X P ER =4 5
E X P ER =4 7
E X P ER =4 9
E X P ER =5 1
Lastly enter “EXPER” in the Within
graph edit field and click on OK to
accept the settings. EViews will dis-
play the average earnings-experi-
ence profile computed across all of the observations in the workfile as depicted. The profile
is generated by computing the mean of LWAGE for each level of the factor variable EXPER
and plotting the category means against the category values using a line graph. Note that
there is a dropoff in the profile at around 30 years of experience.
Double-click on the
graph to open the
Graph Options dia-
log, then select Cat-
egorical options
under the Graph Type group on the left-hand side.
530—Chapter 14. Categorical Graphs
Since we want to change the labeling of the categories defined by levels of experience, we
select EXPER in the Selected factor listbox. The settings of interest are in the section
labeled Category labels.
The factor labels in the graph are shorter and slightly easier to read now that they omit the
factor name and use only the factor value.
Next, suppose that we wish to compute separate profiles for males and females and to place
them in different graph frames. Simply double-click on the graph to display the Graph
Options dialog, and enter “FEM” in the Across graphs edit field. Click on OK, and EViews
will display the two wage-experience profiles in separate graph frames. (Note that we have
again rearranged the graphs so that they are next to each other by right-clicking on the
graph and selecting Position and align graphs.... We will rearrange many of the following
graph examples in this manner.)
Illustrative Examples—531
6.5 6.5
6.0 6.0
5.5 5.5
5.0 5.0
5 10 15 20 25 30 35 40 45 50 5 10 15 20 25 30 35 40 45 50
The shapes of the two graphs suggests that the bulk of the dropoff in the overall profile
comes from the steep decline in the profile for women at 30 years of experience. (Note that
the factor label and interval settings were retained when we added the FEM factor.)
In this case, however, the first series, EXPER, appears to vary more rapidly than the second
series, FEM (the variation in EXPER for a given level of FEM using a line), despite preceding
it in the list of within series. The apparent reversal of ordering arises from the combined
effect of two simple rules: (1) the slowest varying factor is placed along the observation
532—Chapter 14. Categorical Graphs
axis, and (2) line graphs connect data along the observation axis. Since we want to draw
lines connecting levels of EXPER along the observation axis, it is entered first in the list.
We describe various implications of the rules for specifying factors in greater depth in
“Specifying Factors,” on page 540. For now, it is probably sufficient to note that the speci-
fied ordering is probably the most natural way of describing the problem since we would
probably refer to this graph as displaying the “wage-experience profile, conditional on gen-
der.”
Analytical Graphs
You may display categorical graphs where, in place of computing simple descriptive statis-
tics such as the mean or sum, we construct an analytic graph (Distribution, Quantile-Quan-
tile, Boxplots) for each subset of observations.
We begin our example with a simple categorical histogram of the log-wage series from the
PSID data described above (“Line Graphs” on page 528). Consider first a simple example
showing a histogram of LWAGE with FEM as an across factor. The procedure is straightfor-
ward: select Categorical graph and Distribution for the Graph type from the middle of the
dialog, select Histogram for the Distribution type, and place FEM in the across list. Click on
OK and EViews will display the two histograms in individual graph frames.
LWAGE by FEM
FEM=0 FEM=1
500 500
400 400
300 300
Fre q u e n c y
Fre q u e n c y
200 200
100 100
0 0
4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0
If desired, you may change the multiple graph axis scaling to allow for individual scales as
described in “Descriptive Statistics,” beginning on page 524.
Next, we consider slightly more complicated examples involving multiple series and multi-
ple factors. We begin by displaying kernel density plots of two series, LWAGE and EXPER,
using FEM as a within factor and UNION as an across factor. First, create a group containing
LWAGE and EXPER, then select View/Graph... from the group menu to display the graph
dialog. From this point, constructing our example graph is a four step process:
Illustrative Examples—533
The last setting, which is displayed only when graphing multiple series, may appear to be a
bit obscure, but the basic idea is really quite simple.
Since @SERIES is a factor, we may choose to have it vary within or across graphs. If it var-
ies within graphs, data for both LWAGE and EXPER will be displayed in a single frame; if it
varies across graphs, data for the two series will be displayed in different graph frames.
(The choice between plotting the multiple series data in a single graph or in multiple graphs
may sound familiar since it corresponds to the Multiple series option for basic graphs; see
“Multiple Series” on page 450.)
The Treat multiple series combo box allows us to insert the implicit @SERIES factor at the
beginning or the end of the list of within or across factors. By default, EViews treats
@SERIES as the First across factor (most slowly varying across factor), but you may move
it to the end of the across list or the beginning or end of the within list.
534—Chapter 14. Categorical Graphs
1.25 1.25
1.00 1.00
D ens it y
D ens it y
0.75 0.75
0.50 0.50
0.25 0.25
0.00 0.00
4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0
.05 .05
.04 .04
D ens ity
D ens ity
.03 .03
.02 .02
.01 .01
.00 .00
-10 0 10 20 30 40 50 60 -10 0 10 20 30 40 50 60
FEM=0 FEM=1
The current example specifies @SERIES as the first, and UNION as the second across factor.
Since @SERIES varies more slowly, values of UNION will be grouped within @SERIES. We
see the effect of this grouping since the first two frames are for data where
“@SERIES=LWAGE” paired with “UNION=0” and “UNION=1”, respectively, followed by
“@SERIES=EXPER” for the two union values.
Illustrative Examples—535
=0
1
N=
N=
N=
N
eight boxplots in a single graph
O
IO
O
NI
NI
NI
N
,U
,U
,U
,U
frame. The implicit factor
=0
=0
=1
=1
M
M
FE
FE
FE
FE
@SERIES has been placed at the
end of the within list so that it
varies fastest. We see that
LWAGE and EXPER are displayed for each level of FEM and UNION, that the levels of
UNION vary within each level of the first factor FEM.
Identifying Categories
The second major type of categorical graph displays the raw data along with category iden-
tifying information.
We consider four representative examples of these graphs: a scatterplot, a spike plot, a line
plot, and a dot plot. The first two examples, which involve multiple observations in each
category, use the Raw Data setting for the Graph data combo; the last example, where
there is a single observation in each category, uses the special Unique values – error if not
identical setting.
Raw Data
We consider here two categorical graphs that employ the Raw Data setting in the Graph
data combo. As you might expect given the name of the setting, these graphs all display the
underlying (raw) data in the series.
One commonly employed raw data categorical graph is a scatterplot where observations in
each category are displayed with a different symbol. Our first two examples use data in the
536—Chapter 14. Categorical Graphs
workfile “Mpg.WF1” on EPA reported miles-per-gallon and engine size (displacement) for a
subset of 2006 model year automobiles.
CITY_MPG
the sample is displayed 40
NUMB_CYL=4
using category specific col- NUMB_CYL=6
NUMB_CYL=8 30
ors and symbols. Not sur-
prisingly, we see that 20
between DISPLACEMENT
and CITY_MPG for cars as the number of cylinders increases, though the two high MPG out-
liers may be unduly influential in that comparison.
We may compare this categorical graph to one in which we treat NUMB_CYL as an across
factor:
60 60 60
CITY_MPG
CITY_MPG
CITY_MPG
40 40 40
20 20 20
0 0 0
1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7
Here, each set of raw data points is displayed in its own graph frame, using common axis
scaling. The points all use the same color and symbol since the graph frame titles are suffi-
cient to identify the group displayed in the frame.
RENDEZVOUS FWD
S430 4MATIC
SIENNA 2WD
XTERRA 2WD
AZERA
CANYON 4WD
JAGUAR X-TYPE
MPV
TT ROADSTER QUATTRO
300C AWD
CHARGER
COLORADO CREW CAB 2WD
DAKOTA PICKUP 4WD
PACIFICA 2WD
STS AWD
IS 250
R350
E55 AMG (WAGON)
525I
9-5 SPORTCOMBI
The visual comparison of residuals for cars with different numbers of cylinders may be facil-
itated by treating NUMB_CYL as an across factor:
MPG_RESID by NUMB_CYL
N UMB_C Y L=4 N U MB_CY L=6 N UMB_C Y L=8
40 40 40
30 30 30
20 20 20
10 10 10
0 0 0
CO UP E C A M B IO CO RS A /G T/G -S P O RT
K IA S P O RTA G E 2W D(K M )
E 3 50 4 M A TIC (W A G O N)
CL K 50 0 (CA B RIO LE T)
E 5 5 A M G (W A G O N)
C A RR E R A 4 CA B RIO LE T
9-5 S P O R TCO M B I
3 30X I
550 I
G S 3 00 /G S 43 0
C O B A LT
S 4 A V A NT
C A NY O N CRE W CA B 2 W D
LE G A C Y W A G O N A W D
M A R IN E R H Y B R ID 4 W D
O U TL A ND E R 2 W D
S A N TA FE 2W D
K 15 00 S IE R RA 4 W D
P A TH FIND E R 4W D
RA N G E R P ICK UP 4 W D
R X 4 00 H 4W D
TR A ILB LA ZE R 2 W D
X TE R RA 2W D
E 1 50 E C O N O LINE 2 W D
E X P E DITIO N 2 W D
K 1 500 Y UK O N X L 4 W D
S W IFT+
G6
C2 30
G 35
M3
M L3 50
A8
J A G UA R X J 8L
LS 4 30
M L5 00
R5 00
S L5 00
A E RIO S X
C O RO L L A
N E W B E E TL E
S E B RING CO NV E RTIB L E
C RO S S FIRE CO UP E
B E N TL E Y A RNA G E
G R A N D M A R Q UIS
H 15 00 C HE V Y V A N A W D CO N V
J A G UA R S -TY P E 4 .2 LITRE
J A G UA R X K R CO NV E RTIB L E
9-2X W A G O N A W D
BAJA AW D
E S CA P E FW D
HIG HLA ND E R 2 W D
IO N
M IN I CO O P E R
TRIB U TE 4 W D
TT R O A DS TE R
V UE FW D
30 0C A W D
9 -7 X A W D
A V A LO N
E Q U IN O X A W D
FR E E S TY LE A W D
S TS A W D
C1 50 0 S UB URB A N 2 W D
K 1 50 0 S UB URB A N 4 W D
S 5 00 4 M A TIC
TITA N 2W D
E LA N TRA
FO RE NZA
MPV
C A Y E NN E S
X 5 4 .8 IS
A 4 Q UA TTR O
P TCRUIS E R CO NV /CA B R IO
The negative relationship between number of cylinders and the size of residuals is readily
apparent in this graph. Note that since there are fewer observations plotted in each of the
graph frames, EViews switches to showing some of the observation labels from the work-
file.
Unique Values
Our final example uses the Unique values – error if not identical data setting.
We again employ the workfile “Gulfcoast.WF1” containing population information for coun-
ties in the Gulf Coast region of the United States. For this example, we restrict ourself to dis-
playing values for counties in Louisiana by setting the sample to only include observations
where the STATE_NAME = “Louisiana”.
We display the percentage change in population for counties in Louisiana in 2005 and 2006
using a categorical dot plot. The categorical plot uses the factors COUNTY_NAME and
YEAR, with YEAR entered last in the within list since we want to compare population values
in the two years for a each county.
Illustrative Examples—539
Next, despite the fact that we wish to plot every observation in the sample, we set the
Graph data setting to Unique values – error if not identical. Note that this is a change
from previous examples where we used the Raw data setting.
This latter choice requires a bit of discussion. Since we are displaying a plot of every obser-
vation (every county and period) in the sample, you might at first think of selecting Raw
540—Chapter 14. Categorical Graphs
data for this setting. Recall, however, that using Raw data will produce a plot with each
observation identified in some way as belonging to a category. In this case, since every
observation is in a different category (county and period), selecting Raw data will produce a
dot plot that uses a separate row and symbol for every observation. This is obviously not the
desired effect.
Selecting Unique values – error if not identical tells EViews that (using the default settings
in the Categorical options dialog) despite the fact that we are plotting every observation,
we want to plot both year values for a single COUNTY_NAME on a single row, and that we
want to use unique graph elements across years, but not across counties. Thus, different
YEAR observations are given different symbols within a county, but the set of symbols used
to identify the two years is the same across different counties.
If all of this seems rather abstract or mysterious, we will examine this issue in greater depth
in “Specifying Factors,” on page 540. For now, you may follow a simple rule-of-thumb: if
your factors define groups containing only one observation each, you generally should
select Unique values – error if not identical to obtain the desired graph.
Lastly, we use the Size & Indents dialog under the Frame section to change the height and
aspect ratio to 6 and 0.50, respectively. Then use the Grid Lines dialog under Axes & Scal-
ing to turn on horizontal gridlines by selecting Custom from Obs & Date axis grid lines,
with a Step of 1. In addition, we employ the Data axis labels dialog, also under Axes &
Scaling, to display the bottom axis scale in Units of Percent, with a “%” suffix, and to draw
a zero line.
Specifying Factors
Categorical graphs use factor variables to define subsets of data. In the simplest case, a cat-
egorical graph is based on a a single factor variable containing a small number of discrete
values; subsets of the data are defined for observations with each of these values. In this
basic setting, specifying the factors for the graph involves little more than providing the
name of the factor variable and indicating whether it should vary within or across graph
frames.
Accordingly, the factor specification for a categorical graph may involve much more than
simply providing a list of factors. While the EViews defaults will generally produce the
desired graph, you may need to customize the factor specification in more complicated set-
tings. The remainder of this section outlines the default rules that EViews uses for specifying
and organizing factors, and describes rules for customizing the factor specification.
Specifying Factors—541
Suppose, for example, that we have the factor variable, FEM, indicating whether the indi-
vidual is a 0 (Male) or 1 (Female). The two distinct values 0 and 1 will be used to define the
categories for the factor and each individuals in a sample will be categorized on the basis of
whether they are 0 or 1.
You may also specify a factor variable that is non-categorical, or one with a large number of
distinct values. For example, suppose you propose the use of the series INCOME, which
measures individual incomes, as a factor variable. The use of this variable creates difficul-
ties since income does not have a small number of categories; indeed, every observation
will be in its own category.
By default, EViews tries to avoid this situation by analyzing each factor to determine
whether it appears to be categorical or continuous. If EViews determines that the variable is
continuous, or if there is a large number of categories associated with the factor, EViews
will define a new categorization by automatically binning the factor into five categories
defined by the quintiles of the series.
By default, EViews attempts to label all 35 categories in the resulting graph. The graph may
be a bit busy for some tastes, even if we only show the factor levels. One alternative is to
display a binned version of this graph where we define categories based on intervals of the
DISPLACEMENT values.
Specifying Factors—543
the options.
20
The resulting graph shows that EViews catego-
rizes observations into one of four DISPLACE-
16
MENT ranges: [0, 2), [2, 4), [4, 6), [6, 8). The
mean MPG for cars with engine size under 2
12
liters is roughly 29, while the mean value for
)
,2
,4
,6
,8
[0
[2
[4
[6
engines from 6 to 8 liters is under 14. While the
T
EN
EN
EN
EN
M
M
negative relationship between engine size and
CE
CE
CE
CE
LA
LA
LA
LA
miles-per-gallon can be seen in the earlier
SP
SP
SP
SP
DI
DI
DI
DI
graph, it is more apparent in the binned ver-
sion.
It is worth noting that binning on the basis of custom thresholds is not directly supported in
graphs. If you wish to define custom bins, you should use the series classification Proc to
define a new categorical variable (see “Stats by Classification” on page 318 for details), and
then use the new variable as your factor.
In addition, if you are plotting multiple series in a group, you will be prompted for whether
to treat the different series as an across or a within factor, and to specify the factor ordering
(whether the factor should be placed at the beginning or end of the list).
A number of the case studies in “Illustrative Examples,” beginning on page 523 demonstrate
the effects of these choices.
)
,8
,6
,4
,2
[6
[4
[2
[0
T
EN
EN
EN
EN
M
EM
CE
CE
C
LA
LA
LA
LA
SP
SP
SP
SP
DI
DI
DI
Suppose, in addition to the FEM variable, you have a second factor variable UNION repre-
senting whether the individual is in “Union” or “Non-union” employment. Then the four
categories for these two factors are: {(“Male,” “Non-union”), (“Male,” “Union”),
(“Female,” “Non-union”), (“Female,” “Union”)}.
Specifying Factors—545
with the “Male” categories coming first, followed by the “Female” categories, and with the
UNION status categories varying within the FEM categories. We say that the FEM factor var-
ies more slowly in this ordering than the UNION category since the latter varies within each
level of FEM.
Alternately, we can reverse the ordering so that the FEM factor varies more rapidly:
We may extend this notion of ordering to more than two categories. Suppose we have a
third factor, YEAR, representing the year the individual is observed, with three distinct val-
ues 1980, 1981, and 1982. Then if FEM varies most slowly, UNION next most slowly, and
YEAR most rapidly, we have:
The first three cells correspond to {“Male,” “Non-union”} workers in each of the three
years, while the first six cells correspond to the “Male” workers for both union and non-
union workers in each of the three years.
When specifying factors in the main Graph Options page, you will enter the factors in the
Within graph or Across graphs list. Within each list, factors should be ordered from slow-
est to fastest varying. Factors listed in the Across graphs list are always more slowly vary-
ing than those in the Within graphs list since each across graph category is displayed in a
separate graph frame.
so that FEM varies more slowly than UNION. The second example reverses the ordering of
the two factors so that UNION varies more slowly:
union fem
The last example orders the factors so that FEM varies most slowly, and YEAR most rapidly:
fem union year
Various examples of the effect of reversing the ordering of factors are provided in “Illustra-
tive Examples,” beginning on page 523.
(The choices described in this section are not relevant for non-summary categorical graphs
specified by selecting Raw data in the Graph data combo on the main graph dialog).
To understand the basic issues involved in these choosing graph elements, we must first
divide our within factors into two groups: primary and secondary factors. Primary within
factors are a subset of most slowly moving factors whose levels share common graph ele-
ments (e.g., colors, line patterns, shades). The remaining secondary factors display different
levels with different graphic elements.
You may think of the primary factors as defining the set of categories that yield summary
“observations” so that they are arrayed along the axis, with the secondary factors defining
subsets within these categories (much in the same way that one may draw minor ticks
Specifying Factors—547
between the major ticks on a graph axis). We then apply the general rule that primary fac-
tors share common graph elements across levels, while secondary factors use different
graph elements for different categories. The interpretation of primary factors as being cate-
gories displayed the axis with secondary factors specified as subsets of the primary factors is
an important one that we will explore further.
As is often the case, some examples will best illustrate the basic ideas. We return to the ear-
lier example of constructing a binned categorical graph for mean of CITY_MPG divided into
ranges of DISPLACEMENT. We begin by displaying a bar graph showing the categorical
means:
28 28
24 24
20 20
16 16
12 12
)
)
,2
,4
,6
,8
,2
,4
,6
,8
[0
[2
[4
[6
[0
[2
[4
[6
T
T
N
EN
EN
N
E
E
EM
EM
EM
EM
M
E
E
C
AC
AC
C
LA
LA
LA
LA
A
PL
PL
PL
PL
P
P
IS
IS
IS
IS
IS
IS
IS
IS
D
On the left is the graph using default settings where DISPLACMENT is treated as a primary
factor, while on the right is a graph with DISPLACMENT treated as a secondary factor. Note
that on the left, the levels of the primary factor DISPLACEMENT use the same graph ele-
ment (bar color), while on the right, the levels of the secondary factor DISPLACEMENT use
different bar colors.
Before examining examples of the more complex settings, let us first see how we modify the
default settings of the graph on the left to obtain the graph on the right. Click on Categorical
options to display the options dialog. At the bottom of the dialog is the descriptively titled
Within graph category identification which provides control over the assignment to major
and minor factor categories, and as we will see later, the labeling of these categories.
up to and including, selects the set of factors are to be given common graphic elements.
Since the primary factors must be the most slowly varying factors, assigning factors to the
primary and secondary groups is the same as choosing a cutoff such that factors up to and
including the cutoff are primary factors, and factors following the cutoff are secondary fac-
tors. The combo box effectively draw a line separating the two groups of factors.
In the single factor case setting, the combo default is set so that factor is primary so that all
graph elements are common; in this example, the combo is set to DISPLACEMENT. The
graph above on the left, with all bars displayed using the same color, shows the default set-
ting. Changing the combo to read None indicates that there are no primary factor, only the
single secondary factor, as in the graph with different colored bars on the right.
While informative, our bar graph example hides one very important difference between the
two graphs. Recall that one interpretation of the difference between primary and secondary
factors is that the levels of the primary factors are placed along the axis, with secondary fac-
tors defining subsets within these major categories. In our example, there are four distinct
categories along the axis in the left bar graph and only one category on the axis in the right
graph. The different numbers of categories along the axis is hidden in bar graphs; since the
latter always offset bars drawn for different categories it is difficult to tell the difference
between the primary and secondary factor categories.
We may, see the importance of this difference when switching from a bar graph to a dot
plot:
28 28
24 24
20 20
16 16
12 12
)
)
,2
,4
,6
,8
[0
[2
[4
[6
T
DISPLACEMENT [0,2)
EN
EN
E
DISPLACEMENT [2,4)
EM
EM
EM
M
E
C
AC
AC
DISPLACEMENT [4,6)
A
LA
PL
PL
PL
DISPLACEMENT [6,8)
P
IS
IS
IS
IS
D
In the graph on the left, DISPLACEMENT is a primary factor so that each level of the factor
is displayed as a separate “observation” along the axis using a common symbol and color
for the dot. In the graph on the right, DISPLACEMENT is a secondary factor that is displayed
Specifying Factors—549
using different symbols and colors for each level of the primary factor. Since there is no pri-
mary factor in this case there is only a single observation on the axis, and all four symbols
are lined up on that single observation.
For a slightly more complicated example, we again use the “Wages.WF1” workfile contain-
ing information on log wages for a sample of 4165 individuals. We will use the three series
FEM, UNION, and YEAR as within factors, entered in that order, and will display a dot plot
of the means for this categorization using the default settings.
Mean of LWAGE by FEM, UNION, YEAR Mean of LWAGE by FEM, UNION, YEAR
7.2 7.2
7.0 7.0
6.8 6.8
6.6 6.6
6.4 6.4
6.2 6.2
6.0 6.0
5.8 5.8
FEM=0 FEM=1
=0
=1
=0
=1
N
N
IO
IO
IO
IO
N
U
The resulting graph, shown on the left, has several notable features. First, the four distinct
categories formed from the primary factors FEM and UNION are each assigned to the graph
axis. Within each level of the primary factors, we see distinct symbols representing the var-
ious levels of the secondary YEAR factor. Lastly, the set of symbols is common across pri-
mary factor levels (e.g., all four of the “YEAR=1976” symbols are blue circles).
550—Chapter 14. Categorical Graphs
Changing the combo box to FEM produces the graph on the right. Since FEM is the sole pri-
mary factor, EViews assigns the two levels for FEM to the graph axis, with the remaining
factors treated as secondary factors.
For our next example, we consider the group object GROUP01 containing the series EXPER
and LWAGE. We display scatterplots of the categorical means for these two series given the
three within factors FEM, UNION, and YEAR, along with regression fit lines.
7.2 7.2
7.0 7.0
6.8 6.8
YEAR=1976
YEAR=1977 6.6
6.6
LWAGE
LWAGE
YEAR=1978
YEAR=1979
YEAR=1980 6.4 6.4
YEAR=1981
YEAR=1982 6.2 6.2
6.0 6.0
5.8 5.8
12 14 16 18 20 22 24 12 14 16 18 20 22 24
EXPER EXPER
The scatterplot on the left uses the default setting so that FEM and UNION are primary cate-
gories, and YEAR is a secondary category. Mean values are plotted for each category, with
different symbols used for different levels of YEAR. Following the principal that primary fac-
tors define observations, regression fit lines are computed for each level of the secondary
category across levels of the primary factor. Thus, the fit line for YEAR=1977 shows the
regression fit obtained using the four mean values of LWAGE and EXPER in the categories
defined by levels of FEM and UNION.
In contrast, setting the combo to YEAR so that all factors are primary yields the plot on the
right. All of the points use the common symbols, and the fit line is fitted across all of the pri-
mary factor levels.
The basic principle here is that if you wish to draw fit lines for summary statistics across
categories, those categories should be specified as primary factors.
5.25
Here, we see the dot plot corre-
sponding to the earlier line graph. 5.00
E X PE R =1
E X PE R =3
E X PE R =5
E X PE R =7
E X PE R =9
E X P ER =1 1
E X P ER =1 3
E X P ER =1 5
E X P ER =1 7
E X P ER =1 9
E X P ER =2 1
E X P ER =2 3
E X P ER =2 5
E X P ER =2 7
E X P ER =2 9
E X P ER =3 1
E X P ER =3 3
E X P ER =3 5
E X P ER =3 7
E X P ER =3 9
E X P ER =4 1
E X P ER =4 3
E X P ER =4 5
E X P ER =4 7
E X P ER =4 9
E X P ER =5 1
FEM clearly varies more rapidly as
both the FEM=0 and FEM=1
points are plotted for each level of
FEM=0 FEM=1
EXPER. The line graph version of
this graph simply connect points
across observations (experience
levels) for each level of FEM and turns off the symbols, making it appear as though EXPER
is varying more rapidly.
Our last example ties together all of the various concepts. Suppose that we were to plot the
average log wage against year using FEM and UNION as our factors. There are two distinct
approaches to constructing this graph. In the first approach, we specify a single observation
scale using YEAR and draw four different wage-year profiles, one for each category formed
by FEM and UNION. In the second approach, we adopt a “panel” style graph in which
divide the factor scale into two panels, with the first panel representing a YEAR scale for
males, and the second panel representing a YEAR scale for females. We show the two cases
below:
552—Chapter 14. Categorical Graphs
Mean of LWAGE by YEAR, FEM, UNION Mean of LWAGE by FEM, YEAR, UNION
7.2 7.2
7.0 7.0
6.8 6.8
6.6 6.6
6.4 6.4
6.2 6.2
6.0 6.0
5.8 5.8
1
97
97
97
97
98
98
98
97
97
97
97
98
98
6
2
97
97
97
97
98
98
98
=1
=1
=1
=1
=1
=1
=1
=1
=1
=1
=1
=1
=1
=1
=1
=1
=1
=1
=1
=1
AR
AR
AR
AR
AR
AR
AR
AR
AR
AR
AR
AR
AR
AR
AR
AR
AR
AR
AR
AR
YE
YE
YE
YE
YE
YE
YE
YE
YE
YE
YE
YE
YE
YE
YE
YE
YE
YE
YE
YE
FEM=0 FEM=1
FEM=0, UNION=0 FEM=0, UNION=1
FEM=1, UNION=0 FEM=1, UNION=1 UNION=0 UNION=1
The graph on the left specifies the within factor list as “YEAR FEM UNION”, with YEAR the
sole primary factor, and FEM and UNION the secondary factors. The axis scale uses YEAR
to identify observations, and for each secondary factor category draws a line connecting the
observations for that category. In contrast, the graph on the right uses the within factor list
“FEM YEAR UNION”, with FEM and YEAR as the primary factors. The axis scale uses FEM
and YEAR for observations, with YEAR varying for each level of FEM, and for each level of
the secondary factor connects the lines across the observations for each factor. Note that
EViews knows not to connect lines across levels of the FEM factor.
(Note: we have customized the graph on the right slightly by freezing the graph, and turn-
ing on Segment with lines in the Sample breaks section of the Basic type page.
The rule-of-thumb to remember here is that the factor that you wish to connect using a line
graph or XY line graph, should be specified as the last primary factor. Specifications with
one primary factor will have a set of lines for each secondary factor factory; specifications
with more than one primary factor will be displayed in paneled form.
Factor Labeling
By default, EViews will label factor levels in summary graphs using some combination of
axis labels and legend entries. For line graphs and XY graphs, the EViews choices are the
only possible way to identify the levels. For other types of summaries, we may choose to
display the bulk of the label information along the axis, or we may choose to display most of
the information in legend entries.
Specifying Factors—553
Mean of LWAGE by YEAR, FEM, UNION Mean of LWAGE by YEAR, FEM, UNION
7.2 7.2
7.0 7.0
6.8 6.8
6.6 6.6
6.4 6.4
6.2 6.2
6.0 6.0
5.8 5.8
F E M = 0 , U N IO N = 0
M = 0 , U N IO N = 1
E M = 1 , U N IO N = 0
F E M = 1 , U N IO N = 1
F E M = 0 , U N IO N = 0
M = 0 , U N IO N = 1
E M = 1 , U N IO N = 0
F E M = 1 , U N IO N = 1
F E M = 0 , U N IO N = 0
M = 0 , U N IO N = 1
E M = 1 , U N IO N = 0
F E M = 1 , U N IO N = 1
F E M = 0 , U N IO N = 0
M = 0 , U N IO N = 1
E M = 1 , U N IO N = 0
F E M = 1 , U N IO N = 1
F E M = 0 , U N IO N = 0
M = 0 , U N IO N = 1
E M = 1 , U N IO N = 0
F E M = 1 , U N IO N = 1
F E M = 0 , U N IO N = 0
M = 0 , U N IO N = 1
E M = 1 , U N IO N = 0
F E M = 1 , U N IO N = 1
F E M = 0 , U N IO N = 0
M = 0 , U N IO N = 1
E M = 1 , U N IO N = 0
F E M = 1 , U N IO N = 1
2
97
97
97
97
98
98
98
=1
=1
=1
=1
=1
=1
=1
AR
AR
AR
AR
AR
AR
AR
YE
YE
YE
YE
YE
YE
YE
FEM=0, UNION=0 FEM=0, UNION=1
Y E A R = 1 9 7 6 FF E
Y E A R = 1 9 7 7 FF E
Y E A R = 1 9 7 8 FF E
Y E A R = 1 9 7 9 FF E
Y E A R = 1 9 8 0 FF E
Y E A R = 1 9 8 1 FF E
Y E A R = 1 9 8 2 FF E
Both of the graphs displayed here are summary bar graphs of LWAGE categorized by YEAR,
FEM and UNION. In the graph on the left, we display all of the category information using
two-level labels along the axis, while in the graph on the right, we display the information
using a single level axis label combined with legend entries.
We emphasize again that this combo box does not affect the category labeling for Line &
Symbol, Scatter, and XY Line plots.
554—Chapter 14. Categorical Graphs
Part III. Customizing Output
EViews objects (series, groups, equations, and so on) display their view and (sometimes)
procedure output in the form of graphs, tables, and text. You may, for example, display the
descriptive statistics of a set of series, or the regression output from an equation as a table,
or the impulse responses from a VAR as a graph. We will term these displays object views.
While object views may be customized in a variety of ways, they are generally transitory;
when you close the object and subsequently redisplay or switch between views, many of
the customized settings are lost. And in cases where the views are dynamic, the view is
regenerated automatically when the underlying object or the active sample changes, result-
ing in the loss of any custom settings.
Fortunately, you may preserve the current object view, along with any customization, so
that it does not change when the object changes. We refer to this action as freezing the
view. Freezing a view will create a new output object containing a “snapshot” of the current
contents of the view window. The type of object created when you freeze a view depends
on the original view—freezing a graphical view creates a graph object, freezing a tabular
view creates a table object, and freezing a text view creates a text object.
Graph, table, and text objects form the basis of presentation output, and EViews provides
sophisticated tools for customizing the appearance of these objects. EViews also offers a
spool object which allows you to manage collections of output objects. Spool objects may be
used for creating a log of the output created during a project or an EViews session, or for
gathering together graph, table, and text output for a presentation.
The following chapters describe the use of graph objects, table objects, and spool objects in
greater detail, showing how you may use these objects to form presentation output:
• Chapter 15. “Graph Objects,” beginning on page 557 describes the creation and cus-
tomization of graph objects.
• Chapter 16. “Table and Text Objects,” beginning on page 589 describes the creation
and customization of tables and text objects.
• Chapter 17. “Spool Objects,” beginning on page 601 describes the use of spool objects
to manage collections of output objects.
556—Part III. Customizing Output
Chapter 15. Graph Objects
In Chapter 13. “Graphing Data,” on page 435 and Chapter 14. “Categorical Graphs,” begin-
ning on page 523 we described in detail EViews tools for producing graphical displays of
your data. The topics considered range from simple observation line graphs, to analytical
graphs such as histograms, to even more complex categorical graphs.
These graphical displays are what we term graph views since they are simply a different way
of viewing the data in the underlying data object. While graph views may be customized in
a variety of ways, they are generally transitory; when you close the series or group object
and subsequently redisplay or switch views, many customized settings are lost. And in
cases where the views are dynamic, the view is regenerated automatically when the under-
lying object or the active sample changes, resulting in the loss of any custom settings.
Fortunately, you may create a graph object by freezing a graph view. Freezing a view will
create a new graph object containing a “snapshot” of the current graph view, allowing you
to perform permanent customization of the graphical output. Graphs may also be placed
into a spool object along with table and text objects for use in custom presentations (see
Chapter 17. “Spool Objects,” on page 601).
This remainder of this chapter describes the options available for customizing the appear-
ance of a graph object. This chapter does not offer a comprehensive examination of all of
the possible customizations you may perform; we encourage you to experiment with vari-
ous settings to see the effect on your output.
It is important to keep in
mind the distinction between
a graphical view of an object
such as a series or a group,
and a graph object created by
freezing that view.
You may customize this graph view in any of the ways described in “Customizing a Graph”
on page 26, but many of these changes will be lost when the view is redrawn, e.g. when the
object window is closed and reopened, when the workfile sample is modified, or when the
data underlying the object are changed. If you would like to keep a customized graphical
view, say for presentation purposes, you should create a graph object from the view.
series and is stored in its current state in the graph object. Changes to the series data will
not affect the graph.
The choice between Manual and Automatic is based on when you would like the graph to
respond to changes in the data. Selecting Manual allows you to control when the updates
occur. The graph will remain the same until you push the Update button on the graph tool-
bar, or until the graph type is changed. Choose Automatic if you’d like EViews to keep the
graph current with changes to the underlying data.
Alternately, select Update when data or the workfile sample changes to accept all changes
to the data and workfile sample when the graph is updated. Note this means that a change
in the workfile sample will be reflected in the graph, whereas the Update when underlying
data changes using the sample option keeps the graph sample constant unless you change
it in the main Graph Options dialog.
560—Chapter 15. Graph Objects
Now, let’s see how changes to the series data affect the frozen graph. If we change the value
at 1949M01, we’ll see the graph plotting the new value. However, modifying the value at
1956M01 has no effect on the graph, since this date is outside the graph’s sample range.
The real difference between the two options in the Update condition group can be seen
when we modify the workfile sample. Since we have specified an update sample for the cur-
rent graph, changes to the workfile sample will not have an effect on the graph.
Creating Graph Objects—561
Alternately, if we had
selected Update when
data or the workfile
sample changes in the
Auto Update Options
dialog when freezing the
graph, we would see dif-
ferent behavior. Create a
graph with the second
Update condition, and
then expand the workfile
sample back to 1949
through 1960. Once
updated, the graph will
expand its sample to
match that of the work-
file.
Don’t worry if you’re not sure which choice to make for any of these options. You can
always make changes after the graph has been created from the main Graph Options dialog,
under the Graph Updating section (“Graph Updating” on page 581). Even if you’ve chosen
to create a non-updating graph, you can always switch the graph to update from this dialog,
provided the original series or group still exists in the workfile.
Now, let’s talk about the graph objects we’ve been creating.
562—Chapter 15. Graph Objects
There’s one other thing to notice in the titlebar. A graph with updating turned off will have
a green icon in the upper left-hand corner, while a graph with updating turned on will have
an orange icon. These colored icons will also be seen in the workfile window, once the
graph has been named. You may also verify (or modify) the updating status using the
Graph Updating section of the graph options dialog (“Graph Updating” on page 581).
Combining Graphs
You may also create a graph object by combining two or more existing named graph
objects. Simply select all of the desired graphs and then double click on any one of the high-
lighted names. EViews will create a new, untitled graph, containing all of the selected
graphs. An alternative method of combining graphs is to select Quick/Show… and enter the
names of the graphs.
Customizing Graphs
EViews allows you to perform extensive customization of your graph object. You may add
text, lines and shades, edit or remove existing elements such as legends or titles, or change
a wide variety of display settings for the graph.
Customizing Graphs—563
A graph object is made up of a number of elements: the plot area, the axes, the graph leg-
end, and possibly one or more pieces of added text or shading. To select one of these ele-
ments for editing, simply click in the area associated with it. A blue box will appear around
the selected element. Once you have made your selection, you can click and drag to move
the element around the graph, or double click to bring up a dialog of options associated
with the element.
The first four options in Position place the text at the indicated (relative) position outside
the graph. You can also place the text by specifying its coordinates. Coordinates are set in
virtual inches, with the origin at the upper left-hand corner of the graph.
564—Chapter 15. Graph Objects
You can change the position of text added to the graph by selecting the text box and drag-
ging it to the position you choose. After dragging to the desired position, you may double
click on the text to bring up the Text Labels dialog to check the coordinates of that position
or to make changes to the text. Note that if you specify the text position using coordinates,
the relative position of the text may change when you change the graph frame size.
When adding a line, you may check Draw line on top to instruct EViews to draw the line
after drawing the data. This can be useful with filled in areas, such as area or bar graphs.
If you check the Apply color... checkbox, EViews will update all of the existing lines or
shades of the specified type in the graph.
Here we have drawn a vertical shaded area defined by the dates 1953M01 and 1957M07:
To modify a single existing line or shaded area, simply double click on it to bring up the dia-
log.
Sorting Graphs
Selecting Sort... from the Proc menu or the
right mouse-button menu from the brings up
the Sort Order dialog. Providing one or more
sort keys will reorder the observations in the
graph on the basis of the values of the keys.
You may choose to reorder the data in ascend-
ing or descending values of the keys.
Notice that EViews displays as much axis label information as possible since the observa-
tions are no longer described using a single time scale. Note also that the existing shade is
associated with observation numbers and remains in the sorted graph, albeit with a very dif-
ferent interpretation.
Simply press Delete or click on the Remove button to delete the scale.
(Double clicking will open the Graph Options dialog and will show the settings for the ver-
tical axis.)
You may also remove legends, as well as any text, lines or shading which have been added
to the graph.
Graph Options
The main Graph Options dialog controls the basic display characteristics of your graph. The
dialog may be opened by selecting Options... from the right mouse menu. You may also
double click anywhere in the graph window to bring up the Graph Options dialog. If you
double-click on an applicable graph element (the legend, axes, etc.), the dialog will open to
the appropriate page.
568—Chapter 15. Graph Objects
Here we have double clicked on the graph’s legend, so the dialog opens to the Legend sec-
tion. First, note the tree structure on the left-hand side of the dialog. EViews offers a lot of
graph options, and to make them more accessible, they have been broken up and organized
into groups. Within each group, you will find specific sets of options. Let’s go through these
groups one at a time.
Graph Types
The Graph Type section allows you to change the graph type. Begin by selecting a type
from the Basic type page:
Customizing Graphs—569
The listbox on the left-hand side of the page provides access to the fundamental graph
types. The graph types that are available depend on whether the graph uses data from a sin-
gle series (or column of data, e.g., a vector) or more than one series (or more than one col-
umn of a matrix). For example, the Area Band, Mixed with Lines, and High-Low (Open-
Close), Scatter, XY Line, and XY Area types are only available for graphs containing multi-
ple series or matrix columns.
Depending on the nature of your graph, there are a number of additional settings that may
be displayed on the right-hand side of the Basic type page:
• Multiple series – When plotting line, bar, or area graphs with multiple series, EViews
displays an option for producing a stacked graph. Simply select Stack lines, bars, or
areas to display a stacked graph (see “Single Series Graphs,” beginning on page 450
for details).
• XY series handling – In cases where there is potential ambiguity concerning the han-
dling of multiple series in XY graphs (Scatter, XY Line, XY Area, XY Bar), EViews will
display a combo box prompting you for whether you want to plot the data using First
vs. All or using XY pairs (see “Pairwise Graphs” on page 454 for discussion).
• Mixed - First series type – The mixed graph displays multiple series in a single graph
frame, with the first series shown as a bar, spike, or area graph, or with the first two
series displayed as an area band graph, with the remaining series depicted using
lines.
If you select Mixed with Lines as your graph type, the dialog will change to offer you
a choice for the graph type for the first series type. The default setting is Bar. See
“Mixed with Lines” on page 484.
570—Chapter 15. Graph Objects
• Sample Breaks & NA Handling – If your data involve sample breaks or missing val-
ues, EViews will display additional settings allowing you to control the appearance of
your graph. See “Sample Break & NA Handling” on page 444 for further discussion.
Categorical graphs
If you have selected Categorical graph from the General drop-down on the Basic type
page, a Categorical options page will also be available under the Graph Type section:
For a discussion of categorical graphs and use of the Categorical options page, see
Chapter 14. “Categorical Graphs,” on page 523.
Depending on its type, a graph can have up to four axes: left, bottom, right, and top. Each
series is assigned an axis as displayed in the upper right listbox on the Data scaling page:
572—Chapter 15. Graph Objects
You may change the assigned axis by first highlighting the series and then clicking on one of
the available axis buttons. For example, to plot several series with a common scale, you
should assign all series to the same axis. To plot two series with a dual left-right scale,
assign the two series to different axes. To edit characteristics of an axis, select the desired
axis from the drop down menu at the top of the dialog.
In the Obs/Date
axis dialog, you
will see either a
button or an edit
field at the bottom
of the Axis labels
group.
Customizing Graphs—573
For graphs that are actively updated, such as a graph view or a fro-
zen graph with updating turned on, an edit field will be displayed.
Entering an alpha or series name in the field instructs EViews to
label each observation with the text or value of the alpha or series.
The labels are updated as the values of the alpha or series change. To remove the labels and
return to EViews default labels, leave this field blank.
The second approach to adding custom labels allows you to use alpha or numeric series val-
ues in a static fashion. The labels are initialized with the current values in the series, but
will not be updated if the underlying data change. You may also choose to initialize labels of
this type with observation numbers, or simply leave them blank and assign your own text.
The labels may be edited as you please, and your changes will not be replaced when the
graph is refreshed or the type is changed.
Legend
To edit the graph legend characteristics, select the Attributes page of the Legend group.
Note that if you place the legend using user-specified (absolute) positions, the relative posi-
tion of the legend may change if you change the graph frame size.
Fill Areas
The Fill Areas page
under the Graph
Elements group
allows you to con-
trol the display
characteristics of
your area, bar, or
pie graph. Here,
you may custom-
ize the color, shad-
ing, and hatching
pattern of the
graph elements.
Bar-Area-Pie
The Bar-Area-Pie
page under the
Graph Elements
group provides
additional options
for bar, area, or pie
graphs. You may
add data labels to
bar graphs, as well
as modify the bars
visually by adding
shading or a 3D
appearance. You
may also specify if
fill areas should be
outlined.
Boxplots
The final page of
the Graph Ele-
ments group,
Boxplots, pro-
vides control over
all elements of a
boxplot. As with
the line and fill
area dialogs, these
options are only
applicable if you
have chosen box-
plot as your graph
type.
Templates
Having put a lot of effort into getting a graph to look just the way you want it, you may
want to use the same options in another graph. EViews allows you to use any named graph
as a template for a new or existing graph. You may think of a template as a graph style that
can be applied to other graphs.
In addition, EViews provides a set of predefined templates that you may use to customize
the graph. These predefined templates are not associated with objects in the workfile, and
are always available. The EViews templates provide easy-to-use examples of graph customi-
zation that may be applied to any graph. You may also find it useful to use the predefined
templates as a foundation for your own graph template creation.
578—Chapter 15. Graph Objects
To update a graph
using a template,
double click on the
graph area to dis-
play the Graph
Options dialog,
and click on Apply
template under the
Templates &
Objects group.
Alternatively, you
may right mouse
click, and select
Templates... to
open the desired
page of the dialog.
On the left-hand side of the dialog you will first select your template. The left-hand list box
contains a list of the EViews predefined templates. The right-hand box contains a list of all
of the named graphs in the current workfile page. In this dialog, we have selected the graph
object GRAPH01 for use as our graph template.
If you select one of the templates, you will be given the choice of applying the Bold, Wide,
or English labels modifiers to the base template. As the name suggests, the Bold modifier
changes the settings in the template so that lines and symbols are bolder (thicker, and
larger) and adjusts other characteristics of the graph, such as the frame, to match. The Wide
modifier changes the aspect ratio of the graph so that the horizontal to vertical ratio is
increased.
The English labels modifier changes the base template’s settings for auto labeling the date
axis. When English labels are applied, labels using month formatting will default to English
month names. For example, with English labels turned on, the axis may read: “Jan”, “Feb”,
“Mar”, while otherwise it may read: “M1”, “M2”, “M3”.
Applying Midnight with the Bold and Wide modifiers selected yields:
You may reset the dialog by clicking on the Undo Page Edits button prior to clicking on OK.
When you click on the OK or Apply button, EViews will immediately update all of the basic
graph settings described in “Graph Options” on page 567, including graph size and aspect
ratio, frame color and width, graph background color, grid line options, and line, symbol,
and filled area settings.
580—Chapter 15. Graph Objects
In contrast to the basic graph settings which are always updated when you click on OK or
Apply, the effects of using the template on the characteristics of existing text, line, and
shade objects in the graph is controlled by the choices on the right-hand side of the dialog.
There are three possibilities:
• Do not apply template to existing text & line/shade objects – instructs EViews to
use the text, line, and shade attributes in the template or template graph only for the
purpose of updating the default settings in the graph. If you select this option and
select Apply, subsequently added text, line, and shades will use the updated settings,
but existing objects will retain their existing characteristics.
• Apply template settings to existing text & line/shade objects – will update both the
settings for existing text, line, and shade objects, and the defaults used for newly
added objects.
• Replace text & line/shade objects with those of the template graph – will first
remove any added text label, line, or shading objects in the existing graph, and then
copy to the graph any such objects in the template.
To add a graph to the predefined template list, select it from the listbox on the bottom and
click the Add button. The graph will then move into the predefined list on the top of the dia-
log and will be removed from the list on the bottom. Before clicking the Add button, you
Customizing Graphs—581
may wish to give the graph template a different name by editing its name in the edit field to
the right of the listbox.
Similarly, to remove a graph from the predefined list, select it from the listbox on the top of
the dialog and click the Remove button. This will remove the graph from the template list,
but will not affect the graph object itself. Note that the EViews predefined templates cannot
be removed.
Objects
Also under the Templates & Objects group, the Object options dialog allows you to control
the default characteristics of new text, shade, or line drawing objects later added to the
graph, or to update the characteristics of the existing objects.
By default, when
you apply these
changes to the
graph object
options, EViews
will update the
default settings in
the graph, and will
use these settings when creating new line, shade, or text objects. Any existing lines, shades
or text in the graph will not be updated. If you wish to modify the existing objects to use the
new settings, you must check the Apply to existing line/shade objects and Apply to exist-
ing text objects boxes prior to clicking on the OK button.
Note that you may change the default settings for any of these options by selecting Options/
Graphics Defaults... from the main EViews menu. Any new graph views or objects will use
the updated options as the default settings.
See “Adding and Editing Text” on page 563 and “Adding Lines and Shades” on page 564.
Graph Updating
For graphs which may still be tied into underlying data, you will be offered the opportunity
to specify auto updating settings. The Graph Updating section allows you to change options
582—Chapter 15. Graph Objects
for how and when the graph is updated when its underlying data changes or the workfile
sample is modified.
You may also create a graph object containing multiple graphs by combining existing named
graph objects. Simply select the desired graphs and then double click on any one of the
highlighted names. An alternative method of combining graphs is to select Quick/Show…
and enter the names of the graphs.
There are two ways to work with a multiple graph. You may change the settings for the
multiple graph as a whole, or you may work with an individual graph component of the
multiple graph.
Modifying Multiple Graphs—583
These menu items set options that apply to all graphs in the graph object.
• Copy to clipboard... copies the graph to the clipboard.
• To set a common graph attribute to all graphs, select Options on all graphs….
EViews will display the multiple graph version of the Graph Options dialog, with
each page initialized using the settings for the first of the multiple graphs. Here we
see the dialog open to the Color & Border page of the Frame & Size section:
Most of the menu items are taken from the multiple graph
menu, and apply to the entire graph. For example, select-
ing Copy to clipboard... allows you to copy the entire
graph to the clipboard, not the individual graph.
The middle set of items provide tools for working with the
selected graph. You may use these to change options, to
add lines and shading, to sort the data, or to extract or remove the selected graph.
Printing Graphs
Clicking on the Print button on the graph view or graph object window toolbar will open
the Print dialog, allowing you to override the various global settings for graph printing.
The top section of the Print dialog may be used to select a printer and print options, or to
redirect the print job to an RTF file, graph object, or spool object (see “Print Setup” on
page 636).
You may choose to hide this copy dialog for subsequent operations by unchecking the Dis-
play this dialog... box. Copying will then always use the default settings, without prompt-
ing. If you wish to change the default settings, or to turn on or off the display of the copy
dialog, you may go to the Exporting page of the global Graph options (Options/Graphics
Defaults...).
Lastly, you should select the Output graph size. The size may be specified in inches, centi-
meters, printer points, picas, or pixels. If the Lock aspect ratio checkbox is selected,
changes to the Width or the Height will generate corresponding changes in the other
dimension. If you wish to scale your graph in a non-proportionate fashion, you should
uncheck this box.
When saving raster images (bitmap, GIF, JPEG, PNG) with sizes expressed in anything but
pixels, EViews offers an additional setting, Dots per Inch, which specifies the output resolu-
tion. The total number of pixels written in the output file will depend on both the number of
inches and the number of dots per inch. If, for example, you export a 5 by 4 inch GIF at 300
dots per inch, the final output file will be 1500 by 1200 pixels. At 100 dots per inch, the out-
put file will be 500 by 400 pixels.
The default graph file saving options may be set in the global options dialog by selecting
Options/Graphics Defaults.... and opening the Exporting page (see “Graphics Defaults” on
page 634).
Graph Commands
For those of you who wish to automate these procedures, for example to produce a regular
report, EViews allows you to perform extensive graph customization from the command
line or using programs.
588—Chapter 15. Graph Objects
See Chapter 2. “Working with Graphs,” on page 21, and “Graph” on page 174 in the Com-
mand and Programming Reference, for additional detail.
Chapter 16. Table and Text Objects
Table and text objects form the basis of presentation output for, and EViews provides
sophisticated tools for customizing the appearance of these objects.
Table Objects
Freezing views that contain formatted text or numbers that are aligned in columns or rows
produces table objects. The following sections describe the basics of working with table
objects, including creating, formatting, printing, and exporting of tables.
Creating Tables
In EViews, a table may be an object view or a table object. Table views are object views that
contain formatted text or numbers that are aligned in columns and rows. Examples of table
views are the spreadsheet views of a series and the estimation output views of an equation.
There are a limited set of customizations that are available for table views.
A table object is an independent object that contains formatted text or numbers. Table
objects may be created directly, by issuing a table declaration, or indirectly, by freezing a
table view. As with graph objects, table objects are “not live” in the sense that they do not
reflect the current contents of the underlying object, but are based instead upon the con-
tents of the object at the time the object was frozen. Table objects also allow for a full set of
customizations.
While many of the features described here apply to both table views and table objects, the
remainder of our discussion focuses on customization of table objects. Working with table
views is described elsewhere (see, for example “Changing the Spreadsheet Display” on
page 82).
Table Basics
The most basic operations in a table involve selecting cells and editing cell values.
Selecting Cells
Selecting one or more cells is one of the most common tasks in working with table views
and table objects. For the most part, you will find that cell selection works as it does every-
where else in Windows, but a brief review may prove useful.
The simplest selection is for a single cell. Simply click on the cell you wish to select. If the
table is not in edit mode, the cell will be shaded. If the table is in edit mode, the cell will be
surrounded by a black border, and the contents of the cell will be displayed in the table edit
window.
590—Chapter 16. Table and Text Objects
When edit mode is off, the anchor cell is marked as the cell with the black square in one of
the four corners of the cell. When edit mode is on, the anchor cell is marked with a black
border around the cell. You may toggle between edit mode on and edit mode off by clicking
on the Edit +/- button on the object toolbar, or alternately, by right mouse clicking and
selecting Edit +/-.
To select Action
Text in a cell If edit mode is turned on, select the cell, double-click in
it, and then select the text in the cell. Or select the cell
and then select the text in the edit field.
A single cell Click the cell, or use the arrow keys to move the anchor
cell.
A range of cells Click the first cell of the range, and then drag to the last
cell. Or click in a cell to set the anchor, then SHIFT-
click in the last cell you wish to include. Or set the
anchor, and then SHIFT and press the arrow keys until
desired cells are selected.
All cells in a table Click the corner cell shared by the column and row
header (the corner cell is not visible in some output
views). Or press CTRL+A.
An entire row Click the row heading.
An entire column Click the column heading.
Table Objects—591
Adjacent rows or col- Click and drag across the row or column headers. Or
umns select the first row or column; then hold down SHIFT
and click the last row or column heading.
More or fewer cells Hold down SHIFT and click the last cell you want to
than the current include in the new selection. The rectangular range
selection between the active cell and the cell you click becomes
the new selection. Or hold down SHIFT and press the
arrow keys until selection is correct.
Note that row and column header selection is not always available in table views since the
headers are not always displayed. For example, the estimation output view of an equation is
a table that does not contain header lines. Freezing the view creates a table object that
allows for cell selection using the visible headers.
Note that you may enter numeric expressions and have EViews evaluate them prior to plac-
ing them in the table. To evaluate a numeric expression into a cell, type “=” before the
expression. For example, entering the text “=4*5” will result in a cell value of “20”. Enter-
ing an invalid numeric expression will set the cell to a numeric NA.
592—Chapter 16. Table and Text Objects
This latter example raises a minor issue associated with entering missing values into a table.
If the text “NA” is entered into a table cell, the cell value will be set to the string “NA”, not
to the missing value NA. To enter a numeric missing value, you should enter the string
“=NA” into the cell. We point out that the choice between entering the “NA” string or the
NA value into a cell has consequences for auto-justification, or when saving values to a file.
Basic Customization
You may perform basic customization of a table object by attaching a title, by adding or hid-
ing the grid lines, or by resizing the rows or columns.
Table Title
To add a header title to the top of a table object, you should select Proc/Title... from the
table menu, or you may click on the Title button on the toolbar. EViews will display a dia-
log prompting you to enter your title. When you enter text in this dialog, EViews displays a
header title at the top center of the table. Note that the table title is different from the table
name, which provides the object name for the table in the workfile.
To remove the table title, display the title dialog, then delete the existing title.
Grid Lines
To toggle on or off the grid marking the cells in the table object, click on the Grid+/– but-
ton on the table toolbar, or select Proc/Grid +/- from the main table menu.
Row heights may only be resized in table objects. Place your cursor over the separator lines
in the row header and drag the separator until the row is the desired height. If you wish to
resize more than one row, first select the rows you wish to resize, then drag a separator to
the desired size. All of the rows will be resized to the specified size.
Double clicking a column/row edge in the header will resize the row or column to the mini-
mum height or width required so that all of the data in that row or column is visible.
Table Objects—593
Cell Formatting
You may select individual cells, ranges of cells, or the entire table, and apply various for-
matting tools to your selection. To format the contents of a set of cells, first make certain
that the table is in edit mode. Next, select a cell region, then click on CellFmt in the toolbar,
or right mouse click within the selected cell region and select Cell Format.... EViews will
open the Table Options dialog containing three tabs: Format, Font/Color, and Borders/
Lines.
Content Formatting
The Format tab allows you to apply dis-
play formats to the contents of cells in
table objects. Formatting of table objects
may be cell specific, so that each cell may
contain its own format.
For additional discussion of content and cell formatting, see the related discussion in
“Changing the Spreadsheet Display” on page 82.
594—Chapter 16. Table and Text Objects
Note also that EViews uses the special keyword Auto to identify cases where the selection
region contains more than one text or fill color. To apply new colors to all of the selected
cells, simply select a Text or Fill color and click on OK.
last buttons correspond to the outer borders, and the second button is used to set the
(between cell) inner border.
If there were a single column in the selection region, the Border display would only show a
single column of “Cell Data”, and would have only two buttons for modifying the outer ver-
tical cell borders. Similarly, if there were a single row of cells, there would be a single row
of “Cell Data”, and two buttons for modifying the outer horizontal cell borders.
Cell Annotation
Each cell of a table object is capable of containing a comment. Comments may be used to
make notes on the contents of a cell without changing the appearance of the table, since
they are hidden until the mouse cursor is placed over a cell containing a comment.
To add a comment, select the cell that is to contain the comment, then right mouse click
and select Insert Comment... to open the Insert Cell Comment dialog. Enter the text for
your comment, then click OK. To delete an existing comment, just remove the comment
string from the dialog.
Use the Comments+/- button in the tool bar to toggle comment mode on and off. Note that
the red triangle and comment text will not be exported or printed.
Cell Merging
You may merge cells horizontally in a table object. When cells are merged, they are treated
as a single cell for purposes of input, justification, and indentation. Merging cells is a useful
tool in customizing the look of a table; it is, for example, an ideal way of centering text over
multiple columns.
596—Chapter 16. Table and Text Objects
If we right mouse click and select Merge Cell +/–, the two cells will be merged, with the
merged cell containing the contents and formatting of the anchor cell B1. If you wish C1 to
be visible in the merged cell, you must alter the selection so that C1 is the anchor cell.
Printing Tables
To print a table object, click on the
Print button on the table tool bar or
select View/Print... from the main
EViews menu to display the Print dia-
log.
If you have selected a range of cells in the table, the Print range section of the dialog will
offer you choice of printing the entire table or only printing the current selection.
After you make a choice, EViews will place the table on the clipboard in Rich Text Format
(RTF), allowing you to preserve the formatting information built into the table. Thus, if you
copy-and-paste a table from EViews into Microsoft Word or another program which sup-
ports RTF, you will create a nicely formatted table containing your results.
To paste the clipboard contents into another application, switch to the destination applica-
tion and select Edit/Paste. Note that some word processors provide the option of pasting
the contents of the clipboard as unformatted files. If you wish to paste the table as unfor-
matted text, you should select Edit/Paste Special.
598—Chapter 16. Table and Text Objects
To save the table to disk, with the table window active or with table cells selected, right
mouse click or select Proc, then select Save table to disk... to bring up the Table File Save
dialog. The dialog displays default values from the global settings.
You may also specify options for how numbers are to be treated when written. You may
specify a Number format so that numbers are written As displayed in the table, or using
Full precision. In addition, you may change the text used to write missing values.
Table Commands
EViews provides tools for performing extensive table customization from the command line
or using programs. See “Table” (p. 570) in the Command and Programming Reference for
additional details.
Text Objects
Some output views have no formatting and are simple displays of text information. Exam-
ples are representations of an equation and results from X-11 seasonal adjustment. If you
freeze one of these views, you will create a text object.
You can also create a blank text object by selecting Object/New Object.../Text in the main
EViews menu or by simply typing “text” in the command window. Text objects may be
used whenever you wish to capture textual data that does not contain any formatting infor-
mation.
Text Objects—599
Printing of text objects follows the same procedure and offers the same options as printing a
table object; see “Printing Tables” on page 597.
600—Chapter 16. Table and Text Objects
Chapter 17. Spool Objects
EViews offers a spool object that is capable of holding multiple tables, graphs, text, and
spools, allowing you to form collections of output objects. You may find spools to be useful
for organizing results, for example, for creating a log of the results for a project or an
EViews session, or perhaps for gathering output for a presentation.
In addition to being an output object container, spool objects provide easy-to-use tools for
working with the objects in the spool. Among other things, you may manage (add, delete,
extract, rearrange, hide) or customize (resize, space and indent, title and comment, and
edit) the spool and the individual objects in a spool.
Creating a Spool
To create a spool object in a workfile, you may select Object\New Object\Spool from the
workfile menu, optionally enter a name in the Name for object edit field, and click on OK.
Alternately, you may simply enter the declaration command spool followed by an optional
name in the command window, then press ENTER.
Spools may also be created by printing from an EViews object to a non-existent spool. You
may simply redirect the print output of an object you wish to add to the spool (see “Adding
Objects”, below).
Here we see the spool view of an empty, unnamed spool object. As depicted here, the
default is to display the contents of the spool using two panes. The left pane is the tree pane
602—Chapter 17. Spool Objects
which shows a tree-structure listing of the objects contained in the spool. You may use the
tree pane to navigate quickly from object to object. The right pane is the main output pane
which shows the actual output view objects.
You may select and drag the separator between the two panes to change their relative sizes,
and you may use the Tree +/– on the toolbar to show and hide the tree pane. Note that
hiding the tree pane provides you with a larger main window display area, but makes a
number of spool management and customization tasks somewhat more difficult.
Adding Objects
You may add an output object to a spool using any of the three primary methods: printing to
the spool, copy-and-pasting objects, using the spool append procedure.
Printing to a Spool
Perhaps the easiest approach is to redirect the printing of the your object output into a spool
object. You may, for example, display the estimation results for an equation, or perhaps the
histogram view of a series, and “print” the output directly into a spool. Note that this
method does not require you to freezing the original object view to create a separate output
object.
Click on OK to continue. EViews will add an output object containing the contents of the
object window to the spool object.
Managing the Spool—603
If you wish to send all subsequent print jobs to the spool object, you may use the main File/
Print Setup... dialog or the output command to change the default print destination to
your spool (see “Print Setup” on page 636 and output (p. 280) of the Command and Pro-
gramming Reference). Then you may simply display your view, then click on Print and OK
to send the output to the spool object.
Copy-and-Paste to a Spool
Alternately, objects may be copied from the workfile window and pasted into an existing
spool object. Simply select the objects you wish to copy in the workfile window and press
CTRL-C or select Edit/Copy from the main or the right-button menus. Next display the
spool object window, and paste into the main object pane by pressing CTRL-V, or selecting
Edit/Paste from the main or right mouse-button menus.
EViews will append copies of output (graph, table, text, and spool) objects directly into the
spool; for other types of objects, EViews will append copies of the frozen default views. For
example, if you copy-and-paste a series, EViews will add a copy of the default spreadsheet
view to the spool.
We emphasize that the objects contained in a spool are frozen copies of the original objects.
The objects in the spool are independent of the source objects so that changes made to
either the copy or the original will not have an effect on the other.
Appending to a Spool
Lastly, you may select Proc/Append/Exist-
ing Object from the menu of an existing
spool object. You will be prompted by a dia-
log where you can enter the names of the
objects to be added and commands for dis-
playing the desired output windows in a
space delimited list. Here, for example, we
instruct EViews to display the default
spreadsheet view for GDP, a line graph for GDP, and as a Wald test for “c(1)=0” in equa-
tion EQ01, and to save the results for each of these three views into the spool.
Note that when adding multiple outputs you should make certain to separate the names and
commands by spaces. If necessary, you should enclose the text in double quotes, if, for
example, the command statement includes spaces as in the Wald example above.
604—Chapter 17. Spool Objects
Click on OK to
continue. The tree
pane of the spool
now shows the
three object names
and types, while
the main output
pane allows you to
view the objects.
You may scroll the
window between
output objects by
clicking on the
icon in the tree
pane or by using
the scrollbar on
the right-hand side of the output pane.
Note that the newly added objects are all given names that are variations on the name
“UNTITLED”. You may wish to provide more descriptive names (see “Naming Objects” on
page 606).
Embedded Spools
Spool objects may contain other spool objects. Nested spools allows you to categorize or
group output objects within a spool.
There are two ways to add a spool object to an existing spool. First, if the spool you wish to
add exists in your workfile then you may insert it into a spool as you would any other object
using print, copy-and-paste, or the append proc as described in “Adding Objects” on
page 602.
Suppose, for example, we have the named spool object MYSPOOL, which contains three
output objects (A1, A2, and A3). We next create a new, UNITITLED spool object containing
the output object B1. Lastly, we append MYSPOOL, and it’s three output objects by copying-
and-pasting MYSPOOL into the UNITITLED main object pane.
The contents of
MYSPOOL are
added to the
end of the
spool object.
The copy of the
spool object,
shown with the
spool icon, is
assigned the
name
UNTITLED01.
It is worth noting that the embedded spool object is a full-fledged output object inside the
parent spool. Thus, selecting an embedded spool and performing operations such as nam-
ing, commenting, hiding, indenting, resize, etc. applies to the embedded spool object, and
not to the objects inside the embedded spool. The most important implication of this fact is
that if you wish to change the properties of the objects within an embedded spool, you must
display the embedded spool in edit mode so that you can access its settings and its individ-
ual elements (“Editing Objects in a Spool” on page 616), or you must first move the object
out of the spool, or you may flatten or move all of the objects out of the embedded spool
(“Flattening a Spool” on page 611).
For example, the easiest way to turn on comments for all of the objects within the embed-
ded spool in the example above is to double click on UNTITLED01 in the tree pane to acti-
vate edit mode, then to modify its display settings by clicking on the Comments +/–
button. By placing the embedded spool in edit mode, we gain access to its display settings;
if instead we pressed Comments +/– in standard mode, we would activate comments for
606—Chapter 17. Spool Objects
the objects in the parent spool only. (See “Editing Objects in a Spool,” on page 616 for addi-
tional discussion).
Naming Objects
To rename an output object in the spool, select the
object name in the tree pane or select the output
object in the main output page, then right mouse-
click and select Name.... EViews will display the
Object Title dialog.
Simply enter a new, valid EViews name in the Object Name field, and if desired a display
name in the optional Display Name field. The display name allows you to provide a more
descriptive label that may be employed in place of the object name in the tree pane view
when displaying object names.
Since all spool output objects will, by default, be named using some variant of “UNTI-
TLED”, we recommend that if you have spools with more than a few objects, you assign
them more descriptive object or display names.
Adding Comments
Comments may be added to
objects, allowing you to annotate
individual objects in the spool. To
add a comment to an object or to
change the existing comment,
select the object of interest, then
choose the right button menu item
Comment… to bring up the Insert
Object Comment dialog.
Enter your comment or edit the existing comment and click on OK to add it to the object.
Managing the Spool—607
Hiding Objects
After creating a spool with objects of various types, you may wish to view a subset of the
objects. You may hide objects either individually or by type (tables, graphs, or text).
Note that hiding an embedded spool hides all of the objects in the embedded spool.
An alternate
method
requires that
object title dis-
play be turned
on. Click the
Properties but-
ton to bring up
the Spool
Properties dia-
log, and check
the Show
Names check-
box. When
titles are dis-
played, the
main window
will contain a box containing a “+” or “–” alongside the name of the objects in the spool.
Clicking on the box will toggle the object between being hidden and visible. In this example,
clicking on the “–” symbol will hide UNTITLED01.
Resizing Objects
You may use the spool object to override the
sizes of individual output objects.
There are two different ways of using the spool to change the display size for an object. But
before you are allowed to alter the display size of an object you must make certain that its
display mode is set to Variable Width or Variable Width w/ Limit (see “Display Modes”
on page 615 for details).
First, you may select the object in the tree pane or by clicking on the object in the main win-
dow. Press the right mouse-button and select Properties... to open the Object Properties
dialog. Enter the desired Width in the edit field and click on OK. EViews will resize the
object, maintaining the original aspect ratio. Font sizes in the object will be scaled accord-
ingly.
610—Chapter 17. Spool Objects
Alternately, if the frame for an object is displayed in the output window, you may drag the
border to resize the object (see “Display Properties” on page 613 for a discussion of border
display settings).
Note that resizing the object does not alter the native size of the object. You may at any time
select an object, right-click, and choose Reset size to return an individual object to its native
size. Or, you may use the spool object to reset the display of all of your objects to their
native sizes (see “Display Modes,” on page 615).
Indenting Objects
To change the indentation of an object you should first select the object in the tree pane or
by clicking on the object in the main window. Press the right mouse-button and select Prop-
erties... to open the Object Properties dialog. Enter the desired indentation in the Horizon-
tal and Vertical edit fields, and click on OK to continue.
Note that the indentation values set in the Indent in inches section dialog will be added to
any margins set for the spool.
Removing Objects
To remove an object from a spool select the object then press the Delete key or select
Remove from the right mouse-button menu. EViews will prompt you for whether you wish
to continue. Click on OK to proceed.
Note that if you remove a spool object, you will remove it and all of the objects contained in
the spool. If you wish to retain some of the nested objects you must move them outside of
the embedded spool (“Rearranging Objects” on page 610) prior to deleting the spool. Alter-
nately, you may simply delete a subset of objects within the embedded spool.
Extracting Objects
You may copy, or extract, an object in a spool into the workfile. To extract an object, simply
highlight the object, and then select Extract from the right mouse-button menu, or click on
Proc/Extract. EViews will create an untitled output object in the workfile containing a copy
of the object in the spool.
Rearranging Objects
Suppose, for example, that you have placed a number of output objects in the spool, but
they are not in the desired order for your presentation. You may reorder objects in the spool
using the tree pane to move objects (one at a time) to different positions in the spool.
Managing the Spool—611
To move an
object, you
should select it
in the tree
pane and drag
it to the
desired posi-
tion. A hori-
zontal black
bar will indi-
cate the
object’s new
location when
the mouse but-
ton is released.
If the destina-
tion is an
embedded spool, EViews will move the object into the embedded spool.
Note that objects may easily be moved into and out of embedded spool objects. In our
example, we move the table object UNTITLED03 from the embedded spool UNTITLED02
into the top level of the spool, just below UNITITLED01.
Flattening a Spool
You may move all of the objects out of an embedded spool by flattening the spool. Flatten-
ing moves out all of the output objects in an embedded spool (including objects in any
spools embedded in the embedded spool), and then deletes the now empty spool.
Select the name of the embedded spool you wish to flatten in the tree pane, then click on
Proc/Flatten All or press the right mouse-button and select Flatten. EViews will replace the
spool with all of the output objects in the spool.
612—Chapter 17. Spool Objects
In our example, we select the spool object UNTITLED02, and use the right mouse-button to
select Flatten. EViews will replace UNTITLED02 with all of its child output objects, renam-
ing the objects as necessary to avoid name conflict.
In this example, UNTITLED01 and UNTITLED02 have automatically been renamed in order
to resolve the name conflict resulting from flattening the spool.
Customizing the Spool—613
Display Properties
Press the Properties button in the tool bar to bring up the Spool Properties dialog which
allows you to set the basic display properties for the spool object:
General Settings
The General Settings section of the dialog allows you to show and hide various parts of the
spool.
• The Show Borders option allows you to display a frame around each of the output
objects in the main spool window. Dragging the border of an object will resize that
object (see “Resizing Objects” on page 609).
• The Show Names and Use Display Names checkboxes control the display of names
in the main output window. Object name labels for each object are displayed if Show
Names is checked; the display names are used in place of the object name if Use Dis-
play Names is checked (see “Naming Objects” on page 606).
• The Show Comments checkbox of this dialog determines whether individual object
comments are displayed (see “Adding Comments” on page 606).
• Show Table Titles controls whether to display the table objects using their own titles.
Note that the Show Borders, Show Names and Show Comments settings may be accessed
directly from the spool object toolbar. For example, clicking on the Names +/– button is
the same as checking or unchecking the corresponding box in the Spool Properties dialog.
The last option, Show Table Titles, requires some discussion. In EViews, table objects have
titles which generally differ from the name given the table in the spool. When Show Table
614—Chapter 17. Spool Objects
Titles is checked (the default), the title of each table will be displayed. If we also turn on
Show Names, we see that the object name in the spool is “untitled02” and the table title is
“GDP”:
Next, we turn table titles off, which hides the “GDP” table title. Note here that the first line
of the object display is now the update date:
Customizing the Spool—615
Names/Comments Font
Click on the Font button to bring up a dialog for setting the font size, color, and family for
text in displayed names and comments.
Vertical Spacing
The Vertical Spacing edit field controls the amount of vertical space placed between output
objects in the spool.
Margins
The Use Margins checkbox controls whether the spool will display the contents of the out-
put window with vertical and horizontal margin padding. If you wish to provide spool mar-
gins, you should select this option and enter values for the size of the vertical and/or
horizontal margins.
Note that this setting controls margins for the spool object itself. Margins for individual
objects may be adjusted by selecting an object, right mouse clicking, and selecting Proper-
ties... (see “Indenting Objects,” on page 610). Individual object margins are specified rela-
tive to the margins for the spool object.
Display Modes
When you bring an output object into a spool, EViews copies the original output object at its
original size; we term this the native object size. Subsequent editing of the object in the
spool may change this native size (see “Editing Objects in a Spool” on page 616).
The spool object allows you to display objects at sizes that differ from the native sizes. By
separating the display size of the object in the spool from the native object size, EViews per-
mits customizing the display of objects without requiring manual editing of the native size
in each output object.
By default, EViews displays graph objects in a spool using a uniform width while table and
text objects are displayed in using their native widths and font sizes. This default setting
allows for a relatively uniform appearance for the objects in the spool.
• The default Fixed Width setting fixes the spool display sizes for graphs at a uniform
width, as specified in the Width Limit (inches) edit field.
• Variable Width displays the graphs at the native sizes, but permits individual cus-
tomization as described in “Resizing Objects” on page 609.
• Variable Width w/ Limit displays graph objects in their native widths so long as they
do not exceed the specified limit, otherwise the display size is adjusted accordingly.
You may customize the display sizes of individual objects.
The Table/Text Settings portion of the dialog provides similar control over tables and text
objects (though Fixed Width is not available for tables). For table and text objects, the
default is to use Variable Width, but you may use the combo to change the settings to Vari-
able Width with limit. If a table or text object is resized, the font will be scaled accordingly.
You may, after performing individual display sizing (“Resizing Objects” on page 609) decide
that you wish to revert to the original native sizes; selecting Reset objects to native width,
and clicking on OK will set all of the objects in the spool to use their native sizes.
To make changes to the object you must first place the spool in edit mode. Simply double
click on the object in either the tree or the output panes to put the spool in edit mode. Alter-
nately, you may select the object you wish to edit, right-click, and choose Edit.
When a spool is placed in edit mode, EViews will display the object being edited using the
full width of the window. The toolbar will change to show the options for the edit object,
instead of those for the spool object. In addition there be a new region, just below the tool-
bar, showing the object and display names for the edit object, as well as a Close button that
saves any modifications, turns off edit mode, and returns you to the standard spool win-
dow.
Editing Objects in a Spool—617
One important case of object editing involves editing an embedded spool object. When you
double click on an embedded spool object or select it, right-click, and choose Edit, EViews
changes the spool display to show the embedded spool in edit mode:
618—Chapter 17. Spool Objects
Edit mode for the embedded spool is visually similar to standard mode for an arbitrary
spool. There are only two visual cues that we are in edit mode in a parent object. First, just
below the toolbar is the standard edit mode line containing the Close button and the
description of the object name. Second, the icons for the objects B1 and UNTITLED01 are
now grayed-out in the tree window, indicating that they may not be selected.
Indeed, working with an embedded spool object in edit mode is identical to working with a
spool object in standard mode; you may perform all of the operations in this chapter using
the embedded spool and its elements. Clicking on the Properties button brings up the Spool
Properties dialog which allows you to set display options for the selected spool. You may,
for example, use the properties dialog to increase the vertical spacing or to display table
titles for objects within the embedded spool. Since we are editing the embedded spool,
changes in the spool in edit mode have no impact on the objects and settings in the parent
spool. (See also “Embedded Spools,” on page 604).
Once you are done editing your object, you should click on the Close button to save all of
your object changes and to return to the standard display mode.
Printing a Spool—619
Printing a Spool
Print Mode
You may use the Print mode combo to specify where page breaks are to be used in your
print job. There are three possible modes (Print to fit, Continuous, and Individual). If you
select Print to fit, objects will not, unless larger than a page, be split across pages. In Con-
tinuous mode, objects in the spool will be printed successively and page breaks will occur
when the bottom of a page has been reached. Individual mode prints the spool with a page
break after every object. Note that whatever the print mode setting, graph objects are never
split across pages.
If the spool contains embedded (child) spools, you will be provided with an additional
option for whether to treat the embedded spool as a single output object or to treat it as a set
of individual objects. In practical terms, this choice is equivalent to deciding between print-
ing the contents of embedded spools in continuos mode (single object) or printing the
objects in the spool using the selected print mode (multiple objects). To employ the latter
method, you should check the box labeled Apply print mode to child spools.
To demonstrate the effects of selecting this option, assume we have a parent spool contain-
ing a table and an embedded spool which contains two graph objects. Suppose that we set
the Print mode to Individual, and check the Apply print mode to child spools option. The
resulting print job will generate three pages of output: a page for the table, and one for each
of the individual graphs. Unchecking the option would (if the graphs both fit on a single
page), generate two pages of output: one for the table, and a second for both graphs.
620—Chapter 17. Spool Objects
You may use the Child size to determine the relative size of child objects. Selecting Native
Dimensions prints the objects in the spool at their native sizes so that they will appear as
they would if printed individually, outside of the spool. If instead you select Screen propor-
tional, EViews will print the objects in the spool in the same proportions as the spool dis-
play window. All sizing customization in the spool will be used.
The positions of objects on the page is controlled using the Justification combo. Choosing
Left or Center will force all objects to print on the left side or the center of the page. Center
graphs only will left-justify table and text objects, and center graph objects.
Labeling
You may use the Object Labels section of the dialog to control whether to print titles and
comments in the spool. Selecting the respective checkbox check will print the additional
information along with the output object. These settings are especially useful if you turn on
the titles and comments in the spool display, but do not wish to include them in your
printed output, or vice versa.
Saving a Spool
You may save the contents of a spool object to disk. Click on Proc/Save spool to disk... to
display the save dialog.
The Object labels section of dialog may be used to specify whether the titles and comments
should be written to the output file. By default, neither titles nor comments are saved in the
output file.
Appendix A. Global Options
EViews employs user-specified default settings in many operations. You may, for example,
set defaults for everything from how to perform frequency conversion between workfile
pages of different frequency, to which font to use in table output, to line color and thickness
in graphs, to how to compute derivatives in nonlinear estimation routines.
These default options may, of course, be overridden when actually performing an operation.
For example, you may have specified a default conversion of data from monthly to quarterly
data by averaging observations, but may choose to use summing when performing a spe-
cific conversion. Similarly, you may instruct EViews to use the color red for the first line in
newly created graphs, and then change the color in a specific graph.
General Options
When you click the General Options... menu item, EViews brings up the Global Options
dialog. This dialog is broken up into many sections which are accessible using the tree on
the left-hand side of the dialog. We discuss briefly the options within each of these sections.
In some cases, additional detail is provided in the corresponding sections of the manual.
Window Appearance
EViews provides a number of color themes to modify the appearance of your EViews envi-
ronment.
622—Appendix A. Global Options
Most windows in EViews have a row of buttons along the top, called the button bar. To hide
these buttons on all windows, uncheck Display button bars on the top right of the dialog.
Window Behavior
The Window behavior page controls the display characteristics of various types of EViews
output.
The Options Menu—623
Fonts
The Fonts section allows you to change the default font styles and sizes for various sets of
windows and objects. Select the type of object for which you want to change the font from
the dropdown at the top of the dialog and modify the font settings below. For example, to
set the default font face and size to be used in table objects and table views of objects, select
Spreadsheets & Table defaults and modify the settings below the dropdown.
Frequency Conversion
The Frequency conversion dialog within the Series and Alphas section allows you to set
the default frequency conversion methods for both up and down conversion, and the
default method of displaying dates.
Note that the series label may be viewed by selecting View/Label in a series window, or at
the top of a series spreadsheet if the spreadsheet defaults are set to display labels (“Spread-
sheet Layout” on page 625).
Alpha Truncation
Note that EViews alpha series automatically resize as needed, up to the truncation length.
To modify the alpha series truncation length, select Alpha Truncation from the Series and
Alphas section, and enter the desired length. Subsequent alpha series creation and assign-
ment will use the new truncation length.
Spreadsheet Layout
The options in the Layout dialog within the Spreadsheets section control the default
spreadsheet view settings of series, group, and table objects. The defaults are set using these
option settings when the object is first created.
626—Appendix A. Global Options
In the Series
spreadsheets por-
tion of the dialog,
you may set the dis-
play format and
choose to display
the spreadsheet in
one or multiple col-
umns, with or with-
out object labels and
header information.
In addition, you
may choose to have
edit mode turned on
or off by default.
Frozen tables allows you to modify whether edit mode is on or off by default.
You may set the Spreadsheet display order to ascending or descending from the drop-
down in the upper-right corner of the dialog.
indicators for negative numbers. Similarly, you may choose the default Text justification
and Indentation for alphanumeric display.
We emphasize the fact that these display options only apply to newly created series or
group objects. If you subsequently alter the defaults, existing objects will continue to use
their own settings.
In addition, you
may elect to save your workfiles in compressed format on disk by checking the Use com-
pression setting. Note that compressed files are not readable by versions of EViews prior to
5.0, and that they do not save memory when using the workfile, as it is uncompressed when
loaded into memory. Compressed workfiles do, however, save disk space.
You should uncheck the Prompt on each Save checkbox to suppress the workfile save dia-
log on each workfile save.
In addition, you may specify whether EViews should keep backup copies of workfiles when
saving over an existing file. If selected, the automatic backup copy will have the same name
as the file, but with the first character in the extension changed to “~”.
628—Appendix A. Global Options
Date Representation
The Date represen-
tation dialog con-
trols the format for
dates in sample
processing, and in
workfile and vari-
ous object views.
For daily and
weekly data, you
can set the default
to American
(Month/Day/Year)
or you may switch
to European nota-
tion (Day/Month/
Year), where the
day precedes the month. You may also specify your quarterly or monthly date display to use
the Colon delimiter or a Frequency delimiter character based on the workfile frequency
(“q” or “m”). The latter has the advantage of displaying dates using an informative delim-
iter (“1990q1” vs. “1990:1”).
The Options Menu—629
See also “Free-format Conversion Details” on page 102 in the Command and Programming
Reference for related discussion.
Estimation Defaults
You can set the
global defaults for
the maximum
number of itera-
tions, convergence
criterion, and
methods for com-
puting derivatives
in the Estimation
options dialog.
When the Display settings option is checked, EViews will produce additional output in the
estimation output describing the settings under which estimation was performed.
630—Appendix A. Global Options
Programs
The first page of
the Programs sec-
tion provides some
general options for
running EViews
programs. You can
stop a program
from running after
exceeding a speci-
fied number of
errors by entering
the error count in
Maximum allow-
able errors before
halting.
You may also use this dialog to specify whether EViews should keep backup copies of pro-
gram files when saving over an existing file. The backup copy will have the same name as
the file, but with the first character in the extension changed to “~”.
If the checkbox labeled Version 4 compatible variable substitution is selected, EViews will
use the variable substitution behavior found in EViews 4 and earlier versions. EViews 5
changed the way that substitution variables are evaluated in expressions. You may use this
checkbox to use Version 4 substitution rules. See “Version 4 Compatibility Notes” on
page 120 for additional discussion.
In addition, you may elect to display program files with basic syntax coloring. If Use syntax
coloring is selected, basic programming keywords, strings, and comments will be displayed
in color. You may also Enable word wrap in programs.
The Options Menu—631
This default may always be overridden from the Run Program dialog, or by using the
option “q” in the run statement, as in:
run(q) myprogram
You may also change which messages are to be logged in the program log window (see
“Program Log Windows,” on page 111 of the Command and Programming Reference for a
description of each message type). For each message type, you have the option to always
log, never log, or allow the program to enable/disable logging via the LOGMODE command
(see LOGMODE in the Command reference).
For details, see “Executing a Program,” beginning on page 107 of the Command and Pro-
gramming Reference.
632—Appendix A. Global Options
You may also use the COM ProgID section of the dialog to specify the default Programmatic
IDs (ProgIDs) used when instantiating a MATLAB or R COM server. The ProgID is used to
indicate the version of MATLAB or statconnDCOM to which EViews connects when you
issue an xopen command. Each combo will contain values found in the Windows registry
on your system that were entered when you installed MATLAB and statconnDCOM. You
may choose from entries in the combos, or type in a specific ProgID for EViews to use when
opening a MATLAB or R session. The default settings may be overridden by specifying
“progid=” in the xopen command.
For details on these settings see xopen (p. 376) and xput (p. 378) in the Command and Pro-
gramming Reference or the whitepapers Using EViews COM Automation Client for MATLAB
and Using EViews COM Automation Client for R.
The Options Menu—633
File Locations
This selection
allows you to set
the default working
directory, and the
locations of the
.INI file, database
registry and alias
map, and the temp
directory.
Note that the default working directory may also be changed via the File Open and File
Save or File Save As dialogs, or by using the cd command.
Memory Allocation
The top portion of the dialog allows you to adjust the EViews memory allocation settings.
By default, EViews allows a maximum of 4 million observations per series. You may use the
combo box to increase or decrease this limit.
634—Appendix A. Global Options
The total memory available for all EViews objects is limited by the maximum address space
per application. Standard Windows XP systems allow for 2GB of address space, but may be
configured to use 3GB (using the /3GB switch). Windows XP x64 systems allow for 4GB of
address space per application. Note that if the amount of physical memory available is less
than the address space in use, available disk space will be used as virtual memory, which
will significantly degrade performance.
EViews reserves a portion of this address space for auxiliary purposes. This memory is used
by the operating system, DLLs, external database drivers, and by EViews when creating
objects. Reducing the size of the reserved space will increase the amount of address space
available for holding observations, but will decrease the total number of objects allowed in
EViews, and may lead to instability caused by out-of-memory conditions.
Multi-Processor Use
The Multi-processor/Multi-core use section may be used to define the maximum number
of threads you would like to allow EViews to use when processing statistical calculations.
EViews treats processors and cores symmetrically, and does not include hyper-threaded pro-
cessors. In general, we recommend leaving this setting at Auto.
When set to Auto, EViews detects the number of cores in your system and attempts to use
all of them. You may override this setting for up to eight threads. This allows you to
increase the number of threads EViews uses to beyond the physical number of cores. We
have not found this to be effective, but, in principle, it could improve performance with
hyper-threading. If you require more processing power for other applications, you may wish
to limit the number of threads EViews uses by setting this number below the physical num-
ber of cores. This is guaranteed to work with Intel processors, and, to our knowledge,
should work with other brands of processors as well.
You may click on the Reset to EViews Defaults button to return to the default settings.
Graphics Defaults
These options control how a graph appears when it is first created. The great majority of
these options are explained in considerable detail in “Graph Options,” beginning on
page 567.
The Options Menu—635
Additional dialog pages are provided for specifying the default settings for use when saving
graphs to file (Exporting) and for handling sample breaks, missing values, and panel data
structures (Samples & Panel Data).
Default settings for color and background transparency may be set in the Frame & Size/
Color & Border entry of the Graph Options dialog.
See “Basic Customization,” beginning on page 459 and Chapter 15. “Graph Objects,” on
page 557.
Database Registry
The Database Registry... settings are described in detail in “The Database Registry” on
page 281.
You may also check for updates to the EViews program or for updates to supplementary
components such as the EViews documentation or sample data and programs, by visiting
the Download section of the EViews website (www.eviews.com).
Print Setup
The Print Setup options (File/Print Setup... on the main menu) determine the default print
behavior when you print an object view.
The top of the Print Setup dialog provides you with choices for the destination of printed
output.
You may elect to send your output directly to the printer by selecting the Printer radio but-
ton. The drop down menu allows you to choose between the printer instances available on
Print Setup—637
your computer, and the Properties button allows you to customize settings for the selected
printer.
Alternatively, you may select Redirect so that EViews will redirect your output. There are
three possible settings in the drop down menu: RTF file, Text file (graphs print), Frozen
objects, and Spool object:
• If you select RTF file, all of your sub-
sequent print commands will be
appended to the RTF file specified in
Filename (the file will be created in
the default path with an “.RTF”
extension). You may use the Clear
File button to empty the contents of the existing file.
• If you select Text file (graphs print), all printed text output will be appended to the
text file specified in Filename (the file will be created in the default path with a
“.TXT” extension). Since graph output cannot be saved in text format, all printing
involving graphs will still be sent to the printer. Spools will send all text and table
output to the file, and will ignore all graph output.
The other portions of the Print Setup dialog set various default settings for spool, graph,
and table printing.
638—Appendix A. Global Options
We remind the user that this dialog only specifies the default settings for printing. You may
override any of these settings when printing a particular job using the Print dialog or the
print command.
Index