Getting Started in Eviews 1 Basic Info Eviews is a powerful statistical ...

166 downloads 69 Views 33KB Size Report
The first is that Eviews stores data series as variables and other output (like graphs .... 5. 10. 1991. 1992. 1993. 1994. 1995. EXXON. -10. -5. 0. 5. 10. 15. 1991.
Management 468 © Peter K. Schott

Getting Started in Eviews 1 Basic Info Eviews is a powerful statistical package that has at least two major advantages over spreadsheet packages like Excel. The first is that Eviews stores data series as variables and other output (like graphs and tables) as named objects, which allows them to be manipulated and updated much more easily than columns of numbers or pictures sitting on top of a spreadsheet. As a result, the cumbersome action of highlighting and re-highlighting columns necessary to perform basic tasks in a program like Excel is unnecessary in Eviews. The second advantage is that Eviews offers a much broader range of statistical functions, and is particularly well-suited for forecasting. You will learn much more about this particular feature of Eviews during Management 468. To get you started, this handout describes how to perform several basic functions in Eviews using the stock return and January effect data you are currently using in Management 463. The Eviews workfiles containing these data are stock.wf1 and january.wf1, respectively. I have also created a workfile named predict.wf1 which contains the data for predicting housing prices that you will use in an upcoming Mangament 463 homework assignment. All of these files are located in the STUDENT\PSCHOTT directory of the INSTRUCT_INSTRUCT.INSTRUCT STUDENT drive (i.e. I:\STUDENT\PSCHOTT\stock.wf1). NOTE: An important rule of thumb in Eviews, as in most other types of computer software, is that if you click on enough buttons or objects, what you want to happen eventually will happen. My advice is to save your files regularly, adopt a playful attitude and share the shortcuts you learn with others: you will be amazed at the sophisticated output you can generate!

2 How Do I Load an Eviews Workfile? To open an Eviews workfile, left click on the FILE menu of the Eviews title bar (i.e. the bar that runs across the top of the screen) and select OPEN. A menu will pop up, allowing you to search your hard drive for the Eviews workfile you would like to open. (Note that all Eviews workfiles end in the extension wf1.) Once you have found the file, highlight it and click the OK button to the right of the popup menu. This will cause the chosen workfile window to pop open. This window contains a list of all objects (i.e. data series, graphs, regression equations, etc) that have been stored in the workfile. These objects are sorted alphabetically. NOTE: If you wish to change the Eviews default directory (i.e. the one that Eviews goes to first when you choose to OPEN an existing file), just click the small box in the upper right hand corner of the OPEN FILE window after you have entered the desired directory. Changing the default directory to the one where you store most of your Eviews workfiles eliminates the hassle of hunting down these files each time you use the program. NOTE: All objects in the workfile are coded by an small icon to the left of their names. Data series have an icon that looks like:

,

Management 468 © Peter K. Schott

while frozen graphs and regression equations (described below), for example, have the respective icons

and

.

3 How Can I Examine the Data Series in a Workfile? To view all of the data series contained in the workfile in spreadsheet format, left click on one of the data series you wish to see and then and then right click on all of the others one at a time to highlight them sequentially. When you are done right clicking, all of the series you wish to examine should be highlighted in blue. Once all of the series are highlighted, double left click on any of the highlighted area and a small menu will pop up. Select OPEN GROUP and a window containing all of the data in spreadsheet format (i.e. the whole group) will open. This view of the data looks like a typical Excel spreadsheet. To see different views of the data (e.g. summary statistics, correlations, graphs, etc.), play around with the options under the VIEW button on the group title bar. Some of these views are discussed below. NOTE: As in Excel, the data series in this window are grouped by columns, with the leftmost column containing an index. For time series data, this index will be a sequence of dates. In the stock return file, stock.wf1, for example, this index runs from 1950 to 1997 by year, whereas in the january.wf1 file the index runs from the first month of 1991 to the twelfth month of 1995 (i.e. 1991:1 through 1995.12). As noted below, you can use this data index to restrict the sample when performing certain functions. For example, it is possible to run a regression of the January effect using only the first two years of the data by restricting the sample to 1991.1 through 1992.12. 4 How Can I Make a Graph? Any data series or group of data series in Eviews can be graphed quite easily. For a single series, just double left click on the series to open it up. Then click on the VIEW button on the title bar of the window that pops up and choose GRAPH. To change the attributes of the graph, double left click anywhere on the graph. To graph a group of series, just highlight each of the variables in the group as in section 3 above, double click on the highlighted area, select OPEN GROUP, click on the VIEW command in the upper right hand corner of this spreadsheet window that pops open, and choose either GRAPH or MULTIPLE GRAPHS. A singe graph of ATT, Exxon, McDonalds, SP500 and Tandem returns, for example, looks like the following 40 30 20 10 0 -10 -20 -30 1991

1992

1993

ATT EXXON MCDONALDS

2

1994

1995

SP500 TANDEM

Management 468 © Peter K. Schott

A multiple graph of the same data series, on the other hand, looks like: 20

10

15 5

10 5

0 0 -5

-5

-10 -15

-10 1991

1992

1993

1994

1995

1991

1992

ATT

1993

1994

1995

EXXON

15

15

10

10

5 5 0 0

-5 -10

-5 1991

1992

1993

1994

1995

1991

1992

MCDONALDS

1993

1994

1995

SP500

40 30 20 10 0 -10 -20 -30 1991

1992

1993

1994

1995

TANDEM

To play around with the graph settings, just double click on any of the graphs and a menu of GRAPH OPTIONS will appear. These options allow you, for example, to view two series as a scatterplot rather than as a line graph. NOTE: The order in which you highlight the series determines the order in which they are graphed. Thus, if you want a scatterplot of the variable exxon versus the variable sp500, first highlight exxon, then sp500. After selecting OPEN GROUP, VIEW and GRAPH as noted above, double left click on the line graph that pops up to get into the GRAPH OPTIONS menu. On this menu, select the SCATTER graph type in the upper left hand corner. If you wish, you can also check the box in the lower right hand corner to add a regression line to the scatterplot. NOTE: If you wish to keep a graph for later use, click the NAME button on the graph window’s title bar and type in a name for the graph. If you wish to annotate or decorate the graph, choose the FREEZE option at the top of the graph and then select a NAME for the window containing the frozen graph that pops up. Note that once either a graph window or a frozen graph has been named, it will now appear in the list of alphabetical objects contained in the workfile. The difference between a graph and a frozen graph is that former can be manipulated and is updated automatically, whereas the latter is just a snapshot of what the graph looks like the moment you “froze” it. Also, freezing a graph allows you to add titles and shading. 5 How Can I Estimate a Regression? To estimate a regression, click on the QUICK menu of the Eviews title bar and choose ESTIMATE EQUATION. A regression window will pop up. To run a regression of Exxon stock returns on a constant and the S&P 500 return, for example, type exxon c sp500 into the box. Note that the c stands for constant, and that this variable c is listed as one of the objects in the workfile. Though ordinary least squares (OLS) is the default option for regressions, Eviews is quite powerful and allows you to choose more sophisticated techniques. These techniques are listed on the 3

Management 468 © Peter K. Schott

bottom of the regression window. In addition, you can restrict the sample of the observations by altering the dates in the box at the bottom of the regression window. If you wanted to estimate the above regression on just the first two years of the data, you would replace what is in the sample window when it pops up with 1991.1 1992.12 This would tell Eviews to start with the 1991.1 observation and include all observations up to 1992.12. To run the regression, click the OK button to the right of the regression window and the regression results will pop up in a new window. If you would like to save this estimated regression, just click NAME on the regression window title bar and type in a name. It will then be listed as one of the contents of the workfile. NOTE: There are lots of things you can do with the regression once it is run. It is relatively easy, for example, to re-run it with a different mix of independent variables. Just click the ESTIMATE button on the regression window title bar and the regression window will pop up with the regression you just ran already inside it and ready to modify. In this window, for example, you can erase one of the variable names and type in another. To explore the other things you can do, such as see a plot of the residuals, play with some of the other buttons on the title bar. NOTE: If you restrict the sample of observations when performing a particular function, such as estimating a regression, you may need to switch it back when you move on to other tasks. Always be sure to check what is entered into the sample sub-menu to make sure you are getting the results you desire. 6 How Can I Create a Correlation Table? To view a correlation table for a group of series, just highlight the group (see section 3), double click on the highlighted area, select OPEN GROUP, click on the VIEW command on the group title bar and choose CORRELATIONS. To save this correlation table, just click NAME and type in a name for it. 7 How Can I Create a Forecast? Once a regression has been estimated, it can be used to forecast. For example, from the data contained in january.wf1, we know that the January 1997 return is 6.3%. To estimate the 1997 annual return and a confidence interval around it using this information, first run the regression year_chng c jan_chng. Next click the FORECAST button on the regression title bar and the forecast window will pop up. To generate the forecast, you need to enter variable names which Eviews will use to store both the forecasted return and the standard error of that forecast. To keep things simple, suppose we pick the names forecast and forecast_std_err for the forecasted annual S&P return and the forecast's standard error. Since we only want the forecast for 1997, we need to restrict the sample in the lower window to 1997 1997. This tells Eviews to start the forecast in 1997 and end it in 1997. (We can't forecast any further into the future in this case because we don't know the January returns for 1998 and beyond.) For now don’t worry about the other options in the forecast menu: you’ll learn more about them in Management 468.

4

Management 468 © Peter K. Schott

When all of the information has been entered, click OK. Eviews will perform the forecast and store the results in the variables forecast and forecast_std_err. If you examine the forecast series, you will see that Eviews has stored the actual data in years 1950 through 1996, and the forecast in 1997. If you check the forecast_std_err variable, you’ll see there is only a single entry for 1997. This entry is the standard error of the 1997 forecast and can be used to construct a confidence interval as you’ve learned in class. See the next section for an easy way to calculate a confidence interval using Eviews.

8 How Can I Generate a New Variable Based on Existing Variables? To generate a new data series using existing ones, click the GENR button on the workfile title bar. A window will pop open and allow you to enter an equation for the new variable. To create the upper bound of a 95% confidence interval around forecasted 1997 S&P 500 growth, for example, type upper_bound = forecast + 1.96*forecast_std_err and hit the OK button. In this definition, upper_bound is the variable you are creating, forecast is the 1997 forecasted S&P 500 return and forecast_std_err is the standard error of this forecast. Note that the GENR window also allows you to restrict the sample of the new variable. However, in this case, since we only have forecast_std_err data for 1997, upper_bound will only be calculated for that year. To calculate the lower bound of the 95% confidence interval, just generate a new variable: lower_bound = forecast - 1.96*forecast_std_err 9 How Do I Enter Data Into Eviews? There are two types of datasets as far as Eviews is concerned: time series data (each observation occurs at a specific date) and irregular data. The data contained in stock.wf1 is an example of the former, while the data in predict.wf1 is an example of the latter. As will become clearer below, you will be prompted to choose one of these types when transferring data from Excel to Eviews. To transfer data, open both programs. If the data are time series (i.e. annual stock returns) note the dates of the beginning and ending observations. (For the stock.xls data, the first observation is 1950 and the last is 1996.) If the data are irregular, count how many rows, excluding column titles, are in the dataset to determine the number of observations. (There are 25 observations in the predict.xls file.) In Eviews, click NEW…WORKFILE under FILE on the Eviews title bar. A window will pop open asking you to describe the nature of the data. If the data are time series, click the appropriate time interval and fill in the beginning and ending dates in the two fields at the bottom of the window. For the stock.xls file, for example, click ANNUAL and fill in 1950 in the first field and 1996 in the second field. If the data are irregular, click UNDATED OR IRREGULAR and fill in 1 in the first field and the total number of observations in the second. After the information is filled in, click OK. A workfile window containing two series, c and resid, will pop open. Return to Excel and highlight all columns of the data including the column titles and then click COPY under EDIT on the Excel title bar. Return to Eviews and click EMPTY GROUP (EDIT SERIES) under QUICK on the EVIEWS title bar. This will cause a blank spreadsheet to pop open. Note that the index you specified earlier will run along the left edge of the spreadsheet. To paste the data into Eviews, move the cursor up one cell so that it is in the OBS row of the first column. Then click PASTE under EDIT on the Eviews titlebar. Check to make sure that the rows of data are lined up correctly with their date or observation number. Also check to make sure the column headings were accepted. If not, it is likely due

5

Management 468 © Peter K. Schott

to illegal characters or spacing, so just type in an acceptable name. Once everything looks ok, collapse the window. You should see that the names of all of the series you pasted are now listed alphabetically in the workfile window.

6