Using gret l for Principles of Econometrics, 4th Edition

Exponential Smoothing

Another popular model used for predicting the future value of a variable based on its history is exponential smoothing. Like forecasting with an AR model, forecasting using exponential smoothing does not use information from any other variable.

The basic idea is that the forecast for next period is a weighted average of the forecast for the current period and the actual realized value in the current period.

Ут +1 = аут + (1 - а)ут (9.16)

The exponential smoothing method is a versatile forecasting tool, but one needs a value for the smoothing parameter a and a value for yT to generate the forecast yT_ 1 . The value of a can reflect one’s judgment about the relative weight of current information; alternatively, it can be estimated from historical information by obtaining within-sample forecasts

Подпись: (9.17)yt = ayt_і + (1 - a)yt_і

and choosing that value of a that minimizes the sum of squares of the one-step forecast errors

Подпись: (9.18)vt = yt - yt = yt - (ayt-1 + (1 - a)yt-1)

Smaller values of a result in more smoothing of the forecast. Gretl does not contain a routine that performs exponential smoothing, though it can perform other types.

Below, the okun. gdt data are used to obtain the exponentially smoothed forecast values of GDP growth. First the data are opened. Then the series to be smoothed is placed in a matrix called y. The number of observations is counted and an another matrix called sm1 is created; it is na T x 1 vector of zeros. We will populate this vector with the smoothed values of y. In line 5 the smoothing parameter is set to 0.38.

There are several ways to populate the first forecast value. A popular way is the take the average of the first (T + 1)/2 elements of the series. The scalar stv is the mean of the first 50 observations. The full sample is then restored.

The loop is quite simple. It loops in increments of 1 from 1 to T. The —quiet option is used to suppress screen output. For the first observation, the vector sm1[1] receives the initial forecast, stv. For all subsequent smoothed values the exponential smoothing is carried out. Once the loop ends the matrix is converted back into a series so that it can be graphed using regular gretl functions.

1 open "@gretldirdatapoeokun. gdt"

2 matrix y = { g }

3 scalar T = $nobs

4 matrix sm1 = zeros(T,1)

5 scalar a = .38

6 smpl 1 round((T+1)/2)

7 scalar stv = mean(y)

8 smpl full

9 loop i=1..T —quiet

10 if i = 1

11 matrix sm1[i]=stv

12 else

13 matrix sm1[$i]=a*y[$i]+(1-a)*sm1[i-1]

14 endif

15 endloop

16 series exsm = sm1

17 gnuplot g exsm —time-series

The time-series plot of GDP growth and the smoothed series is found in Figure 9.18. Increasing the smoothing parameter to 0.8 reduces the smoothing considerably. The script appears at the end of the chapter, and merely changes the value of a in line 5 to 0.8. The figure appears below in the bottom panel of Figure 9.18.

Gretl actually includes a function that can smooth a series in a single line of code. The movavg function. To exponentially smooth the series g

1 scalar tmid = round(($nobs+1)/2)

2 scalar a = .38

3 series exsm = movavg(g, a, tmid)

The function takes three argumants. The first is the series for which you want to find the moving average. The second is smoothing parameter, a. The final argument is teh number of initial observations to average to produce y0. This will duplicate what we did in the script. It is worth mentioning that the movavg function will take a regular moving average if the middle argument is set to a positive integer, with the integer being the number of terms to average.

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

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 Александр
- телефон для консультаций и заказов спец.оборудования, дробилок, уловителей, дражираторов, гереторных насосов и инженерных решений.