Download EViews Training: Changing Samples in Time Series and Cross-Section Data and more Lecture notes Performing arts in PDF only on Docsity!
EViews Training
Samples
Note: The Workfiles and Data for examples for this tutorial are: ✓ Data: Data.xls ✓ Results: Results.wf ✓ Practice workfile: Data.wf
Data and Workfile Documentation
- Data.wf1 and Data.xlsx have two pages (tabs) with the following data:
- Workfile Page Payroll (Data.xlsx: tab Payroll ): monthly data from Jan 1950 – May 2012 ✓ Payroll – Payroll employment levels (in thousands) (source: Bureau of Labor Statistics) ✓ Unemployment – unemployment rate (in percent) (source: Bureau of Labor Statistics).
- Workfile Page Cross_Section (Data.xlsx: tab Cross_Section ): state-level data (50 states) ✓ Population – population data in 2000 (source: the Census Bureau). ✓ GDP – nominal GDP (in millions of dollars) (source: the Bureau of Economic Statistic). ✓ Area – square miles (source: the Census Bureau).
Range and Sample
- Workfile Data.wf1 is a dated
workfile with monthly
frequency.
- Page “ Payroll ” of the workfile
contains data on “ payroll ” and
“ unemployment ” from
January 1950 to May 2012.
- The range of the workfile is
from1950M1 to 2012M5.
1990M01 to 2002M12.
Changing the Sample
- There are a few different ways to
change/set the workfile sample:
✓ Click the Sample button in the workkfile toolbar (1). ✓ Double click on the Sample display in workfile window (2). ✓ Select Proc/Set Sample from workfile menu (3). ✓ Type “ smpl ” in the command window (4). (4)
Changing the Sample in Time Series Data
Date Pairs: Example 1 (cont’d)
- The result is shown here.
- The range is the same as before (January 1950 – May 2005), but the sample has changed as we specified.
- Note that after the sample change, all analysis (graphs, stats, regressions) are carried out over the new sample. .
Changing the Sample in Time Series Data
Date Pairs: Example 2
- Suppose that you would like to define the sample over two (non-overlapping)
periods.
- The process is the same as before: date ranges should be typed in pairs. Define the sample from March 1960 – Feb 1970 and from Jan 1992 – Oct. 2002
- Select any of the methods (1-3) that allow you to change the sample.
- The Sample dialog box opens up. In the upper portion of the box under Sample range pairs , type the new sample in date pairs with spaces between each pair: 1960m3 1970m2 1992m1 2002m
- Click OK.
Changing the Sample in Cross-Section Data
Observation Pairs
- In case of cross-section data,
the cross-section identifier
CANNOT be used to set/change
the sample.
- To work through an example for
cross-section data, click the
cross_section page in Data.wf
in order to activate that Page.
- Here we have population data
for all 50 U.S. states in 2000.
Changing the Sample in Cross-Section Data
Observation Pairs: Example 1
- Suppose you would like to work with a subsample of US states that
includes Arizona through Hawaii.
- For this, you must set the sample based on their observation order (
through 11) and not by using the state identifier.
Changing the Sample in Cross-Section Data
Observation Pairs: Example 2
- As in the other example, consider defining the sample over consecutive and
non-consecutive observation pairs.
Define the sample over consecutive and non-consecutive pairs.
- Select any of the methods (1-3) that allow you to change the sample.
- The Sample dialog box opens up. In the upper portion of the box under Sample range pairs , type the new sample in observation pairs. 2 2 6 6 8 10 25 25
- Click OK. Note : this command instructs EViews to include only the following observations: 2nd, 6 th, 8-10 and 25th.
Changing the Sample in Cross-Section Data
Observation Pairs: Example 2 (cont’d)
- The range is the same as before (50 states), but the sample only includes the 6 states we specified. .
Sample Keywords:
Example
- Let’s show the use of sample keywords through an example. Define the sample from the beginning of the workfile range to Feb 1980 and from Jan 2005 to the end of the workfile
- Click on the workfile page Payroll.
- Select any of the methods (1-3) that allow you to change the sample.
- The Sample dialog box opens up. In the upper portion of the box under Sample range pairs , type the new sample placing spaces between keywords and dates. As usual, all specifications are done in date pairs: @first 1980m2 2005m1 @last
- Click OK.
Sample Keywords:
Example (cont’d)
- The result is shown here.
- The range is the same as before (January 1950 – May 2005), but the sample has changed.
- The sample now runs from January 1950 (the first observation denoted by @first ) to February 1980 and from January 2005 to May 2012 (the end of the range denoted by @last ).
- Note that the graph (and all other analysis) now reflect the new sample. .
Sample “If” Statements:
Example 1 (cont’d)
- The range is the same as before (January 1950 – May 2005), but the sample has changed.
- The sample now runs from January 1955 – December 1992 and includes only those months when payroll levels rose compared to the previous month.
- Note that by default, EViews drops the excluded observations (months when payrolls declined or stayed the same compared to the previous month). .
Sample “If” Statements:
Example 2
- Let’s work on a slightly more complex example.
- Suppose you would like to restrict the sample to those observations when
“ unemployment ” was between 4% and 6% or when “ payroll ” was
unchanged from the previous month.
Define sample using “if” condition: Example 2
- Select any of the methods (1-3) that allow you to change the sample.
- The Sample dialog box opens up. In the upper portion of the box, type first the sample dates (in pairs). 1955m1 1992m
- In the bottom portion of the Sample box under IF condition , type: (unemployment>4 and unemployment<6) or payroll=payroll(-1)
- Click OK. Note : this command instructs EViews to include only those observations when “ unemploymen t” was between 4 and 6 or when “ payroll ” was unchanged from the previous month