Vous êtes sur la page 1sur 7

E280

March 24, 1999

How to Use EViews (Econometric Views)


EViews is a simple but flexible econometric software package that runs on both Windows machines and Macintoshes. It is primarily designed to work with time series data,1 but can also be used for cross-section and panel data. The primary function of EViews is to enable the user to perform time series regressions and the associated hypothesis tests, diagnostics, and correction procedures. CONTENTS 1. Starting EViews....................................................................................................................1 2. How to get data into EViews ................................................................................................2
Importing Excel and text files using the Clipboard................................................................................ 2 Downloading Data from the Internet for processing with Excel or Eviews ................................................ 3 Retrieving DRI (Data Resources Inc.) data ............................................................................................... 3 Using the IMF Data Bank......................................................................................................................... 3

3. Check to make sure the data in a worksheet looks right.........................................................4 4. Now that you have the data ..................................................................................................4
Generating new variables ......................................................................................................................... 4 To adjust the sample................................................................................................................................. 4 To calculate various statistics (more than you need for E270) ................................................................... 4 To graph variables.................................................................................................................................... 4 To run a regression................................................................................................................................... 4 Running an ARMA model; autoregressive transformations. ..................................................................... 5

5. How to get output from EViews ...........................................................................................5


Copying and pasting into other applications ............................................................................................. 5 To print.................................................................................................................................................... 5 Saving your data in other formats............................................................................................................. 5

6. Some Eviews Output ............................................................................................................5 1. Starting EViews 1. Double-click on the EViews icon to launch the program. 2. Next, create a workfile:. Click on File/New. Select Workfile and click OK. This file will hold all the data for your project. 3. You will be asked to select a periodicity: Annual, Semi-annual, Quarterly, Monthly, Weekly, Daily, or Undated. For example, GDP data for the United States are available quarterly (1/4 year = every 3 months) while unemployment and consumer price data are available monthly. If you are using a mixed set of data, some quarterly and some monthly, you should probably specify quarterly.. The undated option is appropriate for cross-section data, such as data for all 50 states for a particular year 4. Now specify a sample start and end date. For example, if you plan to use a quarterly series that began in the first quarter of 1948 and ended in the fourth quarter of 1998, you would choose quarterly, starting date 1945:1, ending date 2000:4. This will reserve a bit more space than you need, but it will make your graphs look a bit neater than if you started in 1948 and ran to 1995. The dates for monthly data, such as the unemployment rate, are specified
1

The DOS predecessor of EVIEWS was called TSP (Time Series Processor).

How to Use Eviews

page 2

1945:01 and for annual data just 1945 1999. If you choose undated, you only need to indicate the number of observations in the ending date window. 5. Save your workfile by clicking Save As and typing in a filename in the appropriate box. The saved file will have .wf1 extension. Now you are ready to load your data!

Avoid Disaster! Protect your workfile by frequently clicking Save.


2. How to get data into EViews You can (1) key data directly into EViews, (2) load data from the built in DRI database, or (3) Copy/Paste data into EViews from external sources, such as an Excel spreadsheet, a Word file, or a CD-ROM data base. Note: The names of the variables must be legal in EViews (no more than 16 characters; no spaces). Check Name Objects in EViews Help for further information.
Data from a variety of sources can be combined easily into a single workfile so long as they have the same periodicity. If the data are incompatible (e.g., trying to put quarterly data in a weekly file, or weekly data in a quarterly file), there are ways to help EViews convert the periodicity in order to achieve compatibility.

Keying Data Directly into your Workfile (not recommended if you have much data to enter):
Click on Quick/Empty Group. This sets up an empty worksheet. Each column of the worksheet represents a variable. Start by typing the new variable name on top of the column and hit the enter key. Then type in the data, proceeding down the column using the down arrow, and taking care to put the data in at the correct date.

Importing Excel and text files using the Clipboard


EViews recommends that you use the clipboard to copy data from Excel spreadsheets and other sources (e.g. Windows based CD-ROMs). Use EViews Help and search for Clipboard to find out how. Here are the basic steps: 1. Open Excel (or whatever source program you are using). Load the file containing the data, and select the data that you want to transfer. The data must be laid out with the variables in successive columns, names of the variables in the top row of the selected area followed by the observations in successive rows. 2. Next start EViews and create a new workfile (File/New from the main menu), or load an existing workfile (File/Open from the main menu). Select the appropriate frequency and start and end observations (e.g., irregular, 30). Make sure the sample is set to include the same range of observations that you have copied from Excel. 3. Select Quick/Empty Group to open a group spreadsheet window. 4. The spreadsheet should open in edit mode. If it were not in edit mode there would be no white edit box directly under the Menu Bar and you would have to click the Edit +/- button. 5. You must scroll up one row to make room for the series names. To do this, click on the up arrow in the spreadsheet scroll bar. 6. Place the cursor in the upper-left cell, just to the right of the word obs. 7. Then select Edit/Paste from the main menu and your variables will be added to your work file. 8. Save your workfile to the H: drive or a floppy, just in case disaster strikes.

How to Use Eviews

page 3

Downloading Data from the Internet for processing with Excel or Eviews
You cannot directly copy/paste data you found in .HTML files on the Internet, but here is the trick. When the data you want is displayed in Netscape Communicator, click on File/Save as an *.HTML file and save it on your hard disk. Next open the HTML file you have saved with EXCEL. EXCEL will automatically load your data into a table. Clean up the data, if required, and then copy/paste into EViews.

Retrieving DRI (Data Resources Inc.) data EViews comes with a built in database containing more than 5,000 series of macroeconomic and financial variables for the U.S.economy. 1. Determine the code names that DRI uses to identify the particular time series that you need. Examples:
GDP Gross Domestic Product; GDPQ Gross Domestic Product, (1987 dollars); GCQ Personal Consumption Expenditures; (1987 dollars); GGEQ Government Purchases of Goods and Services (1987 dollars); FSPCOM S&P 500 Stock Index, (1941-43=10); FYPR Prime Rate Charged by banks GGFENQ Government Purchase of Goods and Services, National Defense (1987 dollars); PZUNEW Consumer Price Index (1982-84=100); GDPD GDP Implicit Price Deflator (92=100); IPJP Industrial production, Japan; PC6UK Consumer Prices, United Kingdom (1982-84=100, NSA), FPS6WG West Germany Stock Prices (1967=100,NSA)

Note that 1967=100 means that the series is normalized so as to equal 100% in 1967; 1987 dollars is equivalent to 1987=100. NSA means not seasonally adjusted.

To find the data codes for your project, consult the DRI Data Base Manual (a three ring binder, on reserve in Olin).
2. Click on Procs/DRI Basic Economics Database (or click on File/Import/DRI Basic Economics Database in the main menu). Enter into the box the names of the desired variables; e.g., gcq gydq fypr fspcom pzunew Now click OK to insert the variables into your workfile.

(Note that you must use a space (not a coma) to separate the names of the different series). 3. Select View/Display Comments to see a brief description of each variable. Using the IMF Data Bank.
The International Monetary Fund compiles a wonderful data set containing data on a sizable number of variables for more than 130 member nations. 1. The first step is to consult a recent issue of International Financial Statistics, a monthly publication of the International Monetary Fund that is on file in the periodical room. Pick out the data you want (but note only the most recent years are reported in the hard copy publication) and make a note of both the country code (at the top of the page under the country name; e.g. Tanzania is 738) and the time series code (e.g., 99c is exports of goods and services).

2. Get the latest available IMF CD-ROM (e.g. ZZPDL CD-ROM IFS 1998/12) The software is old. (Once you see
this DOS program you will really appreciate Windows!) You will probably need help from one of the TAs or a data lab assistant or someone who has run the program before. Try following the instructions for specifying the time period you want, the countries you want it for, and the variables by entering the appropriate. Here are some tips: You use the arrow keys to get to the option box you wish to specify; then push F2 for a list of the available options; now use the space bar to select (checked) or deselect (not checked) from the list of items.

How to Use Eviews

page 4

Use F3 to get a list of the data you have selected. Then use F5 to export your data to a file for processing with Excel or EViews.

3. Check to make sure the data in a worksheet looks right


Double-click on the desired variable, or to look at two or more variables at one time single-click on the desired variables while holding down the Ctrl key. Then, double-click on one of the variables, and a worksheet of all of the variables will appear. Note that if you only select one series, it will be displayed in five-column rows rather than in a single column. Check the identifying information about the series at the top of the table. Also, check the numbers to verify that they look reasonable and that you do indeed have the right variable.

4. Now that you have the data ...


EViews has numerous built-in functions to help you manipulate and analyze your data.

Generating new variables


Variables can be transformed by clicking on the Genr button and typing the appropriate equation into the Genr box. The usual computer arithmetic symbols are used. Examples: lgdpq = log(gdpq) xsq = x^2 realsp = 100*sp500/cpi In addition, EViews can create new variables that are lead or lag versions of exiting variables. For example: gdplag = gdp(-1) creates a new variable, gdplag, that is the gdp series shifted back one period. This may cause the loss of an observation off the end of the old series. To see how this works, show gdp and gdplag together.

To adjust the sample


Sometimes you will only want to work with a subset of your data. Click on Sample and type the appropriate start and end dates in the box, and/or put any relevant mathematical conditions in the If box.

To calculate various statistics (more than you need for E270)


Choose the variables desired as above by double-clicking or Ctrl-clicking. When comparing different variables, choose the desired statistics by clicking on View/Descriptive, View/Correlations, etc. When focusing on one variable, click View/Histogram and Stats, View/Correlogram, etc.

To graph variables
Double-click on the desired variable/s and then choose View/Line Graph; or View/Graph or View/Multiple Graphs (if you have more than one column of data). The graph/s will appear. Note that one can move the label around by using the click-and-drag function of the mouse. To modify the graph, simply double click on the graph itself. The resultant menu allows one to insert grid lines, modify the print options, or change the scaling. If one has two series, a scatter diagram can be created with the same menu, and a linear regression line can be superimposed on the scatter. To insert text into the graph, click on Add Text to get to the appropriate menu. It is advisable to Name the graph in order to save it. Save the workfile before printing.

To run a regression
Click on Quick/Estimate Equation, and type the desired specification in the box. The specification should include a c for the intercept (constant term) of the regression. Example: gcq c gydq fypr

How to Use Eviews

page 5

regresses consumption on disposable income and the prime interest rate.

Caution: the most common error is to leave out the intercept (The c is essential).
The residuals can be viewed by clicking on View/Actual, Fitted, Residual/Graph. Diagnostic statistics can be computed by clicking on View/Coefficient Tests, Residual Tests, or Stability Tests. The regression may be saved by Naming it, and resaving the workfile.

Running an ARMA model; autoregressive transformations. In order to run ARMA models, you would add the desired autoregressive (AR) and/or moving average terms (MA), with specified lags, in the box, e.g. gcq c gydq fypr ar(1) ar(2) ma(1) The default estimation procedure is OLS. Other estimation procedures can be selected instead by clicking on the appropriate choice, but these can wait until you take Econometrics. 5. How to get output from EViews Now that youve done your thing in EViews, how do you retrieve your results in either computerreadable or printed form? Copying and pasting into other applications
If you want to place your graph or other output into a Word document for a term paper or your senior essay, select what you want, click the Edit/Copy option on the menu bar in order to load the item onto the clipboard. Then switch over to Word, open a document, and paste the clipboard with the paste button (or Ctrl-V on a Windows machine). Or you can paste into Excel.

To print
The quickest way to get output is to use the Print button on the spreadsheet to print out your data. Or you can select File/Print to print out your graph. But for your term papers final draft, its best to Copy/Paste back into Word.

Saving your data in other formats


You can save your data as an Excel spreadsheet file or a text file by going to File/Export/Write TextLotus-Excel. Type a file name with extension .xls if you want the output file to be an Excel spreadsheet; type a file name with extension .txt if you want the output file to be a text file. Then EViews will prompt you for the names of the series to be written to the file. It will also output the names of the series as the first row in the file, and in the case of Excel, it will also output the dates as the first column in the spreadsheet.
96 Economic Pleasure (1-U-Pdot) and Consumer Sentiment 110 100 90 88 80 84 70 80 EP 76 76 78 80 82 84 86 88 90 92 94 96 98 HHSNTR 60 50

6. Some Eviews Output


The statistical output reported here are related to a paper by Mike Lovell and Pao-Lin Tien, Economic Discomfort and Consumer Sentiment

92

How to Use Eviews

page 6

The following 3 series were downloaded from the Data Resources Inc. Data Bank using EViews FILE/IMPORT command: HHSNTR Index, Consumer Sentiment; February 1966 = 100, 78-1 on,. Michigan Survey of Consumer Sentiment PZUNEW Consumer Price Index (82-84=100) LHUR Unemployment Rate, Seasonally Adj The following three variables were created with EViews GENR command: ED=LHUR + PDOT; PDOT=100*(PZUNEW/PZUNEW(-12)-100; Ep=1-LHUR-PDOT The graph was generated using Eviews Quick/Graph command The graph and text output were transferred with Edit/Copy from EViews into WORD with Edit/Paste; some tab changes were required. 1. Table generated with QUICK/GROUP STATISTICS/DESCRIPTIVE STATISTICS
ED Mean 11.82066 Median 10.53309 Maximum 21.98450 Minimum 7.029300 Std. Dev. 3.554284 Skewness 1.125976 Kurtosis 3.309606 Jarque-Bera 50.59499 Probability 0.000000 Observations235 EP 88.17934 89.46691 92.97070 78.01550 3.554284 -1.125976 3.309606 50.59499 0.000000 235 HHSNTR 84.52638 89.40000 107.1000 51.70000 11.89146 -0.638929 2.290320 20.92057 0.000029 235 LHUR 6.717021 6.600000 10.80000 4.800000 1.308767 1.077561 3.932312 53.98890 0.000000 235 PDOT 5.103638 3.925068 14.75644 1.097893 3.223787 1.429415 4.032237 90.45958 0.000000 235

Note: Eviews often gives you more output than you want. You may (or may not) be interested in Skewness, Kurtosis, and the Jarque-Bera test Eviews Help provides precise definitions of such concepts. If you want to transpose this matrix so that there is one variable per row, with the mean, median etc. in columns, load it into Excel. 2. Table generated with QUICK/GROUP STATISTICS/CORRELATIONS
ED EP HHSNTR LHUR PDOT ED 1.000000 -1.000000 -0.790243 0.424896 0.930022 EP -1.000000 1.000000 0.790243 -0.424896 -0.930022 HHSNTR -0.790243 0.790243 1.000000 -0.341102 -0.732780 LHUR 0.424896 -0.424896 -0.341102 1.000000 0.062484 PDOT 0.930022 -0.930022 -0.732780 0.062484 1.000000

Note: Each entry on the table is the correlation coefficient relating the variable in the column to the variable in the row. For example, the table reveals that the correlation between ED (Economic Discomfort) and HHSNTR (Consumer Sentiment) is r = - 0.79. 3. Regression output generated with LS HHSNTR C LHUR PDOT
LS // Dependent Variable is HHSNTR Date: 03/13/98 Time: 13:43 Sample(adjusted): 1978:01 1997:07 Included observations: 235 after adjusting endpoints Variable Coefficient Std. Error t-Statistic Prob. C 116.0666 2.573406 45.10233 0.0000 LHUR -2.693746 0.366245 -7.355028 0.0000 PDOT -2.634644 0.148685 -17.71959 0.0000 R-squared 0.624519 Mean dependent var 84.52638

How to Use Eviews

page 7

Adjusted R-squared 0.621282 S.E. of regression 7.318012 Sum squared resid 12424.37 Log likelihood -799.6705 Durbin-Watson stat 0.280117

S.D. dependent var Akaike info criterion Schwarz criterion F-statistic Prob(F-statistic)

11.89146 3.993361 4.037526 192.9368 0.000000

The above regressions might be reported in a term paper or article as follows (using courier new-10 font makes it easier to format the regression appropriately):
HHSNTR = 116.1 2.69 LHUR 2.67 PDOT + e (2.5) (0.36) (0.26) R 2 = 0.62; DW = 0.28; Se = 7.318

It is often best to present the output of a number of regressions on a single table with one regression in each column.

Vous aimerez peut-être aussi