EViews Illustrated Chapter 1
EViews Illustrated Chapter 1
for Version 7
ISBN: 978-1-880411-44-5
Disclaimer
The author and Quantitative Micro Software assume no responsibility for any errors that may appear in this book or the EViews program. The user assumes all responsibility for the selection of the program to achieve intended results, and for the installation, use, and results obtained from the program.
Trademarks
Windows, Word and Excel are trademarks of Microsoft Corporation. PostScript is a trademark of Adobe Corporation. Professional Organization of English Majors is a trademark of Garrison Keillor. All other product names mentioned in this manual may be trademarks or registered trademarks of their respective companies.
Quantitative Micro Software, LLC 4521 Campus Drive, #336, Irvine CA, 92612-2699 Telephone: (949) 856-3368 Fax: (949) 856-2044 web: www.eviews.com
First edition: 2007 Second edition: 2009 Editor: Meredith Startz Index: Palmer Publishing Services
Hint: All the files used in this book are available on the web at www.eviews.com. Now that a workfiles loaded EViews looks like this. Our workfile contains information about quarterly average daily trading volume on the New York Stock Exchange (NYSE). Theres quite a bit of information, with over 400 observations taken across more than a century. The icon indicates a data series stored in the workfile.
occurred. Most periods trading is light. Heavy trading volume say over a billion shares happened much less frequently. To the right of the histogram we see a variety of summary statistics for the data. The average (mean) volume was just over 93 million shares, while the median volume was 1.75 million. The largest recorded trading volume was over 1.6 billion and the smallest was just over 100,000. Now weve looked at two different views (Spreadsheet and Histogram and Stats) of a series (VOLUME). Weve learned that trading volume on the NYSE is enormously variable. Can we say something more systematic, explaining when trading volume is likely to be high versus low? A starting theory for building a model of trading volume is that trading volume grows over time. Underlying this idea of growth over time is some sense that the financial sector of the economy is far larger than it was in the past. Lets create a line graph to give us a visual picture of the relation between volume and time. Hit the button again: this time choosing Graph... and selecting Line & Symbol on the left-hand side of the dialog under Graph Type. EViews graphs the date on the horizontal axis and the value of VOLUME on the vertical. Unsurprisingly perhaps, the most important descriptive aspect of our data is that volume is a heck of a lot bigger than it used to be!
Click on the button to get the dialog box shown to the right. The upper field, marked Sample range pairs (or sample object to copy), indicates that all observations are being used. Replace @all with the beginning and ending dates we want. In this case use 2001q1 for the first date, a space to separate the dates, and the special code @last to pick up the last date available in the workfile. When youve changed the Sample dialog as shown in the second figure, hit .
Hint: Ranges of dates in EViews are specified in pairs, so 2001q1 @last means all dates starting with the first quarter of 2001 and ending with the last date in the workfile. EViews accepts a variety of conventions for writing a particular date. 2001:1 means the first period of 2001 and 2001q1 more specifically means the first quarter of 2001. Since the periods in our data are quarterly, the two are equivalent. The Line Graph view changes to reflect the new sample. Note how the date scaling on the horizontal axis has changed. Previously we could fit only one label for each decade. This close up view gives a label every six months. For example, 03Q3 means year 2003, third quarter, which is to say, July-September 2003. Because the sample is so much more homogenous, we can now see lots of short-run up and down spikes.
Remember: when we changed the sample on the view, we have not changed the underlying data, just the portion of the data that were viewing at the moment. The complete set of data remains intact, ready for us to use any time wed like. Hint: The new sample applies to all our work until we change it again, not just this one graph. Note the change in the Sample: line of the workfile window.
Double-click and then scroll the window so that the beginning of 2000 is at the top. Youll see a window looking something like the one shown here. Starting in 2001 we see numbers. Before 2001, only the letters NA. There are two lessons here: EViews operates only on data in the current sample. When we created LOGVOL the sample began in 2001. No values were generated for earlier dates. EViews marks data that are not available with the symbol NA. Since we didnt generate any values for the early years for LOGVOL, there arent any values available. Hence the NA symbols. Since were trying to look at all the available data, we want to change the sample to include, well the whole sample. One way to do this is to use the menu selection Quick/Sample. Another way to change the sample is to double-click on the sample line in the upper pane of the workfile windowright where the arrows pointing in the picture on the right. To illustrate another alternative, well type our first command. The workfile window and the series window appear in the lower section of the master EViews window. The upper area is reserved for typing commands, and, not surprisingly, is called the command pane. The command smpl is used to set the sample; the keyword @all signals EViews to use all available data in the current sample. Type the command:
smpl @all
in the command pane and end with the Enter key. Hint: Almost everything in EViews can be done either by typing commands or by choosing a menu item. The choice is a matter of personal preference.
You can see that the sample in the workfile window has changed back to 1888Q1 through 2004Q1.
Historical hint: Ever wonder why so many computer commands are limited to four letters? Back in the early days of computing, several widely used computers stored characters four bytes to the word. It was convenient to manipulate data a word at a time. Hence the four letter limit and commands spelled like smpl. Now that youve set the sample to include all the data, lets generate LOGVOL again, this time from the command line. Type:
series logvol = log(volume)
in the command pane and hit Enter. (This is the last time Ill nag you about hitting the Enter key. I promise.)
Again double-click on LOGVOL to check that we now have all our data. Then use the View menu to choose View/Graph... and select Line graph. The line graph for LOGVOLthe logarithm of our original VOLUME variableappears. What we see is not quite a straight line, but its a lot closer to a straight lineand a lot easier to look atthan our graph of the original VOLUME variable.
Hint: Menu items, both in the menu bar at the top of the screen and menus chosen from the button bar, change to reflect the contents of the currently active window. If the menu items differ from those you expect to see, the odds are that you arent looking at the active window. Click on the desired window to be sure its the active window.
We might conclude from looking at our LOGVOL line graph that NYSE volume rises at a more or less constant percentage growth rate in the long run, with a lot of short-run fluctuation. Or perhaps the picture is better represented by slow growth in the early years, a drop in volume during the Great Depression (starting around 1929), and faster growth in the postWar era. Well leave the substantive question as a possibility for future thought and turn now to building a regression model and making a forecast of future trading volume.
log ( volume t ) = a + bt
where the coefficient b gives the quarterly increase in LOGVOL. To get started we need to create the variable t. In the command pane at the top of the EViews screen type:
series t = @trend
@TREND is one of the many functions built into EViews for manipulating data. Double-click on and youll see something like the screen shown. Since we want to think about how volume behaves over time, we want to look at the variables T and LOGVOL together. In EViews a collection of series dealt with together is called a Group. To create a group including T and LOGVOL, first click on . Now, while holding down the Ctrl-key, click on . Then right-click highlighting Open, bringing up the context menu as shown and choose as Group.
The group shows time and log volume, that is, the series T and LOGVOL, together. Just as there are multiple ways to view a series, there are also a number of group views. Heres the spreadsheet view.
Looking at a spreadsheet of a group with two series leaves us in the same situation we were in earlier with a spreadsheet view of a single series: too many numbers. A good way to look for a relationship between two series is the scatter diagram. Click on the button and choose Graph.... Then select Scatter as the Graph Type on the left-hand side of the dialog that pops up. To add a regression line, select Regression line from the Fit lines dropdown menu. The default options for a regression line are fine, so hit to dismiss the dialog. We can see that the straight line gives a good rough description of how log volume moves over time, even though the line doesnt hit very many points exactly.
The equation for the plotted line can be written algebraically as y = a + b t . a is the inter is the estimated slope. Just looking at the plot, we cept estimated by the computer and b can see that the intercept is roughly -2.5. When t = 400, LOGVOL looks to be about 4. Reaching backpossibly to junior high schoolfor the formula for the slope gives us an approximation for b . ) 4 ( 2.5 b ----------------------- = 0.01625 400 0
An eyeball approximation is that LOGVOL rises sixteen thousandthsa bit over a percent and a halfeach quarter.
as shown below.
In EViews you specify a regression with the ls command followed by a list of variables. (LS is the name for the EViews command to estimate an ordinary Least Squares regression.) The first variable is the dependent variable, the variable wed like to explainLOGVOL in this case. The rest of the list gives the independent variables, which are used to predict the dependent variable.
Hint: Sometimes the dependent variable is called the left-hand side variable and the independent variables are called the right-hand side variables. The terminology reflects the convention that the dependent variable is written to the left of the equal sign and the independent variables appear to the right, as, for example, in log ( volume t ) = a + bt . Whoa a minute. LOGVOL is the variable we created with the logarithm of volume, and T is the variable we created with a time trend. But where does the C in the command come from? C is a special keyword signaling EViews to estimate an intercept. The coeffi cient on the variable C is a , just as the coefficient on the variable T is b .
Whether you use the menu or type a command, EViews pops up with regression results. EViews has estimated the inter cept a = 2.629649 and the slope b = 0.017278 . Note that our eyeballing wasnt far off!
Just as there are multiple ways to view series and groups, equations also come with a variety of built in views. In the equation window choose the button and pick Actual, Fitted, Residual/Actual, Fitted, Residual Graph. The view shifts from numbers to a picture. There are lots of details on this chart. Notice the two different vertical axes, marked on both the left and right sides of the graph, and the three different series that appear. The horizontal axis shows the date. The actual values of the left-hand side variablecalled Actualand the values predicted by the right-hand sidecalled Fittedappear in the upper part of the graph. In other words, the thick upper line marked Actual is log ( volume ) and the straight line marked Fitted is 2.629649 + 0.017278t . Actual and Fitted are plotted along the vertical axis marked on the right side of the graph; fitted values rising roughly from -2 to 8. Residual, plotted in the lower portion of the graph, uses the legend on the left hand vertical axis. Whether we look at the top or bottom we see that the fitted line goes smack though the middle of log ( volume ) in the early part of the sample, but then the fitted value is above the actual data from about 1930 through 1980 and then too low again in the last years of the sample. If we could get an equation with some upward curvature perhaps we could do a better job of matching up with the data. One way to specify a curve is with a quadratic equation such as:
log ( volume t ) = a + b 1 t + b 2 t 2 + e
For this equation we need a squared time trend. As in most computer programs, EViews uses the caret, ^, for exponentiation. In the command pane type:
series tsqr = t^2
To see that this does give us a bit of a curve, double-click . Then in the series window choose View/Graph... and select Line to see a plot showing a reassuring upward curve. Close the equation window and any series windows that are cluttering the screen. (Dont close the workfile window.) Now lets estimate a regression 2 including t to see if we can do a better job of matching the data. EViews is generally quite happy to let you use a mathematical expression right in the LS command, rather than having to first generate a variable under a new name. To illustrate this capability type in the command pane:
ls log(volume) c t tsqr
Weve typed in log(volume) instead of the series name LOGVOL, and could have typed t^2 instead of tsqr: thus illustrating that you can use either a series name or an algebraic expression in a regression command.
Prior to this step the title bar of the equation window read Equation: untitled. Using the button changed two things: the equation now has a name which appears in the title bar, and more importantly, the equation object is stored in the workfile. You can see these changes below. If you like, close the equation window and then double-click on to re-open the equation. But dont take the break quite yet!
Before leaving the computer, click on the workfile window. Use the File menu choice File/Save As to save the workfile on the disk. Now would be a good time to take a break. In fact, take a few minutes and indulge in your favorite beverage.
Back so soon? If your computer froze while you were gone you can start up EViews and use File/Open/EViews Workfile to reload the workfile you saved before the break. Your computer didnt freeze, did it? (But then, you probably didnt really take a break either.) This is the spot in which authors enjoin you to save your work often. The truth is, EViews is remarkably stable software. It certainly crashes less often than your typical word processor. So, yes, you should save your workfile to disk as a safety measure since its easy, but theres a different reason that were emphasizing saving your workfile. EViews doesnt have an Undo feature. As you work you make changes to the data in the workfile. Sometimes you find youve gone up a blind alley and would like to back out. Since there is no Undo feature, we have to substitute by doing Save As frequently. If you like, save files as foo1.wf1, foo2.wf1, etc. If you find youve made changes to the workfile in memory that you now regret you can backup by loading in foo1.wf1. You can also hit the Save button on the workfile window to save a copy of the workfile to disk. This is a few keystrokes easier than Save As. But while Save protects you from computer failure, it doesnt substitute for an Undo feature. Instead it copies the current workfile in memoryincluding all the changes youve madeon top of the version stored on disk. Pedantic note: EViews does have an Undo item in the usual place on the Edit menu. It works when youre typing text. It doesnt Undo changes to the workfile.
Forecasting
We have a regression equation that gives a good explanation of log ( volume ) . Lets use this equation to forecast NYSE volume. Hit the button on the equation window to open the forecast dialog.
Notice that we have a choice of forecasting either volume or log ( volume ) . (When you use a function as a dependent variable, EViews offers the choice of forecasting either the function or the underlying variable.) The one we actually care about is volumetaking logs was just a trick to get a better statistical model. Leave the dialog set to forecast volume. Uncheck Forecast graph, Forecast evaluation, and Insert actuals for out-of-sample observations. In the Forecast sample field enter 2001q1 2004q1. Your dialog should look something like the one shown.
Whats Ahead21
EViews creates a series of forecast values for volume, storing them in the series VOLUMEF, which now appears in the workfile window. Double-click on . Choose View/Graph... in the VOLUMEF window and select Line in the dialog to see the forecast values.
The first thing youll notice is that nothing shows up on most of the plot. We asked EViews to start the forecast in January 2001 and thats what EViews did, so there is no forecast for most of our historical period. Click the button and enter 2000 @LAST in the upper field of the Sample dialog. The graph snaps to a close up view of the last few years. You have a volume forecast. NYSE volume is forecast to rise over the forecast period from about 750 million shares to nearly 1.2 billion. Mission accomplished.
Whats Ahead
This chapters been a quick stroll through EViews, just enoughwe hopeto whet your appetite. You can continue walking through the chapters in order, but skipping around is fine too. If youll be mostly using EViews files prepared by others, you might proceed to Chapter 3, Getting the Most from Least Squares, to dive right into regressions; to Chapter 7, Look At Your Data, for both simple and advanced techniques for describing your data, or to Chapter 5, Picture This!, if its graphs and plots youre after. If you like
the more orderly approach, continue on to the next chapter where well start the adventure of setting up your own workfile and entering your own data.