Download time series Application in eviews software and more Study notes Performing arts in PDF only on Docsity!
EViews Training
Data Objects: Data Functions
Note: Information for examples in this tutorial can be found in these files. ➢ Data: Data.xlsx ➢ Results: Results.wf 1 ➢ Practice Workfile: Data.wf 1
Data and Workfile Documentation
- Data.wf 1 and Data.xlsx have the following data:
- Workfile Page: Timeseries (Data.xlsx tab Timeseries ): quarterly, Q1 1980 – Q1 2012 ✓ GDP – real GDP data (billions of dollars) from the Bureau of Economic Analysis. ✓ PCE – real consumption data (billions of dollars) from the Bureau of Economic Analysis. ✓ INV – real private sector investments (billions of dollars) from the Bureau of Economic Analysis. ✓ G – real government spending (billions of dollars) from the Bureau of Economic Analysis. ✓ Y – a series that grows over time (trend series).
Generating Random Numbers
Generating Random Numbers (Series):
Example 1
- You can generate a series of (pseudo) random numbers drawn from a variety
of distributions.
- There are a number of ways to generate a random series. Generating a random series: Example 1
- Open EViews workfile Data.wf 1.
- Select Quick → Generate Series from the main menu.
- Type y 1 = @nrnd in the dialog box and press Enter.
Generating Random Numbers (Series):
Example 2
- Alternatively, you can create a random series by typing in the command window. Generating a random series: Example 2
- Type in the command window: series z=@nrnd
- Press Enter.
- This creates a new series z , which
is normally distributed with mean 0
and standard deviation equal to 1.
Generating Random Numbers (Series):
Example 3
- Suppose you want to simulate a random walk process with distribution
properties similar to the observed distribution of an existing series (for
example, gdp ):
Generating a random series: Example 3
- Type in the command window: smpl @all series newdata = 0 smpl 1980 q 2 @last newdata=newdata(- 1 )+@mean(d(gdp))+@stdev(d(gdp))*@nrnd
- Press Enter after each command line.
- Note: for an explanation of statistical functions @mean, @stdev , or d(gdp ), see Descriptive Statistics in this tutorial.
Generating Random Numbers (Series):
Common Functions/Commands
Common Commands/Functions
Function/Command Description series y=@nrnd Normal distribution (mean 0, st. dev. 1) series y=3+@sqr(4)nrnd* Normal distribution (mean 3, variance 4) series y=@rlognorm(1,4) Lognormal distribution (mean=1, st. dev 4) series y=@runif(1,3) Uniform distribution on (1,3) series y=@rnd Uniform distribution on (0,1) series y=1+(3-1)@rnd* Uniform distribution on (1,3) (same as @runif(1,3))
- EViews has a number of functions/commands that allow you to draw from a
variety of distributions.
- The most commonly used functions/commands are summarized below.
Generating Random Numbers (Series):
PDF and CDF
Function Description series d1 = @runif(0,2) show d1 @dunif(d1,0,2) @cunif(d1,0,2 ) Creates d1 as uniform distribution on (0,2) Displays series d1 created above, pdf of d1 and cdf of d
- It is also very easy to generate the pdf and cdf of a random variable. Generating a random series together with its pdf and cdf:
- Type in the command window: smpl @all series d 1 = @runif(0,2) show d 1 @dunif(d1,0,2) @cunif(d1,0,2)
- Press Enter after each command line.
Functions for Descriptive Statistics
- EViews has extensive built-in descriptive statistical functions.
- These descriptive statistical functions take an optional sample as an argument.
- The default sample is the current workfile range.
Descriptive Statistics
Descriptive Statistics Functions:
Example 1
- Suppose you want to create a series x 1 , which is equal to the mean of the
“ gdp ” series.
Descriptive Statistics Functions: Example 1
- Type in the command window: series x 1 = @mean(gdp)
- Press Enter.
- This creates a new series x 1 which has all elements equal to the mean of GDP.
Descriptive Statistics Functions:
Example 2
- As a next example, consider creating another series x2 , which is equal to the
mean of the “gdp” series, defined over several sub-samples:
Descriptive Statistics Functions: Example 2
- Type in the command window: smpl 1980 q 1 1989 q 4 series x 2 =@mean(gdp, " 1980 q 1 1989 q 4 ") smpl 1990 q 1 1999 q 4 series x 2 =@mean(gdp, " 1990 q 1 1999 q 4 ") smpl 2000 q 1 @last series x 2 =@mean(gdp, " 2000 q 1 @last") smpl @all
- Press Enter after each command line.
Descriptive Statistics Functions:
Example 3
- Suppose you want to create a variable which is the average (or sum) of
multiple series.
Descriptive Statistics Functions: Example 3 1a. One way to do this is to type the following in the command window : series new=(gdp+pce+inv)/ 3 1b. Another way, would be to type in the command window group row functions: group groupdata gdp pce inv This creates a new group (named “groupdata”) with containing the three series. 2b. Now type the following command in the command window: series new=@rmean(groupdata) This creates a series which is computed by taking the mean of all the three series for each row.
- Press Enter after each command line.
Descriptive Statistics Functions:
Example 4
- Suppose you want to collect descriptive statistics in a vector (or matrix). Descriptive Statistics Functions: Example 4
- Let’s first define the sample over which descriptive stats are computed. Type in the command window: smpl 1980m01 1990m
- Next, let’s create a vector v by typing in the command window: vector(3) v
- Next, define the vector elements to gather the desired statistics, by typing in the command window: v(1)=@mean(gdp) v(2)= @varp(gdp) v(3)= @covs(gdp,pce)
- Press Enter after each command line.