Você está na página 1de 23

1.

IntroductiontoEVIEWS
1.1EViews
EViews is one of the most popular econometric packages around. As well as containing a hostof uptodate econometric features, it is incredibly easy to use. In additiontothemenudrivenobjectorienteduserinterface,itisalsopossibletowrite simple programs in EViews programming language, without having to invest too mucheffortintheprogramming. Forafullproductdescriptionandoverviewsee http://www.eviews.com/eviews6/eviews6/eviews6.html

1.2EViewsbasics
AssumingthatyoucanopentheprogrambydoubleclickingontheEViewsicon,you willbeconfrontedbythefollowingview

Therearetwoimportantthingstonoteaboutthisview. 1. Thewhitebarbeneaththecommand menu iscalledthecommand line.You caneitherusethecommandlineorthedropdownmenustocarryouttasksin EViews, and as some actions are quite common, and therefore are repeated quiteoften,youmightfinditeasiertotypeashortcommandinthecommand

line. Once you learn the EViews language for these commands, it can actuallybequickerthanusingthemenus. 2. Foradditionalinformation,opentheEViewsprogramandselectHelp/EViews Help Topics and a list of help categories is revealed. The Help system is often more use than the manual because it contains updates to the documentation that were made after the manuals went to press. You can search for everything you want to do in EViews and you will find detailed explanationsandanswers. ThemostimportantobjectinEViewsistheworkfileandyourfirststepinanyproject will be to create a new workfile or to load an existing workfile into memory. Workfiles are the workhorses of EViews. They store your data and results of your analysis. While each workfile will contain several data series, each data series is storedas itsownobject.Forexample,supposeonewishedtocreateanewworkfile withthepotentialtoholdasampleofcrosssectionaldatawith20observationsinthe crosssection. 1) SelectFile/New/WorkfileontheEViewsmainmenubar.Youwillbefaced withthefollowingwindow:

2) Becausethisiscrosssectionaldata,settheWorkfilestructuretype: to Unstructured/Undated.

3) Sincethereare20observationsinthedataset, enterthenumber20intheData Range.(Atthisstage,dontworryabouttheinformationEviewsoffers regardingirregularandundatedpanelsworkfilesthisisformoreadvanced usersofEviews). 4) Youcanalsousethiswindowtonametheworkfileifyouwish.Entermyfirst intheNames/WFfield. ClickOK.EViewswillnowcreate aworkfile,and willdisplaytheworkfilewindowinthemainworkareaoftheEViewsscreen. Theworkfilewindowdisplaystwopairsofnumbers:onefortheRange: of datacontainedintheworkfile,andthesecondforthecurrentworkfile Sample.Boththeworkfilerangeandsamplecanbechangedaftertheworkfile hasbeencreated.Notethatallnewworkfileswillcontaintwoobjects:the coefficientvectornamedcandtheresidualseriesnamedresid(seebelow). 5) Youwillalsonoticetwotabsatthebottomoftheworkfile,onecalled Untitled,andonecalledNewPage. Whenyouaremoreproficientwith EViewsyouwill discoverthatthisisaveryusefulfeature ofEViews6,and youcanfindinformationonusingtheNewPagebysearchingtheHelp menu.However,youcanignoreitfornow.

6) Tosaveyourworkfile,selectSave ontheworkfilemenubarorFile/Save or File/SaveAsonthemainmenubar.File/SaveAswillofferthefollowing option:

Everytimeyousaveaworkfile,youwillbeaskedtospecifywhetheryourequire singleprecisionordoubleprecisionstorage. Essentially,thedifferenceisthatsingle precisionwilluselessspace,butofcourseyourdataissavedwithlessprecision. Compressionoffileswillalsosavespace,butitwillnotbepossibletoopenyourfile witholderversionsofEViews. Atthisstage,youcanjustselectDoublePrecisionandOK.

Youarenowreadytostartenteringdataintotheworkfile. NotethatEViewsallowsfordaily,weekly,monthly,quarterly,semiannual orannual timeseriesdata.Notealsothatifyousimplyenterthestartingyearandtheending yearofyourrange,andspecifywhatkindofregulardatayouaredealingwith(daily, monthly,annualetc.),EViewswillautomaticallystructuretheworkfileforyou.The programwillcreatethelargestpossibleworkfileforyourrange.

Alternatively,youcanspecifytheformatofthedatesasfollows: Annual specifytheyear.(Example:1980&1996). Semiannual youcan specifywhetheritsthefirsthalforsecondhalfofthe year(Example:1980:1&1996:2)

Quarterly specifytheyear,followedbyacolonandthequarternumber. (Example:1980:1&1996:4). Monthly specify theyear,followedbyacolonandthemonthnumber. (Example:1980:1&1996:12). Daily&Weekly thedefaultformatismonth:day:year,andyouwillneedto specifyyourrangeinthisorder.Ifyoufindthisconfusingitisrelativelyeasy tochangetheorderbyusingOptions/Datesand Frequency ConversionandselectDay/Month/Year.

SeeSeeHelp/EviewsHelpTopics/UsersGuide/EViewsFundamentals/Workfile BasicsformoreinformationaboutcreatingandusingworkfilesinEViews.

1.3Datainput
Once you have a workfile opened, you can type data into EViews. Using the menu itemsQuick/EmptyGroup(EditSeries)willgiveyouaspreadsheetwindow.Atthe top of the window you will see an Edit+/ button. This locks or unlocks the spreadsheetforediting.Onceunlockedforeditingyousimplytypeinthedata. AsExceliscommonlyusedfordatastorage,itisusefultoknowhowtoimportdata fromanExcelworksheetintoEViews.Themoststraightforwardwayofdoingthisis usingCopyand Paste.Tobeginwith, youwill beworkingrelatively smalldatasets comprising only a few series and a few observations, so cut and paste will be the fastestwaytoloaddataintoEViews. First step: In Excel copy the data from the spreadsheet into the clipboard (highlightthedatayouwant,rightclickandselectCopy). Second step: In EViews use Quick/Empty Group (Edit Series) place the cursor in the upper left cell and paste the data from the clipboard.EViews will assign default names to the series, usually ser01, ser02 etc. It is advisable to

renametheseries.Thiscanbedonebyreturningtotheworksheetviewandright clickingonser01andselectingRename. Alternativelyyoucanreaddatadirectlyreaddatadirectlyfromfilescreatedbyother programs.Data may be in standard ASCII form orineither Lotus(.WKS,.WK1or .WK3)orExcel(.XLS)spreadsheetformats. Thisisusefulifyouaredealingwitha larger dataset, as it is more difficult to manoeuvre the copy and paste. It is best to become familiar with both methods as your skills will increase every time you use EViews. Firstmakecertainthatyouhaveanopenworkfiletoreceivethecontentsofthedata import. Next, click on Procs/Import/Read TextLotusExcel... You will see a standardFiledialogboxaskingyoutospecifythetypeandnameofthefile.Selecta filetype,navigatetothedirectorycontainingthefile,anddoubleclickonthename. Alternatively, type in the name of the file that you wish to read (with full path information, if appropriate) if possible, EViews will automatically set the file type, otherwise itwilltreatthe fileasan ASCII file.ClickonOpen.EViewswillopen a dialog prompting you for additional information about the import procedure. The dialogwilldiffergreatlydependingonwhetherthesourcefileisaspreadsheetoran ASCIIfile. Example:USMacroeconomicData FindtheEViewsfolderintheBusinessdocumentsdirectory wherewillthefiles be??? UsingExcelopenthefilecalledUSMacroeconomicData.xls.Thisfilenowneedsto beimportedintoEViews.Youwillseethatthisfilecontainsannualdataforanumber ofUSmacroeconomicvariablesfortheperiod1963to1989.Toimportthefilefollow thefollowingsteps. 1. Openanewworkfileandspecifyannualdatawithstartdate1963 and end date 1989. Close the Excel file US Macroeconomic Data.xls

2. Clickon Procs/Import/Read TextLotusExcelandprovide thefilenamedetailsintheusualwaybeforeclickingOpen.Note thatEviewsdoesntlikeitifyoucurrentlyalsohavethefileopen inExcel!

3. At this point you will obtain the Excel Spreadsheet Import dialogbox(shownbelow).Therearenowanumberofimportant bitsofinformationtospecify. a. As the column with Year in it is superfluous information,theupperleftdatacellisspecifiedasB2. b. Make sure the radio button By observation is selected totellEViewsthatthespreadsheetcontainsdataseriesin columns. c. Thereare4serieswhichInameY,P,UandR. 4. ClickOKandthedatashouldthenappearinyourworkfile.Save theworkfileasUSMacroeconomicData.wf1.

Onceyouhaveimportedthedata,itispossibletogostraightintorunningregressions. However, it is useful to go through a few processes to visualise the data before conductinganyanalysis.Thisallowsyoutogetafeelforthedatayouareusing. In addition, the EViews skills you acquire in the following exercise will help you in futuretasks.Itisalwaysusefultoplotyourseriesasagrouptoseewhethertheyare movingtogether.

2.DescribingandVisualisingData
The calculation of economic statistics provides a way to condense and synthesise information on a range of economic variables such as national account variables, wages and prices, interest rates, exchange rates etc. There are two ways to describe data:

1. Graphical plot the data using plots such as line plots, scatterplots, histogramsandplotsoftheempiricaldistributionofthedata. 2. Statisticalcomputedescriptivestatisticsofthedistributionsuchasthemean, variance,skewnessandkurtosisetc.

2.1Transformingandplottingdata
Inanalysinganyeconomicdata,timeseriesorcrosssectionaldata,itisnecessaryto plottheseriessoasto: identifyanyincorrectlyrecordeddatapoints reveal the key characteristics of the data (trends, outliers, seasonality etc.). Insomesituationsitisusefulalsotographoneseriesagainstanother.Thisisknown as a scatter plot. The advantage of this is that it will help to identify the degree of associationbetweentwoeconomicseries. For some problems it is of interest to compare an empirical distribution with a theoreticaldistribution,suchasanormaldistribution.Anempiricaldistributioncanbe constructed by using a histogram. More formal empirical distributions based on nonparametrickernelscanbecomputedinEViews Often it is necessary to transform or filter the data before computing descriptive statisticsorplotting.Anumberofimportantfilteringproceduresarenowdescribed. LogFilter Thissmoothsoutlargemovementsineconomicseries. Yt = LOG ( X t) FirstDifference Thisfilterisoftenusedtoextractthetrendfromeconomicseries. Yt = X t - X t-1 SeasonalDifference Thisisusedtoextracttheseasonalfactorsfromeconomicseries.For example,ifmonthlydata ( Xt) areavailable,thentheappropriate seasonalfilteris Yt = X t - X t-12 MovingAverage Thisfiltersmoothesoutsupposedrandommovementsinaseriessoas tohighlighttheunderlyingtrendsandcycles.Thisfilteriscommonly usedtoidentifybusinesscycleturningpoints.Forexample,a3rdorder movingaverageisgivenby X + X t + Xt+1 Yt = t -1 3 GrowthRates Forcertainsituationsitismoreimportanttocomputethegrowthrate ofaseries.Forexample,inanalyzinginflation,if Xt representsthe

leveloftheCPI,priceinflationiscomputedusingboththelogandfirst differencefilters Yt = LOG ( X t ) - LOG ( X t -1 ) = LOG ( X t / X t-1)

Example:TheAustralianBusinessCycle Opentheworkfilegdp.wf1thatcontainsquarterly,real,seasonallyadjustedGDPfor theperiodSeptember1959toJune1996.Therearetwowaystoimplementthefilters discussedaboveinEViews.ThefirstwayistofollowQuick/GenerateSeriesonthe main menu bar and the second uses the radio button Genr on the menu bar in the workfile.IneithercasetheGenerateSeriesbyEquationdialogueboxwillappearin whichthecommandstofiltertheseriesmaybeentered. Forexample,tocomputetheannualpercentagerateofgrowthofAustralianGDPthe relevantcommandisgivenbelow

Youneedtobealittlecarefultoensurethatyougetallthesyntaxcorrect.Notethat GDP(4) is the EViews syntax for GDPt-4. Now compute the Australian business cyclebysmoothingtheannualpercentagegrowthofrealGDPusingaseventhorder movingaverage.OnceagainusingGenr,theappropriatedialogueboxwillbe

10

NowplotGandBCYCLEonthesamegraph.Todothis,highlightthebothvariables byclickingonthemandholdingdowntheCTRLkey.Nowplacethecursoranywhere in the highlighted area as shown and right click. You will receive some drop down menusfromwhichyouchooseOpen/AsGroup.

Atthis stage you should obtain the following spreadsheet view of the two variables openedasagroup.

11

NotethattheNAobservationsarethoselostindoingthetransformationsrequiredby the filters (EViews automatically adjusts the sample size when generating G and BCYCLE).InordertoplottheseriesonthesamegraphclickontheViewmenuand then Graph and Line on the subsequent drop down menus. The end result is the followinggraphoftheAustralianbusinesscycle.

12

12

8 1960 1965 1970 1975 1980 1985 1990 1995 G BCYCLE

2.2DescriptiveStatistics
Givensetsoftimeseriesorcrosssectiondataitiscustomarytosummarizeits characteristicsbyconsidering(i)ameasureofthecentraltendencyor location ofthe data,(ii)ameasureofthespread,dispersionorscaleofthedata,and(iii)measuresof associationbetweendifferentsetsofdata. 1.Mean Themeanofthedistributionrepresentstheaveragevalueofavariable.Foratime series,themeaniscomputedas 1 T X = Xt T t=1 Twoothercommonlyused measuresofdata locationarethemedianandthemode. The median of the data is the value of the middle observation (or average of the middletwoifthenumberofobservationsiseven)afterthevalueshavebeenordered. Themodeisthemostfrequentlyoccurringvalue,ifavariableisdiscrete. 2.StandardDeviationandVariance Thestandarddeviationmeasuresthespreadof { X 1 , X 2,...,X T} arounditsmean X . It iscomputedas

s=
Thevarianceiscomputedas

1 T 2 ( X t - X) T t=1
1 T ( X t - X)2 T t=1

s2 =

13

3.CoefficientofVariation Themagnitudeofthevaluesofthevariablesandunitsofmeasurementaffectthe statisticalmeasurementofsamplevariability.Inotherwords,comparingsample variabilitybasedonsamplevarianceforrandomvariableswithvastlydifferent magnitudesormeasurementunitsisafutileexercise.Thecoefficientofvariationis thestandarddeviationasapercentageofthesamplemeanandisgivenby s CV = 100 X Dividingthestandarddeviationbythesamplemeanaccountsforthesizeofthe variablesvaluesandremovestheeffectofunitsofmeasurement. 4.Skewness For distributions that are symmetric such as the normal distribution, there is no skewness. For some distributions however, high (low) values can be more common thanlow(high)values.Inthiscasethedistributionisskewed.Skewnessiscomputed as 1 T X t - X S = T t=1 s
3

5.Kurtosis Some economic series have extreme observations in both tails of the distributions whicharenotconsistentwiththeassumptionofnormality.Thisfatnessinthetails ofthedistributionisknownasexcesskurtosis.Kurtosisiscomputedas 1 T X t - X K = T t=1 s
4

Example:ComparingthevariabilityofUSGDPandinterestrates LoadtheworkfileUSMacroeconomicData.wf1thatyoucreatedearlierfromthe Excelfile.Openthevariablenamed,R,theprimeratebydoubleclickingonitinthe workfilewindow.Youshouldnowhaveaspreadsheetviewofthevariable.

14

Alltherelevantdescriptivestatisticsforthisvariablearenoweasilycomputed.Click ontheViewmenuinthiswindowandonthedropdownmenusclickon Descriptive Stats/HistogramandStats toobtain

Series:R Sample19631989 Observations27 Mean Median Maximum Minimum Std.Dev. Skewness Kurtosis JarqueBera Probability
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

8.833704 8.030000 18.87000 4.500000 3.585711 1.012432 3.659293 5.101584 0.078020

IfyounowcomputethesamestatisticsforGNPyouwillfindthatthemeanand standarddeviationofthedataare2915.31and631.36respectively.Comparingthe variabilityofGNPandRbasedonsamplevariationisfutilegiventheirdiffering magnitudes.Thecoefficientofvariationmaynowbecomputedtoprovidesucha comparison.Inordertodothiscomputationyouwillneedtotypethefollowing instructionsinthecommandline:


scalarcv_r=(@stdev(r)/@mean(r))*100 scalarcv_y=(@stdev(y)/@mean(y))*100

15

ThescalarinstructiontellsEViewsthatwearenotgeneratingaseriesbutrathera singlevalueandwethenusethebuiltinEViewscommands@stdevand@meanto computethecoefficientofvariation.Youwillnoticethatifsuccessfullycreatedthe scalariconwith thenameyouhavegivenwillappearintheworkfile!Youwillalso getalittlemessageinthebottomlefthandcornertellingyouthevariablehasbeen createdsuccessfully.NotealsothattodisplaythevalueofCV_RandCV_Ydouble clickontheiriconsandthevaluewillbedisplayedinthebottomlefthandcorneras well. InthiscaseCV_R=40.59%andCV_Y=21.66%.Itiscleartheprimeratehasa largercoefficientofvariationaboutitssamplemeandespitethefactthat s Y >s R .

6.Covariance Thecovarianceisageneralisationofthevariancemeasure.Itmeasuresthestrengthof theinteractionbetweentwoseries.If { X 1 , X 2,...,X T} and {Y1 , Y2,...,YT} representtwo timeseries,thecovarianceiscomputedas 1 T s XY = ( X t - X )(Yt - Y) T t=1 Apositive(negative) valueshowsthat Xt and Yt are positively(negatively) related. Azerovalueshowsthat Xt and Yt areunrelated. 7.Correlation

16

The correlation coefficient is derived by rescaling the covariance. The advantage of thisrescalingisthatitprovidesadimensionlessquantitywhichisthusunaffectedby unitsofmeasurement.Thecorrelationcoefficientisestimatedas r XY =


T t =1

t=1

( X t - X )(Yt - Y)
T

2 ( X t - X )2 (Y - Y ) t=1 t

Thecorrelationcoefficient,aswiththecovariance,measuresthestrengthordegreeof linear association between two variables. It has the property that it falls between1 and1: rXY =1,Perfectpositiveassociation 0 < rXY <1,Imperfectpositiveassociation rXY =0,Noassociation -1 < rXY <0,Imperfectnegativeassociation rXY = - 1,Perfectnegativeassociation

Example:Commodityreturns Loadtheworkfilecommod.wf1thatcontainsmonthlydataonthepricesofthe commoditiescopper,lead,silverandgold.Forcopper,leadandsilvercomputethe returnstocommodities(expressedasapercentage)asfollowsR_X=100*LOG(X/X( 1)) or R_X=100*DLOG(X) usingthebuiltinEViewsfunctionDLOG.Openthe threeseriesyouhavecreatedasaGroup(clickoneachseriesinworkfileviewwhile holdingcontrol,nowplacethecursoranywhereinthehighlightedareaasshownand rightclick)andcomputethedescriptivestatisticsusingindividualsamples.You shouldobtainthefollowingoutput.

AgainusingtheViewmenuyoucancomputethecovarianceandcorrelationmatrices (ineachcaseyouwill needtoselectView/CovarianceAnalysisandthenselector deselecteitherCovarianceorCorrelation,dependingonwhichmatrix outputyou want).

17

Inthecaseofthecorrelationmatrixyoushouldobtain

indicatingahighpositivecorrelationbetweenthereturnstoleadandcopper.Away ofvisualisingcovarianceistouseascatterplot.OntheViewmenu,clickon Graph/Scatter andthenontherighthandsideof thedialogbox,selectScatterplot Matrixfromthedropdownmenu. TheFitlinesoptionwillallowyoutodrawregressionlinesinthescatterplots (howeveryouarenotuptorunningregressionsyet,seesection.).TheAxis bordersoptionswillenableyoutoshowhistogramsofeachofthevariablesonthe bordersofthescatterplots.Youcanexperimentwiththesefunctions,howeverthe mostimportantoutcomeisthatyoucanvisualisetherelationshipsofprimaryconcern, andthatisthecorrelationbetweenthevariablesasseenbelow.

18

8 4 R_COPPER R_LEAD R_SILVER 0 4 8 12 10 5 0 5 10 15 10

10 12 8 4 0 4 8 20 10 0 10 10 5 0 R_SILVER 5 10

R_COPPER

R_LEAD

Thestrongpositiverelationshipbetweencopperandleadreturnsisquiteevident. 19

Nowthatyouunderstandsomeofthekeycharacteristicsofyourdata,youcanbegin runningregressions.

1.Introductionto LinearRegression
Linearregressionestimatesarelationshipinapopulationusingaselectionof data. Modelspecification Manyeconomictheoriescanberepresentedbytherelationshipbetween Y , the dependentvariable,andX 1 to X K , asetofindependent,orexplanatoryvariables. Assumingalinearrelationship,thelinearregressionmodelis Yt = b 0 + b1 X 1,t + b 2 X 2,t + ... + b K X K ,t +ut wherethesampleperiodis t = 1, 2,..., T , and bk , k = 1, 2,..., K , aretheunknown populationcoefficients.Thedisturbancetermisgivenby u t whichcanarisefrom measurementerrorin Yt orfromerrorsinthespecificationoftherelationshipbetween Yt andthe Xt s.Theexpectedvalue(mean)of Yt isgivenby E (Yt )= b 0 + b1 X 1,t + b 2 X 2,t + ... +b K X K ,t

YouwillusethesameequationforminEViewswhenrunningregressionstoexamine therelationshipbetweenthedependentvariable(Y)andtheindependentvariables (Xs). Assumptions Thedisturbancetermhaszeromean. Thedisturbancevarianceisconstantforallobservations(Homoskedastic). Thedisturbancescorrespondingtodifferentobservationshavezerocorrelation(No autocorrelation). Xt isnonstochastic,thatis,itistakenasgiven. Yt isstationary. Thedisturbancesareuncorrelatedwiththeexplanatoryvariables. Thereisnoperfectlinearrelationshipbetweentheexplanatoryvariables,(no multicollinearity). Thedisturbancesarenormallydistributed.

Example:CaliforniaSchoolDistrictsDatain1998 The workfile california.wf1 contains crosssectional data for 420 school districts in California.Thedatasetcontainsmeasurementsofseveraldifferentvariablesforeach district.Theseare:

20

AVGINC =districtaverageincome(in$1,000s) CALW_PCT =%qualifyingforCalWorks(apublicassistanceprogram) COMP_STU =computersperstudent(=COMPUTER/ENROL_TOT) COMPUTER =numberofcomputers EL_PCT =%ofEnglishlearners ENROL_TOT=total 21nrolment EXPN_STU =expendituresperstudent($s) MATH_SCR =averagemathsscore MEAL_PCT =%qualifyingforreducedpricelunch READ_SCR =averagereadingscore STR =studentteacherratio TEACHERS =numberofteachers TESTSCR =averageofmathsandreadingtestscores AsafirstexampleofdoingamultipleregressioninEviewsconsiderregressing averagetestscores(thedependentvariable)onthestudentteacherratioandthe percentageofEnglishlearnersintheschooldistrict(theindependentvariables). UsingtheQuick/EstimateEquationoptiononthemainmenubarwillyieldthe followingdialoguebox

The variablesareenteredasalist.This formatfollowstheregressionequationat thetopofthepage.Thefirstvariableistestscr,whichisthedependentvariable(or theY),followedbytheconstanttermc,andthetwoindependentvariables(orthe Xs). Theoutputobtainedis:

21

Rather than typing out each of the variable names individually (which can become timeconsuming),youcanusethecursor toselectthevariablesrequiredforanalysis. Clickonthevariablesrequired,stillretainingtheorderoftheregressionequation,i.e. dependentvariablefirst,followedbyindependentvariables. Clickonthedependent variable first, then hold CTRL and click on the independent variables. Hold the cursoroverthe blue highlightedareaandrightclicktofollowtheOpen/asEquation path.Clickon asEquationandEviewswill insertthevariables inorder,withthe cconstantattheendoftheequation.

22

Note:Ifyouusethismethod,youwillnothavetospecifythecconstant.Eviews willinsertitautomaticallyintheregression.

You can see that the equation from using the list method and the equation from selectingthevariablesarethesame. Theregressionoutputisalsothesame.

Nowthatyoucanobtainregressionoutputs, youcanlearntointerpretthemcorrectly, andyourlifebeginstogetreallyinteresting.

23

Você também pode gostar