Log in / Register
Home arrow Economics arrow Financial Econometrics
< Prev   CONTENTS   Next >


One of the most important concepts in EViews is the sample of observations. The sample is the set of observations in the workfile used for performing statistical procedures. Samples may be specified using ranges of observations and "if conditions" that observations must satisfy to be included. For example, you can tell EViews that you want to work with observations from 1973M1 to 1990M12 and 1995M1 to 20066M12. Or you may want to work with data from 1973M1 to 1978M12 where observations in the Returns series are positive. When you create a workfile, the workfile sample is set initially to be the entire range of the workfile. The workfile sample tells EViews what set of observations you wish to use for subsequent operations. You can always determine the current workfile sample of observations by looking at the top of your workfile window. Here the MYDATA workfile consists of 408 observations from January 1973 to December 2006. The current workfile sample uses a subset of those 72 observations between 1973M01 and 1978M12 for which the value of the Returns series is positive.

There are four ways to set the workfile sample: you may click on the Sample button in the workfile toolbar, you may double click on the sample string display in the workfile window, you can select Proc/Set Sample from the main workfile menu, or you may enter a smpl command in the command window.

EViews provides special keywords that may make entering sample date pairs easier. First, you can use the keyword @all, to refer to the entire workfile range. In the workfile above, entering @all in the dialog is equivalent to typing "1973M12006M12". Furthermore, you may use Ofirst and @last to refer to the first and last observation in the workfile. Thus, the three sample specifications for the above workfile:

are identical.

Sample Commands

EViews allows you to add conditions to the sample specification. In this case the sample is the intersection of the set of observations defined by the range pairs in the upper window and the set of observations defined by the if conditions. This can be done by typing the expression:

in the command window. You should see the sample change in the workfile window. Sample range elements may contain mathematical expressions to create date offsets. This feature can be particularly useful in setting up a fixed width window of observations. For example, in the regular frequency monthly workfile above, the sample string: 1973ml 1973m1+11 defines a sample that includes the 12 observations in the calendar year beginning in 1973M1. The offsets are perhaps most useful when combined with the special keywords to trim observations from the beginning or end of the sample. For example, to drop the first observation in your sample, you may use the sample statement:

Accordingly, the following commands generate a cumulative returns series from the price levels one:

The first two commands initialize the cumulative returns series at 0, the last two commands compute them recursively all remaining dates. Later we will see how sample offsets can be used to perform the rolling window estimation.

EViews provides you with a method of saving sample information in an object which can then be referred to by name. To create a sample object, select Object/New Object from the main menu or the workfile toolbar. When the New Object dialog appears, select Sample and, optionally provide a name. Click on OK and EViews will open the sample object specification dialog which you should fill out. The sample object now appears in the workfile directory with a double-arrow icon. To declare a sample object using a command, simply issue the sample declaration, followed by the name to be given to the sample object, and then the sample string: sample mysample 1973ml 1978m12 if returns>0

EViews will create the sample object MYSAMPLE which will use observations between 1973:01 and 1978:12, where the cumulative returns are positive.

You may use a previously defined sample object directly to set the workfile sample. Simply open a sample object by double clicking on the name or icon. You can set the workfile sample using the sample object, by entering the smpl command, followed by the sample object name. For example, the command:

smpl mysample

will set the workfile sample according to the rules contained in the sample object MYSAMPLE.

Found a mistake? Please highlight the word and press Shift + Enter  
< Prev   CONTENTS   Next >
Business & Finance
Computer Science
Language & Literature
Political science