0% found this document useful (0 votes)
64 views22 pages

EViews Illustrated Chapter 1

Uploaded by

wertz
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views22 pages

EViews Illustrated Chapter 1

Uploaded by

wertz
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

EViews Illustrated

for Version 7

Richard Startz University of Washington

EViews Illustrated for Version 7


Copyright 2007, 2009 Quantitative Micro Software, LLC All Rights Reserved Printed in the United States of America

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

Chapter 1. A Quick Walk Through


You and I are going to start our conversation by taking a quick walk through some of EViews most used features. To have a concrete example to work through, were going to take a look at the volume of trade on the New York Stock Exchange. Well view the data as a set of numbers on a spreadsheet and as a graph over time. Well look at summary statistics such as mean and median together with a histogram. Then well build a simple regression model and use it for forecasting.

Workfile: The Basic EViews Document


Start up a word processor, and youre handed a blank page to type on. Start up a spreadsheet program, and a grid of empty rows and columns is provided. Most programs hand you a blank document of one sort or another. When you fire up EViews no documentjust an empty window with a friendly Welcome to EViews message at the bottom. Because there arent any visual clues on the opening screen, setting up a new document in EViews sometimes bewilders the new user. While word processor documents can start life as a generic blank page, EViews documentscalled workfilesinclude information about the structure of your data and therefore are never generic. Consequently, creating an EViews workfile and entering data takes a couple of minutes, or least a couple of seconds, of explanation. In the next chapter well go through all the required steps to set up a workfile from scratch. Being impatient to get started, lets take the quick solution and load an existing workfile. If youre working on the computer while reading, you may want to load the workfile nysevolume.wf1 using the menu steps File/Open/EViews Workfile as pictured on the next page.

4Chapter 1. A Quick Walk Through

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.

Viewing an individual series5

Viewing an individual series


If you double-click on the series VOLUME in the workfile window youll get a first peek at the data. Right now were looking at the spreadsheet view of the series VOLUME. The spreadsheet view shows the numbers stored in the series. On average in the first quarter of 1888, 159,006 shares were traded on the NYSE. (The numbers for VOLUME were recorded in millions.) Interesting, but perhaps a little outdated for understanding todays market? Scroll down to the bottom of the window to see the latest datum in the series. 1.67 billion shares were traded on an average day in the first quarter of 2004. Quite a change! The more ways we can view our data the better. EViews provides a collection of Views for each type of object that can appear in a workfile. (Object is a computer science buzz word meaning thingie.) The figures above are examples of the spreadsheet view, which lets us see the number for VOLUME at each date. Another way to think about data is by looking at summary statistics. In fact, some kind of summary statistic is pretty much necessary in this kind of situation; we cant hope to learn much from staring at raw data when we have 400 plus numbers. To look at summary statistics for a series press the button and choose Descriptive Statistics & Tests/Histogram and Stats. Here, we see a histogram, which describes how often different values of VOLUME

6Chapter 1. A Quick Walk Through

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!

Looking at different samples


Weve learned that in the early 21st century NYSE volume is many orders of magnitude greater than it was at the close of the 19th. In retrospect, the picture isnt surprising given how much the economy has grown over this period. Trading volume has grown enormously over more than a century; its grown so much, in fact, that numbers from the early years are barely visible on the graph. Lets try a couple of different approaches to getting a clearer picture. As a first pass, well look at only the last three years or so of data. To limit what we see to this period, we need to change the sample.

Looking at different samples7

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.

8Chapter 1. A Quick Walk Through

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.

Generating a new series


Lets turn to another approach to thinking about trading volume. Our first line graph (before we shortened the sample) presented a picture which looks a lot like exponential growth over time. A standard trick for dealing with exponential growth is to look at the logarithm of a variable, gt relying on the identity y = e log y = gt . In order to look at the trend in the log instead of in the level, well create a new variable named LOGVOL which equals the log of VOLUME. This can be done either with a dialog or by typing a command. Well do the former first. Choose the menu item Quick/Generate Series to bring up a dialog box. In the upper field, type logvol=log(volume). Notice that in the lower field the sample is still set to use only the 21st century part of our data. This matters, as well see in a moment. The workfile window now has a new object, .

Generating a new series9

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.

10Chapter 1. A Quick Walk Through

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.)

Looking at a pair of series together11

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.

Looking at a pair of series together


Our line graph goes quite far in giving us a qualitative understanding of the behavior of volume over time. For a quantitative understanding, wed like to put some numbers to the upward trending picture of LOGVOL. If we have a variable t representing time (0, 1, 2, 3), then we can represent the idea of an upward trend with the algebraic model:

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

12Chapter 1. A Quick Walk Through

@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.

Estimating your first regression in EViews13

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.

Estimating your first regression in EViews


The line on the scatter diagram is called a regression line. Obviously the computer knew the parameters a and b when it drew the line, so backing the parameters out by eye may bring back fond memories, but otherwise is unnecessarily convoluted. Instead, we turn now to regression analysis, the most important tool of econometrics. You can run a regression either by using a menu and dialog or by typing a command. Lets try both, starting with the menu and dialog method. Pick the menu item Quick/Estimate Equation at the top of the EViews window. Then in the upper field type logvol c t. Alternatively, type in the EViews command pane:
ls logvol c t

as shown below.

14Chapter 1. A Quick Walk Through

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 .

Estimating your first regression in EViews15

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!

Weve estimated an equation explaining LOGVOL that reads:

LOGVOL = 2.629649 + 0.017278t


Having seen the picture of the scatter diagram on page 13, we know this line does a decent job of summarizing log ( volume ) over more than a century. On the other hand, its not true that in each and every quarter LOGVOL equals 2.629649 + 0.017278t , which is what the equation suggests. In some quarters volume was higher and in some the volume was lower. In regression analysis the amount by which the right-hand side of the equation misses the dependent variable is called the residual. Calling the residual e (e stands for error) we can write an equation that really is valid in each and every quarter:

LOGVOL = 2.629649 + 0.017278t + e


Since the residual is the part of the equation thats left over after weve explained as much as possible with the right-hand side variables, one approach to getting a better fitting equation is to look for patterns in the residuals. EViews provides several handy tools for this task which well talk about later in the book. Lets do something really easy to start the exploration.

16Chapter 1. A Quick Walk Through

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

Estimating your first regression in EViews17

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.

EViews provides estimates for all three coefficients, a , b 1 , and b 2 .


Has adding t to the equation given a better fit? Lets take a look at the residuals for this new equation. Click View/Actual, Fitted, Residual/Actual, Fitted, Residual Graph again. The fitted line now does a much nicer job of matching the long run characteristics of log ( volume ). In particular, the residuals over the last several decades are now flat rather than trending strongly upward. This new equation is noticeably better at fitting recent data.
2

18Chapter 1. A Quick Walk Through

Saving your work


Quite satisfactory, but this is getting to be thirsty work. Before we take a break, lets save our equation in the workfile. Hit the button on the equation window. In the upper field type a meaningful name.

Hint: Spaces arent allowed when naming an object in EViews.

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!

Saving your work19

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.

20Chapter 1. A Quick Walk Through

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

22Chapter 1. A Quick Walk Through

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.

Now its time to take a break for real.

You might also like