Using gret l for Principles of Econometrics, 4th Edition

Series Plots

The first thing to do when working with time-series is to take a look at the data graphically. A time-series plot will reveal potential problems with your data and suggest ways to proceed statistically. In gretl time-series plots are simple to generate since there is a built-in function

that performs this task. Open the data file usa. gdt and create the first differences using the diff command. The first differences of your time-series are added to the data set and each of the differenced series is prefixed with ‘d_e. g., Agdpt = gdpt — gdpt-l ^ d_gdp.

1 open "@gretldirdatapoeusa. gdt"

2 diff b inf f gdp

3 setinfo b - d "3-year Bond rate" - n "3-year Bond rate"

4 setinfo d_b - d "Change in the 3-year Bond rate" - n "D. BOND"

5 setinfo inf - d "annual inflation rate" - n "inflation rate"

6 setinfo d_inf - d "Change in the annual inflation rate" - n "D. INFLATION"

7 setinfo gdp - d "real US gross domestic product" - n "Real GDP"

8 setinfo d_gdp - d "= first difference of gdp" - n "D. GDP"

9 setinfo f - d "federal funds rate" - n "Fed Funds Rate"

io setinfo d_f - d "= first difference of f" - n "D. FED_FUNDS"

Next, I want to add descriptions and labels for graphing. This is done using the setinfo command. Recall, the - d switch changes the description and - n assigns a label to be used in graphs. Text needs to be enclosed in double quotes.

Plotting the series can be done in any number of ways. The easiest is to use view>multiple graphs>Time series from the pull-down menu. This will allow you to graph the eight series in two batches. Two batches are required since the maximum number of series that can be graphed simultaneously is currently limited to six.

Use your mouse to select four of the series. I chose inf, d_inf, f, d_f. Once these are highlighted choose View>Multiple graphs>Time-series from the pull-down menu. These variables should appear in the ‘Selected vars’ box. You can change the ordering of the variables by highlighting a variable and a right mouse click. The Up/Down box opens and clicking Down will place d_inf below inf in the list.

Then, select Add>First differences of selected variables from the pull-down menu as shown in Figure 12.2. You can gain more control over how the graphs look by plotting the series individually and then editing the graphs to taste. For instance, here is the plot of the change in the bond rate, with recessionary periods highlighted (Figure 12.3).

іувз іууі іуус уїли _._іу

1985 19 91 199 7 2IJIJ3 2IJIJ9

1У 3 j 1991 1997 200 J 2.J9

1985 1991 1997 2003 2009

Figure 12.1: Highlight inf, d_inf, f, and d_f using the mouse. Then choose View>Multiple graphs>Time-series from the pull-down menu to open the dialog box. Click OK reveals this graph.

The next thing to do is to create a set of summary statistics. In this case, the textbook has you produce summary statistics for subsamples of the data. The first subsample consists of the 52 observations from 1984:2 to 1996:4. The second also contains 52 observations and continues from 1997:1 to 2009:4. The summary command is used to obtain the summary statistics on the desired subsample. In the script, open the data file usa. gdt and change the sample to 1984:2-1996:4 using the command smpl 1984:2 1996:4. Issue the summary —simple command to print the condensed set of summary statistics of all variables in memory to the screen. Finally, restore the sample to the full range using smpl full.

Ordinarily, gretl’s smpl functions are cumulative. This means that whatever modifications you make to the sample are made based on the sample that is already in memory. In this example though, we were able to load the second subperiod without having to first restore the full sample. This is undocumented so it may stop working at some point. If so, just issue a smpl full command after getting summary statistics for the first subset.

The script is

Figure 12.2: Add the first differences of the selected series from the pull-down menu.

1 smpl 1984:2 1996:4

2 summary —simple

3 smpl 1997:1 2009:4

4 summary —simple

5 smpl full

This produces

Summary

statistics, using the

observations

1984:2 - 1996:4

Mean

Minimum

Maximum

Std. Dev.

gdp

5813.0

3906.3

8023.0

1204.6

inf

6.9037

1.2800

13.550

3.3378

f

6.4173

2.9900

11.390

2.1305

b

7.3431

4.3200

12.640

1.9398

d_b

-0.10294

-1.5400

1.4500

0.63128

d_inf

-0.16059

-1.8000

1.4300

0.83201

d_f

-0.086471

-2.1200

0.97000

0.58607

d_gdp

82.659

-4.6000

161.80

29.333

Full data range: 1984:1 - 2009:4 (n = 104)

Figure 12.3: Individual plots can be edited using the edit controls. This one shows the first differences of the 3 year bond rate. Recessions are shaded grey.

Current sample: 1997:1 - 2009:4 (n = 52)

Summary

statistics, using the

observations

1997:1 - 2009:4

Mean

Minimum

Maximum

Std. Dev.

gdp

11458.

8137.0

14485.

2052.1

inf

3.2194

1.4500

6.0400

1.1166

f

3.4875

0.12000

6.5200

2.0253

b

3.9771

1.2700

6.5600

1.5643

d_b

-0.087500

-1.3300

0.81000

0.47885

d_inf

0.025192

-0.93000

1.5200

0.46174

d_f

-0.099231

-1.4300

0.59000

0.51429

d_gdp

120.27

-293.70

267.90

92.920

Notice that the —simple option is used to suppress other summary statistics like the median, skewness and kurtosis. If these statistics interest you, feel free to remove the option.

One can limit the summary statistics to certain variables by creating a list that follows sum­mary. For instance, to limit the summary statistics to the variables in levels you could use:

list levels = gdp inf f b summary levels —simple

The levels of each time series are put into a list called levels. The summary statistics of all the contents can then be obtained using summary levels.

Добавить комментарий

Using gret l for Principles of Econometrics, 4th Edition

Simulation

In appendix 10F of POE4, the authors conduct a Monte Carlo experiment comparing the performance of OLS and TSLS. The basic simulation is based on the model y = x …

Hausman Test

The Hausman test probes the consistency of the random effects estimator. The null hypothesis is that these estimates are consistent-that is, that the requirement of orthogonality of the model’s errors …

Time-Varying Volatility and ARCH Models: Introduction to Financial Econometrics

In this chapter we’ll estimate several models in which the variance of the dependent variable changes over time. These are broadly referred to as ARCH (autoregressive conditional heteroskedas - ticity) …

Как с нами связаться:

Украина:
г.Александрия
тел./факс +38 05235  77193 Бухгалтерия

+38 050 457 13 30 — Рашид - продажи новинок
e-mail: msd@msd.com.ua
Схема проезда к производственному офису:
Схема проезда к МСД

Партнеры МСД

Контакты для заказов оборудования:

Внимание! На этом сайте большинство материалов - техническая литература в помощь предпринимателю. Так же большинство производственного оборудования сегодня не актуально. Уточнить можно по почте: Эл. почта: msd@msd.com.ua

+38 050 512 1194 Александр
- телефон для консультаций и заказов спец.оборудования, дробилок, уловителей, дражираторов, гереторных насосов и инженерных решений.