An exercise in computing the variance of the forecast error

2
International Journal of Forecasting 6 (1990) 275-276 North-Holland 275 Teaching Tips The paper below inaugurates Teaching Tips, a new section of the journal. Its purpose is to allow instructors to share ideas relevant to the teaching of forecasting, at any level of instruction. To be considered for publication, a teaching tip need only have been employed successfully by the author (or others); there is no requirement that allegations of its effectiveness be supported by hard empirical evidence. Other than that submissions be brief, there is no restriction on their form or content. To give some examples, a tip could be a novel graphical exposition, an effective assignment question, a stimulating learning game, a particularly good example, an imaginative computer exercise, or a successful class project, which in the author’s experience has proved to possess significant pedagogical value, at any level of instruction. Referees will be asked to evaluate papers in terms of their potential for improving the teaching of forecasting. Submissions should be sent, in triplicate, to Peter Kennedy, Department of Economics, Simon Fraser University, Bumaby, B.C., Canada V5A lS6. An exercise in computing the variance of the forecast error Peter KENNEDY Simon Fraser University, Burnaby, B.C., Canada V5A 1 S6 The purpose of this note is to suggest a supple- ment to the standard exercise asking students to compute the variance of a forecast error in the context of a classical linear regression model. The supplement involves recalculation using the dummy variable method suggested by Salkever (1976); students learn a computational shortcut and strengthen their understanding of dummy variables. Consider the classical linear regression model y = X/3+ E, where the notation is traditional. Given a row vector x0 of new observations on the explanatory variables, the best, linear un- biased forecast of the corresponding y,, is x,#“‘~ and the variance of the forecast error is a’(1 + x,(X’X)-‘xi), where u2 is the variance of E and PO” . 1s the ordinary least squares estimate of P. Students are taught the derivation of these for- mulae and often are asked to compute/estimate them for some specific data. The latter exercise usually takes the form of running a regression using a computer package and then, depending on the sophistication of the package, using com- mands in the package to compute the forecast and the estimate of the variance of the forecast error, or obtaining these using a hand calculator. A useful supplement to this exercise is to ask stu- dents to recalculate these results using Salkever’s method, accomplished by runmng a single, artifi- cial regression. This method can be explained as follows. The data set is extended from N to N + 1 observations by appending a zero to the column of y values (i.e., yN+i = 0) and appending the x,, row to the bottom of the X matrix. An additional explana- tory variable, D, is introduced, taking a value of zero for each of the original observations, and the. value one for the new, artificial, (N + 1)st ob- servation. D is thus a dummy variable equal to one for the observation to be forecast, and zero otherwise. As explained below, regressing y on X nl ~~m~n~n ‘M WI w 0 1990 - Elsevier Science Publishers B.V. (North-Holland)

Transcript of An exercise in computing the variance of the forecast error

International Journal of Forecasting 6 (1990) 275-276

North-Holland

275

Teaching Tips

The paper below inaugurates Teaching Tips, a new section of the journal. Its purpose is to allow instructors to share ideas relevant to the teaching of forecasting, at any level of instruction. To be considered for publication, a teaching tip need only have been employed successfully by the author (or others); there is no requirement that allegations of its effectiveness be supported by hard empirical evidence. Other than that submissions be brief, there is no restriction on their form or content. To give some examples, a tip could be a novel graphical exposition, an effective assignment question, a stimulating learning game, a particularly good example, an imaginative computer exercise, or a successful class project, which in the author’s experience has proved to possess significant pedagogical value, at any level of instruction. Referees will be asked to evaluate papers in terms of their potential for improving the teaching of forecasting. Submissions should be sent, in triplicate, to Peter Kennedy, Department of Economics, Simon Fraser University, Bumaby, B.C., Canada V5A lS6.

An exercise in computing the variance of the forecast error

Peter KENNEDY Simon Fraser University, Burnaby, B.C., Canada V5A 1 S6

The purpose of this note is to suggest a supple- ment to the standard exercise asking students to compute the variance of a forecast error in the context of a classical linear regression model. The supplement involves recalculation using the dummy variable method suggested by Salkever (1976); students learn a computational shortcut and strengthen their understanding of dummy variables.

Consider the classical linear regression model y = X/3 + E, where the notation is traditional. Given a row vector x0 of new observations on the explanatory variables, the best, linear un- biased forecast of the corresponding y,, is x,#“‘~ and the variance of the forecast error is a’(1 + x,(X’X)-‘xi), where u2 is the variance of E and PO” . 1s the ordinary least squares estimate of

P. Students are taught the derivation of these for-

mulae and often are asked to compute/estimate them for some specific data. The latter exercise

usually takes the form of running a regression using a computer package and then, depending on the sophistication of the package, using com- mands in the package to compute the forecast and the estimate of the variance of the forecast error, or obtaining these using a hand calculator. A useful supplement to this exercise is to ask stu- dents to recalculate these results using Salkever’s method, accomplished by runmng a single, artifi- cial regression.

This method can be explained as follows. The data set is extended from N to N + 1 observations by appending a zero to the column of y values (i.e., yN+i = 0) and appending the x,, row to the bottom of the X matrix. An additional explana- tory variable, D, is introduced, taking a value of zero for each of the original observations, and the. value one for the new, artificial, (N + 1)st ob- servation. D is thus a dummy variable equal to one for the observation to be forecast, and zero otherwise. As explained below, regressing y on X

nl ~~m~n~n ‘M WI w 0 1990 - Elsevier Science Publishers B.V. (North-Holland)

and D together, using all N + 1 observations, produces the forecast of y0 and an estimate of the variance of the forecast error.

Because the first N values of D are zero, D has no influence on the magnitude of the residuals for the first N observations and, consequently, its coefficient estimate S* can be chosen to make the residual for the (N + 1)st observation equal to zero. This means that the other coefficient esti- mates will be chosen to minimize the sum of squared residuals associated with the first N ob- servations, producing exactly #Pis, the result of regressing y on X for the first N observations. The ( N + 1)st residual is (y,,, 1 - x-,,/?‘~~ - 6 * ); to make this zero, S * will be chosen to be ( y, + , - x0/30’s), the forecast error. When *vN+, is set equal to zero, as was done above, 6* is the negative of xopO’s, the forecast of y,,.

Regardless of what value of y,, , is employed, S * is an estimate of the forecast error (yN+t - xO/Pis). Consequently, the estimated variance of 6* is an estimate of the variance of the forecast error.

This explanation can be made clearer to stu- dents by employing a graph of a regression line for the case of a single explanatory variable w. Suppose we wish to forecast y for w = w,. Then the dummy variable coefficient is estimated as the negative of the distance from point (wO, 0) to the regression line; this distance is just the forecast of y.

Several variants or extensions of this exercise are possible.

(a) Advanced graduate students could be given the Salkever reference, which is short and read- able, and asked to figure out for themselves how to obtain these estimates using this method.

(b) This method could be taught in class and students asked to apply it.

(c) In the assignment description, students could be led step-by-step through the calculations, and then afterwards shown in class why it works.

(d) Students could be asked to compute the estimate of the variance of the forecast, rather than the variance of the forecast error. This would require subtracting the estimate of a2 from the estimate of the variance of the forecast error.

(e) Students could be asked to evaluate the following statement: “In the artificial regression

the sum of squared errors is exactly the same as in the original regression, but the sampfe size is larger (by one), so the estimate of a* will be slightly smaller.” Explaining why this is false requires recognizing that the number of regressors is larger by one as well, so the denominator in the formula for the estimate of uJ? does not change.

(f) Students could be asked to evaluate the following statement: “The R2’s of the two regres- sions will be the same because the sum of squared errors is the same.” Explaining why this is false requires recognizing that the total sum of squares has increased. A (difficult) supplement to this is to ask what value of yN+* should be employed to keep R2 unchanged and still allow easy calcula- tion of the forecast. To prevent the total sum of squared errors from increasing, Y,,, + 1 must be set equal to the mean of the sample y values; sub- tracting the mean of the y values from S* pro- duces the negative of the forecast.

(g) If the value of y0 were known, students could be asked to construct the artificial regres- sion so that the forecast error, rather than the negative of the forecast appears as the estimated coefficient on D. This would require using .yO rather than zero as the value for y,, ,.

(h) An extension of (g) above is to ask students to test whether or not the (N + l)st observation is consistent with the estimated relationship. The t-test for testing 6 = 0 is straightforward.

(i) An extension of (g) and (h) is to provide students with two, rather than one, extra observa- tions and ask them to test whether or not they are (jointly) consistent with the estimated relation- ship. This requires structuring two special dummy variables as above, and using an F-test. If stu- dents have been taught the “Chow” test for use with a “small” second sample, the instructor could note that these two ways of testing for a “‘struct- ural break” are identical; all this variant of the Chow test does is test for whether or not the actual y values lie within the joint forecast confi- dence region.

Reference

Salkever, D.S., 1976, “The use of dummy variables to compute predictions, prediction errors and confidence intervals”, Journal of Economefrics, 4, 393-397.