Eviews: 29. Juni 2010
Eviews: 29. Juni 2010
Eviews: 29. Juni 2010
Inhaltsverzeichnis
1 Introduction
2 Assignment 1
3 Assignment 2a
4 Assignment 2b
5 Assignment 3
10
6 Assignment 3b
12
13
8 Assignment 5b
17
9 Assingment 6
18
Eviews 1 Introduction
1 Introduction
The EViews Window
Component
Drop Down
Menus
Command Line
Status Line
Work Area
Help Menu
Purpose
easy-to-use tools for
implementation of EViews
procedures
alternative to drop down
menus for usage of command
processing language at
advanced level
message area indicating
default directory (Path),
default database (DB),
default workfile (WF) Work
Area
display of various object
windows
provision of helpful advice
Eviews 1 Introduction
Empty workfile (File/New/Workfilespecify data) still contains the objects: constant, residual
You always have to save the results of a regression with a proper name thus creating an object.
Working with Objects
Objects are collections of related information and operations that are bundled together into easy-to-use
units that you hold in a workfile.
creating objects: click Object/New Object, select object you desire and name it meaningfully.
For taking notes: Type Text
useful objects: text, series, equation, graph, group, etc.
Examining a Single Series
spreadsheet view: double-click on series, e.g. gdp
different sample period: click Sample and change sample range. Can de done in the main window
or when the series in opened as a graph
descriptive statistics: click View/Descriptive Statistics/... (Histogram & Stats)
graphs: click View/Graph/Line
saving graphs: rightclick on graph and save graph to disk: *.emf for inclusion in word and *.eps
for inclusion in latex documents
copying results into word: copy (STRG+C) and paste (STRG+V)
freezing results: click Freeze and name object via Name as to create a new object in your workfile
Examining Several Series
spreadsheet view: click on series1+STRG+series2, double-click in blue area and select open
group
summary statistics: click View/Descriptive Stats/Common Sample
plotting two series: click View/Graph/Line or View/Multiple Graphs/ Line. Graph shows both
series in one graph and multiple graphs shows one graph for each series
scatter diagram: click View/Multiple Graphs/Scatter/...SCATMAT: matrix containing scatterplots for all series
Group objects: Strg (single marks), Shift (mark tow, inbetween everything is makred). After marking
click right/Open/As group/Name. If you dont name it, you get a window where you can either name
or store the object
Using the Quick Menu
Eviews 1 Introduction
changing sample: click Quick/Sample and proceed as before
graphs: click Quick/Graph/Line etc.
generating new series: click Quick/Generate Series and enter equation according to seriesname=function(series) etc. eg. log()
Using EViews Functions
Basic arithmetic operations and basic math functions can be used when working with series, such as
in operations to generate new series (NOTE: some functions require the @ symbol to be identified
by EViews!):
click Quick/Generate Series and enter equation or
use the Command Line via series seriesname=function(series)
Note that in the command line the first entry is always the object type (series, scalar, etc.) you want
to create!
Descriptive statistics functions can solely be used within the Command Line.
Mean: scalar seriesname=@mean(series)
Std: scalar seriesname=@stdev(series)
can be seen in status line
recall: Define new object: Matrix-Vector-Coef. (insert how many values needed), then:
Vectorname(1)=@mean(series)
Vectorname(2)=@stdev(series)
Getting Data into EViews
open *.xls and memorize number of obs, labels and ordering of variables
close *.xls
create empty workfile via FileNewWorkfile and indicate parameters (structure type; data
range)
click ProcImportRead Text Lotus Excel, select data type *.xls and browse
indicate appropriate parameters (indicate all series separated by a Leerzeichen), label data and
save workfile
Other ways:
Go to the folder where you saved the excel file, then drag it and drop it in the grey part of
EViewsFertigstellen
Eviews 2 Assignment 1
Click right in the grey part of EViews Open Foreign data as workfile choose excel file
Fertigstellen OR Open EViews Workfile Dateityp: .xlsChoose excel file Fertigstellen
2 Assignment 1
1.3
Rename an object: click right on objectrename (for workfile: save)
To change the order of the variables in a group, use Spec
1.4
ViewDescriptive statsCommon table (for a graph)Freeze (to save)
1.5
ViewGraphScatterSimple scatterFreeze (to save)
To change graph:
Add titel: AddText
Scaling: OptionAxes/Scaleschoose Axis under Edit Axis and Scaling User specified
Symbols: OptionLine/SamplesDifferent options
Save to disk: ProcSave graph to disc
2.1
QuickEstimate equationenter variables: food_exp c income OR food_exp=c(1)+c(2)*income
and choose Method: LS save the output through name
2.2
c and resid are now filled, but are overwritten after each equation is computed
2.3
(i) c(1) insignificant on 5% significance level, c(2) significant on all conventional significant levels
(ii) If income increases by 1 unit (100$), food_exp increases by 10 units (1$)
(iii) R2 =0,385
3.1
To create predicted values after estimating:
series predictedvalues=@coefs(row of object c)+@coefs(row of object c)*x-variables
Quick way: after estimating click on Forecast and enter a name to save it
3.2
Series resid1=resid (this way the residuals are saved and dont change after the next regression)
Series resid1=food_exp - predictedvalues
Eviews 3 Assignment 2a
3.3
Open predictedvalues and resid1 as a group and use scatterplot.
Quickgraphscatterenter series names (with Leerzeichen).
You see heteroscedasticity
Line/shade: indicate orientation and position (0)
3 Assignment 2a
2.1
FileNewProgram
Mark whether a sentence is supposed to run or not: text prevents running
2.2
To open a workfile: wfopenPath Run
2.3
To form a group: group name objects (eg. group grp1 advert price sales)
Open the descriptive statistics: name.stats (eg. grp1.stats)
2.4
Estimate a regression: equation name.typ y-var c x1-var x2-var (eg. equation reg1.ls sales c price
advert)
Procs:
Compute residuals: name.makeresid name (eg. reg1.makeresid residuals)
Compute predicted values: reg1.forecast name (eg. reg1.forecast predicted_data)
Create scatterplot: graph name.scat name1 name2 (eg. graph regscat.scat predicted_data residuals)
Compute R-squared: scalar name=name.@r2 (eg. scalar firstscalar=reg1.@r2)
To save: save
Programs are superior for repetitive tasks
3.1
t-stats:
scalar name=@coefs(No)/@stderrs(No)
(Besser: scalar name=reg1.@coefs(No)/reg1.@stderrs(No))
3.2
p-value (2-seitig):
scalar name=2*(1-@ctdist(name t-stat,n-k-1)) (bei positivem t-stat)
scalar name=2*(@ctdist(name t-stat,n-k-1)) (bei negativem t-stat)
3.3
Critical value:
scalar name=@qtdist(1-/2,n-k-1)
Eviews 4 Assignment 2b
3.5
t-stats:
scalar name=@coefs(No)-Wert/@stderrs(No)
p-value (1-seitig):
scalar name=1-@ctdist(name t-stat,n-k-1)) (bei positivem t-stat)
scalar name=@ctdist(name t-stat,n-k-1)) (bei negativem t-stat)
Critical value:
scalar name=@qtdist(1-,n-k-1)
Appendix
Data members of equation (are computed together with eq., so we can access them using the following
comments):
@aic
Akaike information criterion
@coefcov(i,j)
Covariance of coefficient estimates i and j
@coefs(i)
i-th coefficient value
@f
F-statistic
@logl
Value of the log likelihood function
@meandep
Mean of the dependent variable
@ncoef
Number of estimated coefficients
@r2
R-squared statistic
@regobs
Number of observations in regression
@schwarz
Schwarz information criterion
@sddep
Standard deviation of the dependent Variable
@se
Standard error of the regression
@ssr
Sum of squared residuals
@stderrs(i)
Standard error of coefficient i
@tstats(i)
t-statistic value for coefficient i
c(i)
i-th element of default coefficient vector for equation
@coefcov
Covariance matrix for coefficient estimates
@coefs
Coefficient vector
@stderrs
Vector of standard errors for coefficients
@tstats
Vector of t-statistic values for coefficients
4 Assignment 2b
1.1-2.6
Siehe Assignment 2a
3.1
Set sample range: smpl 1 n obs
Eviews 4 Assignment 2b
3.2
Lower bound of confidence interval: scalar name=@coefs-@stderrs*critical value
Upper bound of confidence interval: scalar name=@coefs+@stderrs*critical value
3.3
We can choose any c inside the confidence interval.
4.2
series name=@dnorm(x) (x here a series)
scalar name=@dnorm(x) (x here a scalar)
4.3
series name=@dtdist(x,df) (x here a series)
scalar name=@dtdist(x,df) (x here a scalar)
4.4
Take the series compute in 4.2 and 4.3, open as a group and than viewgraphline
4 using a program
Compare the distributions of a normal distribution and a t-distribution (with 4 different degrees of
freedom) in a graph:
How to create a vector:
vector (No. of elements) vectorname
vectorname(1)=number or path
vectorname(2)=number or path
... (depending on number of element)
Text of program:
Vector(4) df
df(1)=4
df(2)=10
df(3)=100
df(4)=2000
series normal=@dnorm(x)
for!i=1 to 4
series tdist{!i}=@dtdist(x,df(!i))
group joint{!i} normal tdist{!i}
freeze(grafik{!i}) joint{!i}.line
next
freeze(grafikall) grafik1 grafik2 grafik3 grafik4
show grafikall.align(2,1,1)
Elemente:
Vector name: df
Group name: joint
Eviews 4 Assignment 2b
Graph name: grafik
Joint graph name: grafik all
Elements of align: align(n,h,v) with n=number of columns, h=horizontal space, v=vertical space
freeze(name of graph) to save a graph and not only show it
{!i} as a replacement
5.1
c = z0 = z1 = 0
0 0 1 0
0
c
R = 0 0 0 1 = = r = 0
z0
0 1 0 0
0
z1
(1)
5.2
scalar fstat=reg1.f
scalar pval=1-@cfdist(fstat,3,2773) (allg.: scalar name=1-@cfdist(fstat,#r,n-k))
5.3
scalar critval=@qfdist(0.95,3,2773)
5.4
Equation objectViewCoefficient testsWald-Coefficient Restrictionsc(3)=0, c(4)=0
5.5
ViewCoefficient testsWald-Coefficient Restrictionsc(3)=0, c(4)=0, c(2)=0.005
0 0 1 0
0
c
0
R = 0 0 0 1 =
z0 = r =
0 1 0 0
0.005
z1
(2)
5 using a program
Estimate the equation
equation reg1.ls delta_p c delta_q q qv
Estimate the variance-covariance matrix
c: series interc=1 (we define a constant)
X: group reggr interc delta_q q qv (create a group containing all variables)
| {z }
name for X
{z
inner
| {z }
} =@inverse(secmom)
Eviews 5 Assignment 3
ee/n-k: scalar ssqrd=reg1.@ssr/degfr (mit ssr: sum of squared residuals)
matrix estvarcov=insecmom*ssqrd
Short Way:
matrix
cov
| {z } evmat=reg1.@coef
| {z }
object type
d
V ar(b|X)
name
linrest(1,3)=1 (H0 : z0 = 0)
linrest (2, 4) =1 (H0 : z1 = 0)
| {z }
field of matrix
5 Assignment 3
1.4
ViewDistributionKernel Density Graphs (nonparametric method of smoothing)Kernel (doesnt
matter with large sample size= leave standard)
2.1
ls wage c educ exper (zum Speichern: equation name.ls wage c educ exper)
10
Eviews 5 Assignment 3
2.3
If you divide the dependent variable by a constant, the parameters also have to be divided by the
same constant
2.6
If you multiply the independent variable by a constant, the parameters changes accordingly being
divided by that constant.
2.7
Standardized series:
series wage_z=(wage-@mean(wage))/@stdev(wage)
2.8
bj : @coefs(i);
bj : @stdev(xi);
by : @stdev(y)
scalar name=@stdev(xi)/@stdev(y)*eq1.@coefs(i)
3.1
log(variable) is the function for the natural logarithm of a variable.
Appendix: Theory
Linear transformation of regressors
Let x be the nxk matrix of the regressors and A a kxk nonsingular linear transformation matrix.
Postmultiplying x by A yields:
xA = x[a1 , ..., ak ] = [xa1 , ..., xak ]
|{z}
B
bx
(xi1 x1 )
bx
(xik xk )
ei
(yi y)
= 1 b1
+ ... + k bk
+
by
by
bx1
by
bxk
by
(3)
11
Eviews 6 Assignment 3b
6 Assignment 3b
3.1
Enter for the observation: 1 200
3.2
For educ: eq.@coefs(2)1.96*eq.@stderrs(2) (bzw. statt 1.96: -@qtdist(0.025,n-k))
The one with the lower n is wider (as we have smaller stderrs for higher n and a different t-stat).
Our aim is a narrow interval.
3.3
1 =85 cannot be rejected.
We do not reject for all values inside the confidence interval: [64,88]
4.1
log(variable) for ln
4.3
We can reject at any conventional significance level as p-value is close to 0.
4.4
Centered R2 : 1-SSR/SST
SSR=eq6.@ssr; SST=(eq6.@sddep)2 *(n-1)
Adjusted R2 : 1-(n-1/n-k)SSR/SST
4.5
Adjusted R2 : (5) 0.129; (6) 0.179
Akaike: (5) 0.973; (6) 0.916
Schwarz: (5) 0.989; (6) 0.941
all criteria point toward equation 6
4.6
AIC=log(SSR/n)+2k/n
SBC=log(SSR/n)+log(n)k/n
Maximized log-likelihood under the normality assumption:
e 0 (y X )
e
L = n/2 log(2) n/2 log(e
) 2e1 2 (y X )
e0 e
1
L = n/2 log(2) n/2 log( n ) e0 e e0 e
)
n
SSR
2 SSR
n
log( SSR
n )
2(
log( SSR
n )
12
11000
| {z }
undated samplesize
1.1
Construction of the mode:
x: series Regress = @ runif (|{z}
6 , |{z}
12 )
| {z }
| {z }
N ame
unif ormdist
-vector:
vector(2) Beta
| {z }
N ame
Beta(1)=5
Beta(2)=0.5
series
yb =Beta(1)+Beta(2)*Regress
|{z}
N ame
13
mtos
| {z }
( betavec
| {z } , |betaser
{z } ) (where betaser is a series that is created new here)
Plot empirical distribution test: freeze(Tests) betaser.edftest (4 tests to test for a normal distribution)
3
General:
{!i} as part of a name
(!i) as a variable or parameter
3.1
workfile simultest u 1 2000
Definition of the sample sizes:
vector(4) stp
stp(1)=10
stp(2)=20
stp(3)=300
stp(4)=2000
Construction of the model as in 1.1
Decision variables: !n=1000
The loops:
For !i=1 to 4
!stp=stp(!i)
smpl @first !stp (sets the sample sizes)
vector(!n) betavec{!i} (This time we create four vectors; one for every sample size)
For !k=1 to !n
series y_stocj=b
y +@rtdist(5)
equation reg01.ls y_stoch c Regress
betavec{!i}(!k)=reg01.@coefs(2)
Next
Next
3.2
Just change the parameters of @runif(a,b)
4
4.1
Creation of series and graphics:
smpl @first !n
14
scalar thmom=@mean(thpow)
series thpow=(y@mean(y))3
scalar fomom=@mean(fpow)
15
sub
Formeln:
JB =
n 2 (K 3)2
(S +
)
6
4
(4)
mit
1
n
P
(y y)3
S= 1P
( n (y y)2 )3/2
(5)
und
K=
1 P
(y y)4
n
P
( n1 (y y)2 )2
(6)
5.5
We use the programm text from the added task, then we compute:
smpl @first !n
For !i=1 to 4
scalar p{!i}
mtos(betavec{!i},betaser{!i})
Alternative computation (instead of those two lines)
call jbt(p{!i},betaser{!i})
if !switch=1 then
freeze(Kern{!i}) betaser{!i}.kdensity
else
freeze(Kern{!i}) betaser{!i}.hist
endif
freeze(Tests{!i}) betaser{!i}.edftest
next
Composite graph:
freeze(endgra) Kern1 Kern2 Kern3 Kern4
show endgra.align(2,3,1)
5.6
Local (after subroutine, before the name): prevents the subroutine from producing everything. With
local only the thing specified as output is stored and the other ones are lost after the output is
created.
16
Eviews 8 Assignment 5b
8 Assignment 5b
Theory CAPM
E[rjt rf ] = j E[rmt rf ]
(7)
where:
rjt =risky asset return on asset j (in period t)
rmr =risky return of the market portfolio
rf =riskless return (time invariant)
Cov(rjt ,rmt )
= V ar(r
=proportionality factor
mt )
Regression model:
vjt = rjt E(rjt )
vmt = rmt E(rmt )
7 becomes then:
rjt vjt rf = j (rmt vmt rf )
rjt rf = j (rmt rf ) + vjt j vmt
|
{z
}
jt
It holds:
E(jt ) = E(vjt ) j E(vmt ) = 0
Since j =
Cov(rjt ,rmt )
V ar(rmt )
E[vjt vmt ]
2 )
E(vmt
It holds:
E[jt (rmt rf )] = E[(vjt j vmt )(rmt rf )] = E[(vjt j vmt )(vmt + E(rmt ) rf )]
|
{z
}
= E[(vjt j vmt ) vmt ] = E[vjt vmt ]
2 ]
j E[vmt
= E[vjt vmt ]
non-stochastic
E[vjt vmt ]
2 ]=0
E[vmt
2 )
E(vmt
1.1
Open workfile, then ProcStructure/Resize Current Page=> Enter data structure
1.4-2.2
Use a program:
for !i=1 to 10
series r{!i}rf r{!i}-rf
equation eq{!i}.ls r{!i}rf c rmrf
next
2.3
Before loop: vector(10) tstat
As part of loop: tstat(!i)=(eq{!i}.@coefs(2)-1)/eq{!i}.@stderrs(2)
17
Eviews 9 Assingment 6
For p-value:
Before loop: vector(10) pvalue
As part of loop: pvalue(!i)=2*(1-@cnorm(@abs(tstat(!i))))
Matrix instead of vector:
matrix (2, 2)
a
|{z}
| {z }
Zeilen,Spalten N ame
a(1,1)=Zahl
a(1,2)=Zahl
a(2,1)=Zahl
a(2,2)=Zahl
2.4
Before loop: vector(10) constant
As part of loop: constant(!i)=eq{!i}.@coefs(1)
3.1
for !i=1 to 10
euqation equ{!i}.ls r{!i}rf c rmrf smb hml umd
next
3.2
2 with @rbar2, Akaike with @aic and Schwarz with @schwarz. Example for R2 :
Use Radj
adj
Before loop: vector(10) radj
As part of the loop: radj(!i)=equ{!i}.@rbar2
3.3
freeze(wald{!i}) Equ .wald Conditions (here: c(3)=0, c(4)=0, c(5)=0)
|{z}
N ame
9 Assingment 6
Theory
1. Homoscedasticity assumption:
V ar(i |x) = E(i |x) = 2 for i=1,...,n
2. Heteroscedasticity:
V ar(|x) = E(2 |x) = i2
3. Consequences of heteroscedasticity:
Under assumption 1.1-1.3 and 1.5 OLS estimator unbiased but no longer BLUE and t- and F-tests
not valid
V ar(b) = (X 0 X)1 X 0 V ar()I X(X 0 X)1 = 2 (X 0 X)1 (under homoscedasticity)
| {z }
18
Eviews 9 Assingment 6
is always smaller than under heteroscedasticity. To estimate without Assumption 1.4:
P
P
P
P
d
Vd
ar(b) = (X 0 X)1 e2 xi x0 (X 0 X)1 = ( xi x0 )1 e2 xi x0 ( xi x0 )1 = Avar(b)
i
19
Eviews 9 Assingment 6
3.3
H0 : we have homoscedasticity
BP = n R22 2 (k) (here: k=3)
scalar bp=n*eq2.@r2
3.4
scalar pvalue=qcchisq(bp,3)
4.1
series ln2name=lnname2
series lnname1name2=lnname1*lnname2
4.2
equation ls residuals2 c lnwage lnoutput lncapital ln2wage ln2output ln2capital lnoutputwage lncapitalwage lncapitaloutput
4.3
White=n R22
scalar white=n*eq3.@r2
4.4
scalar whitecrit=@qchisq(0.95,9)
White and Breusch-Pagan both rejecto n the 5% significant level
5.1
ViewEstimate equationEnter the same equation as for OLSOptions Heteroscedasticity-consistentWhiteO
20