E Views Guide
E Views Guide
D. Markovic
A uide to !"ie#s
Based on a Practical Guide by R. R. Johnson Professor of Economics, The University of San Die o
A $uide to !"ie#s
&
%S &''&(&'')
%S &''&(&'')
A $uide to !"ie#s
ontents
1. An Overview of Regression Analysis.............................................................................................................4 Creating an EViews workfile..............................................................................................................4 Entering data into an EViews workfile...............................................................................................5 Importing data from a spreadsheet......................................................................................................5 Generating new variables in EViews..................................................................................................6 Creating a group in EViews................................................................................................................6 Running a simple regression............................................................................................................... 2. Displaying numerical and graphical results of a Regression Analysis.........................................................9 !ispla"ing the des#riptive statisti#s for a group of variables..............................................................$ !ispla"ing the simple #orrelation #oeffi#ients between all pairs of variables in a group.................%& Running a simple regression ............................................................................................................%% !o#umenting the results....................................................................................................................%% !ispla"ing the table and a graph of the a#tual' fitted and residuals for a regression........................%( . !ypothesis testing........................................................................................................................................1 Cal#ulating #riti#al t values and appl"ing the de#ision rule..............................................................%) Cal#ulating #onfiden#e intervals.......................................................................................................%4 *erforming the t+test of the simple #orrelation #oeffi#ient ...............................................................%4 *erforming the ,+test of overall signifi#an#e....................................................................................%5 4. Autocorrelation " !eteroscedasticity........................................................................................................1# Creating a residual series from a regression model...........................................................................%6 *lotting the error term to dete#t auto#orrelation................................................................................%6 Estimation of the first order auto#orrelation #oeffi#ient ..................................................................% Graphing to dete#t heteros#edasti#it"................................................................................................%.esting for heteros#edasti#it"+/hite0s test.......................................................................................%/eighted least s1uares......................................................................................................................%$ 2eteros#edasti#it" Corre#ted 3tandard Errors...................................................................................(& $. %imultaneous &'uations..............................................................................................................................21
%S &''&(&'')
A $uide to !"ie#s
1.
Data set+ /*e -er ca-ita dis-osable income in 0ear t 11111.. data listing Annual data on -er ca-ita consum-tion of beef /*e -rice of beef in 0ear t 11 file:beef.xls
%S &''&(&'')
A $uide to !"ie#s
%S &''&(&'')
A $uide to !"ie#s
,lick OK and t*e ne# variable named I4 #ill a--ear in t*e #orkfile #indo#.
/o save t*e c*an es in 0our #orkfile2 click Sa%e on t*e #orkfile menu bar.
%S &''&(&'')
A $uide to !"ie#s
Select Ob ect!/NewOb ect/Equation from t*e #orkfile menu. !nter t*e name of t*e eHuation7 eq/ in t*e Name for :b<ect7#indo# and click OK. !nter t*e de-endant variable ?B7 consum-tion of beef@2 t*e constant? , @ 2 and t*e inde-endent variables ?G7-rice of beef2 I47 t*e income@ in t*e Equation !pecification, It is im-ortant to enter t*e de-endant variable firstI Select t*e estimation Met*od+ DS J Deast SHuares ?>DS and A.MA@ and click OK to vie# t*e !"ie#s Deast SHuares re ression out-ut table+
%S &''&(&'')
A $uide to !"ie#s
4urbin$Wat!on Stati!tic7 measures t*e serial correlation in t*e residuals. As a rule of t*umb2 if t*e D% is less t*an &2 t*ere is evidence of -ositive serial correlation. /*e D% statistic in our out-ut is ver0 close to one2 indicatin t*e -resence of serial correlation in t*e residuals. /*ere are better tests for serial correlation. In /estin for Serial ,orrelation2 #e discuss t*e M7 statistic2 and t*e Breusc*7$odfre0 DM test2 bot* of #*ic* -rovide a more eneral testin frame#ork t*an t*e Durbin7%atson test. Akaike "nformation 1riterion7 often used in model selection for non7nested alternatives7smaller values of t*e AI, are -referred. S2war5 1riterion7 an alternative to t*e AI, t*at im-oses a lar er -enalt0 for additional coefficients F$Stati!tic7 from a test of t*e *0-ot*esis t*at of t*e slo-e coefficients ?eAcludin t*e constant2 or interce-t@ in a re ression are zero. &rob*F$!tati!tic-7 is t*e mar inal si nificance level of t*e B7est. If t*e -7value is less t*an t*e si nificance level 0ou are testin 2 sa0 '.'C2 0ou re<ect t*e null *0-ot*esis t*at all slo-e coefficients are eHual to zero.
%S &''&(&'')
A $uide to !"ie#s
2.
Data set+ Denn03s restaurant data11111.. denny.wf1 K7 $ross sales volume >7 /*e number of direct market com-etitors #it*in a t#o mile radius of t*e Dann03s location G7 /*e number of -eo-le livin #it*in ) miles radius of t*e Denn03s location I7 /*e avera e *ouse*old income of t*e -o-ulation measured in G /*e oal is to determine t*e best location for t*e neAt Denn03s restaurant2 #*ere Denn03s is a &;7* famil0 restaurant c*ain. /*is can be ac*ieved b0 buildin a re ression model to eA-lain ross sales a s a function of location. %it* t*e iven model2 buildin and location costs2 t*e o#ners of Denn03s s*ould be able to make a decision.
/o save t*e table2 click Free5e on t*e rou- menu bar and define t*e name for created ob<ect b0 clickin Name on t*e #indo# menu bar. Explanation of the some of statistics given in the descriptive statistics table: Kurtosis- measures the peakdness or flatness of the distribution of the series Jarque-Bera is a test statistic for testing whether the series are normally distributed. he test statistic measures the difference of the skewness and kurtosis of
%S &''&(&'')
A $uide to !"ie#s
4'
the series with those from the normal distribution. !nder the null hypothesis of a normal distribution" the #ar$ue-%era statistic is distributed as with & degrees of freedom. Probability is the probability that #ar$ue-%era statistic exceeds 'in absolute value( the observed value under the null hypothesis of a normal distribution.
Dis-la0in t*e sim-le correlation coefficients bet#een all -airs of variables in a rou :-en t*e rou- created in -revious section ?N dennyO@ b0 double clickin name of t*e rou- in t*e #orkfile menu. t*e
,lick 6iew/1orrelation!/&airwi!e Sample! on t*e rou- #indo# menu bar to dis-la0 t*e sim-le correlation coefficients bet#een all -airs of variables included in t*e rou- ob<ect. /o save t*e results click click Free5e on t*e rou- menu bar and define t*e name for created ob<ect b0 clickin Name on t*e #indo# menu bar.
%S &''&(&'')
A $uide to !"ie#s
44
$et t*e eHuation #indo# o-en ?click t#o times on t*e name of t*e eHuation in t*e #orkfile menu@ ,lick 6iew/Repre!entation! on t*e eHuation menu bar to et t*e follo#in +
Estimation !ommand" ##################### $S % P & ' ! Estimation E(uation" ##################### % # !)*+,P - !).+,& - !)/+,' - !)0+ Substituted !oefficients" ##################### % # 1./20334/350,P 6 7150.350/77,& - *..457.//7*,' - *1.*7..0.55
%S &''&(&'')
A $uide to !"ie#s
4&
Dis-la0in t*e table and a ra-* of t*e actual2 fitted and residuals for a re ression
Bor ettin tabular or ra-*ical inter-retation of results 0ou #ould need first to *ave eHuation #indo# o-en Bor dis-la0in t*e table of t*e actual2 fitted and residuals for a re ression click 6iew/Actual8Fitted8Re!idual/Actual8Fitted8Re!idual 'able and 0ou s*ould et somet*in like t*e fi ure belo#+
Bor dis-la0in a ra-* of t*e actual2 fitted and residuals for a re ression click 6iew/Actual8Fitted8Re!idual/Actual8Fitted8Re!idual 0rap2
%S &''&(&'')
A $uide to !"ie#s
4)
3.
Hypothesis testing
In t*is section+ ,alculatin critical t values and a--l0in t*e decision rule ,alculatin confidence intervals Gerformin t*e t7test of t*e sim-le correlation coefficient Gerformin t*e B7test of overall si nificance
Data set+ Denn03s restaurant data11111.. denny.wf1 Before -erformin above named -rocedures2 it is advisable to create one table for storin all results. /o create a table named *0-ot*esisQtestin t0-e table hypothesis_testing in t*e command #indo# and -ress Enter+
%S &''&(&'')
A $uide to !"ie#s
4;
*0-ot*esisQtestin ?&24@ERHtdist?.5C2?e$*1.+regobs-e$*1.+ncoef@@ It is advisable to -ut a descri-tion of t*e result in t*e cell neAt to t*e result. /o do t*is2 *ave in mind t*at for t*e table cells2 matriA notation is valid and t0-e eac* teAt #it*in Huotation marks ?N O@. Bor eAam-le2 to -rint t*e descri-tion of t*e first calculated variable t0-e t*e follo#in in t*e command #indo# and -ress Enter+ hy8othesis9testin )*,.+#;t6critical, t<o tailed test, 2= si nificance level; Note that when you have one command in the command window, the next one you dont have to really ty e but to sim le correct the existing one and than to ress !nter.
/o calculate t*e upper %alue for t2e 9:; confidence inter%al for t*e -o-ulation coefficient ?t*e first inde-endent variable in our eH'4 listin @ and to assi n t*e result to t*e fourt* cell of t*e table hypothesis)testing enter t*e follo#in command in t*e command #indo# and -ress Enter+
*0-ot*esisQtestin )0,*+#e(1*.:coefs)*+-):(tdist).72,)e(1*.:re obs6e(1*.:ncoef+++,e(1*.:stderrs)*+
%S &''&(&'')
A $uide to !"ie#s
4C
%S &''&(&'')
A $uide to !"ie#s
46
4.
Autocorrelation
In t*is section+
Heteroscedasticity
,reatin a residual series from a re ression model Glottin t*e error term to detect autocorrelation !stimation of t*e first order autocorrelation coefficient $ra-*in to detect *eteroscedasticit0 /estin for *eteroscedasticit07%*ite3s test %ei *ted least sHuares Heteroscedasticit0 corrected standard errors
Data set+ /*e -etroleum consum-tion data 11111.. ,-..wf1 G,:>7 -etroleum consum-tion in t*e I7t* state ?millions of B/Us@ .!$7 motor ve*icle re istration in t*e I7t* state ?t*ousands@ /AS7 t*e asoline taA rate in t*e I7t* state ?cents -er allon@
%S &''&(&'')
A $uide to !"ie#s
49
Select 6iew/Actual8 Fitted8Re!idual/Re!idual 0rap2 on t*e eHuation #indo# menu bar or o-en t*e residual series named error and select 6iew/ 0rap2/)ine
/o *ave t*is fi ure saved 0ou s*ould first -ress Free5e on t*e ra-* #indo#. /*en 0ou can name it b0 -ressin Name,
*.11 411 011 1 6011 6411 2 *1 *2 .1 .2 /1 /2 01 02 21 P!A& Residuals
%S &''&(&'')
A $uide to !"ie#s
48
%S &''&(&'')
ER R A R S
ERR AR S
A $uide to !"ie#s
45
/+$chis$'.01"1@ /*e formula ScalarE+$chis$'p"@ finds t*e value Scalar suc* t*at -rob?& #it* de rees of freedom is 4Scalar@E-. /*e result #ill a--ear in t*e bottom left corner of t*e !"ie#s #indo#+ Scalar>//,:?:@9?A9BC. Since t*e %*ite test statistic *as a value of )).&&C6; #*at is reater t*an t*e CL critical & value #e can re<ect t*e null *0-ot*esis t*at t*ere is no *eteroscedasticit0.
%S &''&(&'')
A $uide to !"ie#s
&'
%S &''&(&'')
A $uide to !"ie#s
&4
!.
"imultaneous #$uations
.tand-alone Exercise
At t*is -oint 0ou s*ould be alread0 #ell versed in dealin #it* re ression models b0 usin !"ie#s. ,oncernin !"ie#s -ossibilities2 t*ere is not muc* to learn *ere. /*e onl0 ne# detail is estimation of t*e t#o7sta e least sHuares model. /o -erform /SDS met*od2 0ou s*ould set in t*e !Huation S-ecification #indo# for t*e estimation met*od 'S)S$'wo$Stage )ea!t Square!*'SN)S and AR7A- . Have in mind t*at t*ere must be at least as man0 instruments ?-redetermined variables@ as t*ere are coefficients in t*e eHuation s-ecification.
/*e oal of t*is eAercise is to ive 0ou an idea *o# it looks in a real #orld settin #*ere 0ou su--ose to eit*er create or inter-ret t*e model before a--l0in an0 of econometric soft#are3s. Havin in mind t*at 0ou ma0 not be -racticed in dealin #it* suc* a task #e #ill tr0 to *el- 0ou #it* a Huestions as a uideline for correct -erformin of t*e t#o sta e least sHuares re ression met*od. /*e model 0ou3ll be usin is t*e naTve Pe0nesian macroeconomic model of t*e U.S. econom0. /*is model is defined b0 t*e follo#in eHuations s0stem+
%S &''&(&'')
A $uide to !"ie#s
&&
Kt E ,:t U It U $t U >St KDt E Kt 7 /t ,:t E ' U 4KDt U &,:t J4 U 4t It E ) U ;Kt U Crt74 U &t rt E 6 U 9Kt U 8Mt U )t
/*e variables from t*is s0stem are+ K J $ross Domestic Groduct?$DG@ in 0ear t ,:7 /otal -ersonal consum-tion in 0ear t I7 /otal ross -rivate domestic investment in 0ear t $7 $overnment -urc*ases of oods and services in 0ear t >S7 >et eA-orts of oods and services in 0ear t KD7 Dis-osable income in 0ear t /7 r7 /aAes in 0ear t /*e interest rater ?0ield on commercial -a-er@ in 0ear t
M7 /*e mone0 su--l0 in 0ear t /*e data ?measured in billions of 4589 dollars@ are from 456; to 455;. /*e0 are stored in t*e !"ie#s #orkfile macroeconom,wf/.
%S &''&(&'')
A $uide to !"ie#s
&)
Dour ta!k!E
Kour -rimar0 oal is to a--l0 &SDS met*od to a naTve linear Pe0nesian macroeconomic model of t*e US. !conom0. /*erefore2 0ou don3t *ave to necessaril0 ans#er t*e follo#in Huestions. But2 t*e0 could uide 0ou to a better understandin of simultaneous eHuations s0stems. Ho# man0 eHuations from t*e above iven s0stem *ave stoc*astic c*aracterV $o carefull0 trou * to t*e eHuations and tr0 to find out #*ic* error terms could cause simultaneit0 biasV %*ic* variables from t*e s0stem are endo enous variables and #*ic* are -redetermined variablesV Ho# man0 reduced form eHuations need to be createdV Dook carefull0 t*e data iven in t*e file and t*e variables in simultaneous eHuations s0stem. ,alculate t*e missin variables. Bind :DS estimate of t*ose endo enous variables #*ic* a--ear on t*e left side of stoc*astic eHuations. Bind !"ie#s estimate of t*e reduced7form eHuations and name t*em Sta eQ:ne'42 Sta eQ:neQ'&1.. Gerform t*e second sta e of t*e &SDS met*od usin !vie#s. !stimate &SDS re ression usin !"ie#s /SDS met*od. ,om-are t*e :DS estimates2 :DS t#o sta e results and !vie#s /SDS.
%S &''&(&'')
A $uide to !"ie#s
&;
Ho# man0 eHuations from t*e above iven s0stem *ave stoc*astic c*aracterV :nl0 in t*ree eHuations stoc*astic error term ?@ a--ears. /*erefore2 t*ere are ) stoc*astic eHuations #*ile ot*er t#o are identities. $o carefull0 trou * to t*e eHuations and tr0 to find out #*ic* error terms could cause simultaneit0 biasV Birst #e #ill re#rite t*e eHuation ?)@ as+
?6@
Dt E 1Ot U It U $t U >St
?9@
1Ot E ' U 4Dt J 4/tU &,:t J4 U /t "t E ) U ;Dt U Crt74 U Ft rt E 6 U 9Kt U 8Mt U )t
a@ If / increases in a -articular time -eriod2 ,: #ill also increase. b@ If ,: increases K #ill also increase because of t*e eHuation ?9@ c@ If K increases in t*e eHuation ?9@ it also increases in t*e eHuation ?8@ #*ere it is an eA-lanator0 variable. /*e similar #ill *a--en if F increases in a -articular time -eriod+ d@ If F increases in a -articular time -eriod2 I #ill also increase. e@ If I increases K #ill also increase because of t*e eHuation ?9@ f@ If K increases in t*e eHuation ?9@ it also increases in t*e eHuation ?5@ #*ere it is an eA-lanator0 variable. Det3s look no# t*e eHuation ?4'@. If F increases in a -articular time -eriod2 t*is #ill cause r to increase2 but increase in r #ill not c*an e an0t*in in t*e s0stem because it a--ears onl0 in t*is eHuation. ?In eHuation ?5@ a--ears rt74 not rtI@. /*is leads us to t*e conclusion t*at t*e eHuation ?4'@ doesn3t belon to t*e simultaneous s0stem.
%S &''&(&'')
A $uide to !"ie#s
&C
%*ic* variables from t*e s0stem are endo enous variables and #*ic* are -redetermined variablesV Havin in mind t*at t*e eHuation ?C@ doesn3t belon to t*e simultaneous s0stem2 #e can eAclude variables rt and Mt from t*e furt*er anal0ses. /*e endo enous variables are t*ose #*ose c*an e im-licates c*an es in t*e #*ole s0stem causin ot*er variables to c*an e but2 t*e c*an e is circular2 oin back to t*e causal variable. Bor eAam-le2 if ,: c*an es t*is #ill cause K to c*an e ?eHuation ?4@@ and t*is #ill cause KD to c*an e ?eHuation ?&@@ and from t*e eHuation ?)@ it follo#s t*at t*is c*an e #ill cause ,: to c*an e2 our causal variable. So2 t*e endo enous variables are Kt2 ,:t2 KDt and It. It is a bit easier to ans#er t*e Huestion #*ic* variables are -redetermined because t*e0 a--ear onl0 once in t*e s0stem. /*ese are $t2 >St2 /t 2 ,:t74 and rt74. Ho# man0 reduced form eHuations need to be createdV /*ere are t#o endo enous variables ?Kt and KDt@ #*ic* a--ear on t*e ri *t *and side of stoc*astic eHuations. /*erefore2 #e need to create onl0 t#o reduced form eHuations+ KDt E f4?$t2 >St2 /t 2 ,:t742 rt74@ Kt E f&?$t2 >St2 /t 2 ,:t742 rt74@ Dook carefull0 t*e data iven in t*e file and t*e variables in simultaneous eHuations s0stem. ,alculate t*e missin variables. /*e missin variables are / and >S and t*e0 can be calculated usin eHuations ?4@ and ?&@. Bind :DS estimate of t*ose endo enous variables #*ic* a--ear on t*e left side of stoc*astic eHuations. Kour out-ut s*ould contain t*e follo#in results+ Estimation E(uation" ##################### !A # !)*+,%D - !).+,!A)6*+ - !)/+ Substituted !oefficients" ##################### #$ % 0.&1'()'*+(,-. / 0.('111)+1*(,#$0-11 - +).10&(1*+2 Estimation E(uation" ##################### ' # !)*+,% - !).+,R)6*+ - !)/+ Substituted !oefficients" ##################### 3 % 0.1'(14+14)1,- - &.'+44(0'*,50-11 / +*.2&*+)'24
%S &''&(&'')
A $uide to !"ie#s
&6
Bind !"ie#s estimate of t*e reduced7form eHuations and name t*em Sta eQ:ne'42 Sta eQ:neQ'&1.. Bs mentioned above, there are t<o reduced form e(uations to be created. The first one should be a function of a variable %D )because %D is a endo enous variable <hich a88ears on the ri ht side of a stochastic e(uation+ and all 8redetermined variables" %D # !)*+,G - !).+,&C - !)/+,T - !)0+,!A)6*+ - !)2+,R)6*+ - !)3+
The second reduced form e(uations should be a function of a variable % and all 8redetermined variables" % # !)*+,G - !).+,&C - !)/+,T - !)0+,!A)6*+ - !)2+,R)6*+ - !)3+
%S &''&(&'')
A $uide to !"ie#s
&9
Gerform t*e second sta e of t*e &SDS met*od usin !"ie#s. !stimation results from t*e first sta e of t*e &SDS met*od s*ould be substituted in s0stem eHuations ?)@ and ?;@ . !"ie#s estimation out-ut tables are iven bello#. ,:t E ' U 4WDt U &,:t J4 U 4t It E ) U ;Wt U Crt74 U &t
%S &''&(&'')
A $uide to !"ie#s
&8
!stimate &SDS re ression usin !"ie#s /SDS met*od. !"ie#s can estimate bot* sta es of t*e &SDS met*od simultaneousl0. Kou *ave onl0 to s-ecif0 0our de-endent variable2 inde-endent variables and t*e list of instruments. In order to estimate ,:2 follo#in t*e eHuation ?&@ s*ould result in+
Dariable %D !A)6*+ !
!vie#s &SDS estimation of I is analo to t*e above eA-lained. In t*e eHuation #indo# 0ou s*ould enter variables accordin to t*e eHuation ?;@ ? I K r ?74@ , @ #*ile instrument list s*ould remain t*e same. If 0ou *ave done t*is correctl0 0ou3ll et t*e follo#in result+
Dariable % R)6*+ ! !oefficient 1.*3/47*5*3*25 62.3./02.4.//5 //.710441/537 Std. Error 1.1177.37.57407* /.*17.422/154 0*.*0//*4/0/2 t6Statistic *3.2174*.*/77 6*.41427734./5 1.4.01355*31.* Prob. 2.573**202307e6*3 1.14*.3045/*020 1.0*34325/7.10
,om-are t*e :DS estimates2 :DS t#o sta e results and !"ie#s /SDS. Bor bot* endo enous variables #*ic* a--ear on t*e left side of stoc*astic eHuations '23-total personal consumption in year t and 4-total gross private domestic investment in year t( #e a--lied t*ree estimation met*ods+ :DS2 /SDS :DS and !"ie#s &SDS. In order to com-are t*ese results #e -lace all of t*em in one !"ie#s #indo# ?look t*e fi ure bello#@. :n t*e left side are result for variable ,: and on t*e ri *t side are results for variable I.
%S &''&(&'')
A $uide to !"ie#s
&5
,om-arison summar0+ ,oefficient estimated usin /SDS :DS and !"ie#s &SDS met*ods are identical ,oefficient estimated usin :DS met*od are lar er t*an t*ose from /SDS :DS and !"ie#s &SDS met*ods. /*is confirms *0-ot*esis t*at :DS encounters bias ?simultaneit0 bias@ Standard errors in t*e !"ie#s &SDS met*od are smaller t*an t*ose from /SDS :DS met*od. /*e reason for t*is is t*at t*e second sta e of t*e :DS i nores runnin of t*e first one. Accordin to t*e A.H Studenmund ?NUsin !conometrics2 Addison %esle0 Don man2 -.;84@ to et accurate estimated standard errors and t7scores t*e estimation s*ould be done on a com-lete &SDS -ro ram.
%S &''&(&'')