You are on page 1of 3

Everything You Always Wanted To Know About EViews

(But Were Afraid To Ask)

The first thing you need to do is to import your dataset (usually a file with a wfi extension, aka a
workfile) into EViews. The short way is to go to your workfile and double click on it; EViews will
open and the data will be loaded. The long way is to open EViews and then use the Menu:
File → Import → Import from file… → (find and select your file) → Open
A workfile window will appear showing all the variables your dataset contains. If you want to see
more information (type, description, etc.) than just the variable names then click on the
Details+/- button of the workfile window.

Now suppose you want to estimate a model using OLS. Let’s say that our dependent variable is
called depvar and you want to regress it upon a constant and four explanatory variables
(var1,…,var4). You can use either the command window or the menu. In the first case, you just
go to the command line and type:
ls depvar c var1 var2 var3 var4

and press Enter (in the equation window that will appear, you can click on the Estimate button
and see how you should have worked had you used the command window – this is explained
below). If you use the command window, remember to specify the estimation method before the
equation specification (ls is for Least Squares here). Alternatively, you can use the Menu:
Quick → Estimate Equation → (type your equation specification) → OK
In this case you do not have to specify the estimation method before the model specification (this
should already specified for you in the estimation settings. So, just type your model in the equation
specification box:
depvar c var1 var2 var3 var4

and check that in the estimation settings below, the method is set to: LS – Least Squares (NLS
and ARMA). And click OK. If you want to modify your estimation (in terms of model specification,
estimation method and sample/period) you can click the Estimate button on the equation
window and do all the necessary modifications. You can also save the estimation output by click
the Freeze button on the equation window.
Normally, the variables you need will be there for you. But let us assume that you need to create
an interaction term (varying slope) between two explanatory variables (e.g. var1 and var2) in
order to include it to the right-hand side of your model. Again, you can use either the command
window or the Menu. In any case you need to choose a name for the interaction term, let’s say
inter1. In the first case, you have to go to the command window and use the following syntax:

series inter1=var1*var2

and press Enter. A new variable named inter1 will be added to your workfile. If you choose to
use the Menu:
Quick → Generate Series → (type the expression in the Enter equation box) → OK
where the expression is the same as in the command window case, simply without series in front
of it, and click OK. Another option is to click the Genr button on the workfile window and get the
same Enter equation box where you type your expression and click OK. Then you just have to add
the generated interaction to your model as an additional explanatory variable:
ls depvar c var1 var2 var3 var4 inter1

(or go through the Menu). But perhaps you do not need to create and store another variable in
your workfile (or you just want to be quick). In this case, you can specify the interaction term
between the two variables directly in your model specification. Using the command window, you
can type:
ls depvar c var1 var2 var3 var4 var1*var2

and press Enter (or use the Menu as shown before). No matter how you choose to work with the
interaction term, the estimation output is going to be the same.
You can create lagged values of the variables you need by working in an analogous way. For
example, assume that you want to create a one period lag of the dependent variable ( depvar) in
order to include it as an explanatory variable in your model. The period can be a year, a month, a
quarter and so on; it depends on your data. If you choose that lagdepvar will be the name of the
variable you want to create, you can go to the command window and use the following syntax:
series lagdepvar=depvar(-1)

where the number in the parenthesis indicates the number of periods you want to lag your variable.
You can also go through the Menu as in the case of the interaction term shown before. Again, if
you do not need to create and store a new (lagged) variable, you can specify it directly in your
model and get the same output:
ls depvar c var1 var2 var3 var4 depvar(-1)

Now, suppose that in the original model you estimated using OLS you suspect that var1 is
endogenous and you want to instrument it using an (exogenous) variable called instr1. If you
want to use the command window, the syntax is the following:
tsls depvar c var1 var2 var3 var4 @ instr1 var2 var3 var4

where tsls stands for Two-Stage Least Squares and you can see that after the @ sign you have
included all the (assumed) exogenous variables. Before the @ sign the model is specified exactly as
in the OLS case. In the case you have more than one instruments, you just type their names after
the @ sign along with every other exogenous variable. Alternatively, you can use the Menu:
Quick → Estimate Equation (choose the Two-Stage Least Squares method in the
estimation settings, type your model specification in the Equation specification box, type
the instrument list in the box below, make sure that the option to include a constant is
ticked) → OK
and you will get the same output.
Now suppose that you have a workfile that contains data for units (individuals, regions, firms,
coutnries) observed for two periods (years). Moreover, suppose that your dataset contains a
variable named year that takes the value of 0 in the first year and 1 in the second year. Of course
you can still the total sample to run an OLS regression of your model specification controlling also
for a period-specific effect (varying intercept):
ls depvar c var1 var2 var3 var4 year

But if you suspect that there are time-invariant unobserved factors correlated with your
explanatory variables you may want to eliminate them by running an OLS regression of the model
specified in first differences. In this case you have to restrict the estimation sample using only the
second period and then run your model using the first-differenced values of your variables (they
will be ready for you; usually they have the same names as the original ones and they start with
letter “c” or “d” to indicate changes or differences. But do not worry if their not; if you need to
manually first-difference a variable, say var1, and call it cvar1, you just have to type series
dvar1=d(var1)). If you use the command window, you can restrict the sample to the second
period using the following syntax:
smpl if year=1

and then run the first differenced model using OLS:


ls cdepvar c cvar1 cvar2 cvar3 cvar4

Notice that now you do not include the year dummy indicator. Instead, you use the differenced
values of all variables in both sides of the equation. Remember that EViews keeps the restricted
sample so you can turn back to the total sample simply by typing:
smpl @all

in the command window. You can also go through the menu to run a first-differenced model.
Click on Quick, then Equation Estimation, type the first-differenced version of the model in the
Equation specification box (without the ls in the beginning in this case), making sure that in the
Estimation settings, the method is set to Least Squares and in the Sample box you delete everything
and you type:
if year=1

You will get the same output. The EViews will remain in the restricted sample mode in this case
as well, so remember to turn it back to the full sample for your next estimation (if necessary).
In any case, do not forget that Google is your friend. There is plenty of material out there (guides,
manuals, slides, notes, examples, Youtube videos, etc) so you can explore and find what suits you
better.

You might also like